[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: WORKAROUND Re: Cannot change hostname permanently

Magnus Therning wrote:
On Mon, Oct 02, 2006 at 13:33:01 +0100, Chris Lale wrote:
A workaround is to change the hostname by editing /etc/hostname directly.

  # echo desktop > /etc/hostname

Isn't /etc/hosts involved in this as well?
At least for 'hostname -f' is seems to be.

/etc/hosts seems to be behaving all right. Here is my /etc/hosts file. (I do not know where the entry came from, but I commented out anyway.) Note: I now have "desktop" as the hostname and I am trying to change it to "earth". localhost desktop
# earth.home earth desktop.home desktop laptop.home laptop

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Here is the result of localhost --fqdn (after successful boot retaining the name "desktop" by manually editing /etc/hostname):

   # hostname

   # hostname --fqdn

Here is the result after changing the name to "earth" with the hostname command:

   # hostname earth
   # hostname
   # cat /etc/hostname

   # hostname --fqdn
   hostname: Unknown host

I still cannot work out how hostname is remembering a name ("earth") that it has not saved in /etc/hostname (which still contains "desktop"). hostname --fqdn is also confused and cannot find a host!


Reply to: