Lucid dhclient can't set hostname
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dhcp3 (Ubuntu) |
Fix Released
|
Medium
|
Thierry Carrez | ||
Lucid |
Fix Released
|
Medium
|
Thierry Carrez |
Bug Description
Until recently (up to and including Karmic), there was a "set_hostname()" function in /sbin/dhclient-
set_hostname() {
local current_
if [ -z "$current_hostname" -o "$current_hostname" = "(none)" ]; then
hostname "$new_host_name"
fi
}
Up to 9.04, this would work when there was no /etc/hostname. With 9.10 (Karmic), this changed: a missing /etc/hostname sets the hostname to "localhost" and the dhclient-script will no longer set the hostname: this bug is reported as bug #482313 and bug #523188 - see bug #482313 for the fix we have been using for years.
Now with Lucid, the whole thing goes wrong, as the set_hostname() function is missing. There's only:
BOUND|
if [ -n "$old_host_name" -a -n "$host_name" -a \
fi
This is plain wrong for two reasons:
1) as far as I can see, the $host_name variable does not exist at all; there's only an "old_host_name" and a "new_host_name", but "host_name" does not exist - which means the test will never be true.
2) if the test would be true at all, it would still only change the hostname if there is a change in the *dhcp-server supplied hostname*, i.e. if the hostname used to be "foo" and suddenly, the dhcp-server sends a hostname "bar", then the hostname will change.
This is also against the dhclient documentation, see "man dhcp-options":
option host-name string;
This option specifies the name of the client. The name may or may
not be qualified with the local domain name (it is preferable to use
the domain-name option to specify the domain name). See RFC 1035
for character set restrictions. This option is only honored by
set.
This is no longer true: under Lucid, the hostname will not be set at all, no matter what you try to do.
Related branches
description: | updated |
Thank you for taking the time to report this bug and helping to make Ubuntu better. The issue that you reported is one that should be reproducible with the live environment of the Desktop CD of the development release - Lucid Lynx. It would help us greatly if you could test with it so we can work on getting it fixed in the next release of Ubuntu. You can find out more about the development release at http:// www.ubuntu. com/testing/ . Thanks again and we appreciate your help.