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

Re: Cannot change hostname permanently

On 10/02/2006 05:23 AM, Chris Lale wrote:
Kent West wrote:

No, I mean it seems odd that he changes "/etc/hostname", and after reboot it has changed back to the original.

Or at least, that's what I understood him to say in his original post.

Yes, that's it. My packages are up-to-date, my wireless/ADSL modem/router box (Philips SA6500) is switched off, Samba and NFS are purged from the system and any references to the original hostname ("earth") in /etc/hosts are commented out.

The original hostname is "earth". I want to change it to "desktop". This is what happens:

   # hostname

   # hostname desktop
   # hostname

   # shutdown -r now

During reboot I see (blink and you'll miss it)
INIT: version 2.86 booting
   Setting hostname to 'earth' ... done

The above two consecutive lines do not appear in dmesg output.

   # hostname


I did this to check where hostname is set:
$ cd /etc/init.d
$ grep hostname *
hostname.sh:# hostname.sh       Set hostname.
hostname.sh:# Version: @(#)hostname.sh 1.10 26-Feb-2001 miquels@cistron.nl
hostname.sh:if [ -f /etc/hostname ]
hostname.sh:    hostname --file /etc/hostname

It looks to me like /etc/init.d/hostname.sh (/etc/rcS.d/S40hostname.sh) is the only place where the hostname is set, and it uses but does not modify /etc/hostname. Search in /etc/init.d to see if you have the same results.

Another idea might be to make /etc/hostname read-only (chmod 0444), but that might force it to work without fixing the underlying problem.


Reply to: