ec2-init: ec2-set-hostname should be eliminated, trust DHCP

Bug #407861 reported by Eric Hammond
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
EC2 init scripts
Fix Released
Undecided
Unassigned
Ubuntu on EC2
Fix Released
Wishlist
Unassigned

Bug Description

As Patrick J. McNerthney pointed out, the fix for bug #352745 still leaves some problems in place for images created from rebundled running instances.

New instances created from the rebundled image start with an /etc/hosts containing the internal DNS name of the old instance.

Attempting to fix this by overwriting the hostname could overwrite some hostname which the user intended to be put in place in /etc/hosts.

My recommendation at this point is to follow the practice I've been using forever in the Ubuntu images for EC2 I publish on http://alestic.com which is to simply let DHCP do its job in setting the hostname from Amazon and letting any override set by a user stand without modification.

The EC2 images would be created with no /etc/hostname file and with an /etc/hosts file which contains no entry for 127.0.1.1. There would be no need for the ec2-set-hostname startup script.

I'm opening a new bug report because reading through bug #352745 might lead to some confusion with the back and forth as seen by the fact that Patrick's reported problem has not been corrected.

This bug also replaces bug #402273 since /etc/hostname would not exist.

Eric Hammond (esh)
description: updated
Eric Hammond (esh)
summary: - ec2-set-hostname should be eliminated, trust DHCP
+ ec2-init: ec2-set-hostname should be eliminated, trust DHCP
Chuck Short (zulcss)
Changed in ec2-init:
status: New → Confirmed
Changed in ubuntu-on-ec2:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Soren Hansen (soren) wrote :

The goal is to have the hostname set to whatever EC2 provides.

I've changed ec2-set-hostname so that it doesn't instrument /etc/hosts anymore.

Using ec2-set-hostname with a generic name in /etc/hostname sets a hostname /very/ early in the boot process (rcS.d/S02hostname.sh), which then gets overridden by hostname.
Without an /etc/hostname, there is no hostname set until dhcp runs.

On EC2, this should for almost all intents and purposes, not matter AFAICS. However, having an /etc/hostname in the image means one less EC2 special case in VMBuilder and also aids in my own testing (having a hostname set early on makes it easier to compare syslogs afterwards).

For this reason, I'm leaving ec2-set-hostname around, at least for the time being.

Revision history for this message
Eric Hammond (esh) wrote :

I'm not a fan of having the (incorrect) "ubuntu" hostname in /etc/hostname and /etc/hosts, though I have not yet found any specific problems this might cause. It is also odd to have the ".canonical.com" domain in the /etc/hosts file. That doesn't seem like a reasonable default in any case.

Revision history for this message
Soren Hansen (soren) wrote :

Ah, yes, you're absolutely right about .canonical.com in /etc/hosts. That needs fixing. It's a completely separate bug (unrelated to ec2-init), though, so I'm going to mark this one as fixed released. Feel free to reopen if you find this is unjustified.

Changed in ec2-init:
status: Confirmed → Fix Released
Changed in ubuntu-on-ec2:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.