New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad /etc/hosts entry when zone's IP is set to "dhcp" #121

Open
kreutter opened this Issue Sep 26, 2012 · 6 comments

Comments

Projects
None yet
5 participants
@kreutter

kreutter commented Sep 26, 2012

The zone's primary nic is set up to request an iP address using DHCP, when the zone is running it can't resolve its hostname and /etc/hosts looks funny:

::1        localhost
127.0.0.1  localhost loghost
        2a28be29-755d-43e8-b0c0-87e35621a5e1.local
        ...
        2a28be29-755d-43e8-b0c0-87e35621a5e1.local

After every zone start there is an additional line with 2a28be29-755d-43e8-b0c0-87e35621a5e1.local without an IP address. This of course causes other services like apache to fail an remain in maintenance mode. Any ideas besides not using DHCP?
(Running SmartOS joyent_20120906T221231Z)

@MerlinDMC

This comment has been minimized.

Show comment
Hide comment
@MerlinDMC

MerlinDMC Sep 27, 2012

Contributor

The duplication in /etc/hosts on reboot does not happen with the latest base dataset 55330ab4-066f-11e2-bd0f-434f2462fada - sdc:sdc:base:1.8.1 but the /etc/hosts entry is missing the ip as well.

Maybe there can be a 5-10 seconds delay in /opt/local/lib/zoneinit/includes/03-ips.sh if one of the interfaces is set to dhcp - or just omit the /etc/hosts entry in that case.

If I start the scripts after the dhcp client got the ip everything seems to run fine.

To determine if the interface is set to dhcp data-get works at least on SmartOS hosts mdata-get sdc:nics.0.ip

@kreutter as a workaround i would suggest to recreate the zone with a newer base dataset and after initial setup just edit /etc/hosts manually

Contributor

MerlinDMC commented Sep 27, 2012

The duplication in /etc/hosts on reboot does not happen with the latest base dataset 55330ab4-066f-11e2-bd0f-434f2462fada - sdc:sdc:base:1.8.1 but the /etc/hosts entry is missing the ip as well.

Maybe there can be a 5-10 seconds delay in /opt/local/lib/zoneinit/includes/03-ips.sh if one of the interfaces is set to dhcp - or just omit the /etc/hosts entry in that case.

If I start the scripts after the dhcp client got the ip everything seems to run fine.

To determine if the interface is set to dhcp data-get works at least on SmartOS hosts mdata-get sdc:nics.0.ip

@kreutter as a workaround i would suggest to recreate the zone with a newer base dataset and after initial setup just edit /etc/hosts manually

@steakknife

This comment has been minimized.

Show comment
Hide comment
@steakknife

steakknife Oct 13, 2012

Manual edits are for people that don't understand the need for idempotent changes.

The offending script should follow a standard grep sed echo pattern to prevent this.

steakknife commented Oct 13, 2012

Manual edits are for people that don't understand the need for idempotent changes.

The offending script should follow a standard grep sed echo pattern to prevent this.

@joshwilsdon

This comment has been minimized.

Show comment
Hide comment
@joshwilsdon

joshwilsdon Dec 10, 2012

Member

I think this should have been fixed in a newer dataset, can you please try base-1.8.4 and see if this still happens?

Member

joshwilsdon commented Dec 10, 2012

I think this should have been fixed in a newer dataset, can you please try base-1.8.4 and see if this still happens?

@ghost ghost assigned mamash Dec 10, 2012

@kreutter

This comment has been minimized.

Show comment
Hide comment
@kreutter

kreutter Dec 11, 2012

@joshwilsdon /etc/hosts doesn't get messed up with base-1.8.4 but there is no entry for the hostname (dhcp configured IP). I would at least expect .<dns_domain> to show up there. A reverse DNS lookup would also be fine.

I noticed that the above mentioned 03-ips.sh script is missing in /opt/local/lib/zoneinit/includes.

kreutter commented Dec 11, 2012

@joshwilsdon /etc/hosts doesn't get messed up with base-1.8.4 but there is no entry for the hostname (dhcp configured IP). I would at least expect .<dns_domain> to show up there. A reverse DNS lookup would also be fine.

I noticed that the above mentioned 03-ips.sh script is missing in /opt/local/lib/zoneinit/includes.

@kreutter

This comment has been minimized.

Show comment
Hide comment
@kreutter

kreutter Dec 11, 2012

@joshwilsdon it also seems that with base-1.8.4 the resolvers entry in the vmadm configuration is not used to set up /etc/resolv.conf. I get the default:nameserver 8.8.8.8 nameserver 8.8.4.4
I would also expect to have a domain entry there.

Maybe it is because mdata-get sdc:resolvers returns an error: Error getting metadata for key sdc:resolvers: FAILURE. sdc:uuid and sdc:dns_domain return the correct values.

Guess I should open a new issue for this one?

kreutter commented Dec 11, 2012

@joshwilsdon it also seems that with base-1.8.4 the resolvers entry in the vmadm configuration is not used to set up /etc/resolv.conf. I get the default:nameserver 8.8.8.8 nameserver 8.8.4.4
I would also expect to have a domain entry there.

Maybe it is because mdata-get sdc:resolvers returns an error: Error getting metadata for key sdc:resolvers: FAILURE. sdc:uuid and sdc:dns_domain return the correct values.

Guess I should open a new issue for this one?

@mamash

This comment has been minimized.

Show comment
Hide comment
@mamash

mamash Dec 11, 2012

Contributor

03-ips.sh is deprecated (all configuration logic now takes place in 02-config.sh). It makes no sense for provisioner to put the DHCP provided IP into /etc/hosts, because the IP could change on a subsequent reboot. However, we can consider adding a functionality to update /etc/hosts appropriately (based on ipconfig parsed).

Retrieving sdc:resolvers never worked because of a platform bug that Josh fixed last week. I'll need to confirm this with a recent platform first.

Contributor

mamash commented Dec 11, 2012

03-ips.sh is deprecated (all configuration logic now takes place in 02-config.sh). It makes no sense for provisioner to put the DHCP provided IP into /etc/hosts, because the IP could change on a subsequent reboot. However, we can consider adding a functionality to update /etc/hosts appropriately (based on ipconfig parsed).

Retrieving sdc:resolvers never worked because of a platform bug that Josh fixed last week. I'll need to confirm this with a recent platform first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment