Hostname always back to old one after reboot
Hi,
My old hostname was "main". I changed it: Code:
hostname audio Code:
echo audio > /etc/hostname Code:
# cat /etc/hosts Code:
# hostname How on earth is it possible??? Where is "main" written? I can't find it anywhere with grep... THANKS! |
Hello.
hostname "named" is equivalent to writing the specified name into /proc/sys/kernel/hostname, which means it will not survive reboot, is only "memory temporal". If you want to make this permanent on Slackware, there is no /etc/hostname file but there is /etc/hosts which you can define the hostname of your server, in my case, I have Slack 14.1 (32 bits but this is irrelevant) and her name is "icinga" this is how my /etc/hosts file looks like: # For loopbacking. 127.0.0.1 localhost 127.0.0.1 icinga.covenco.cl icinga And it does survive after reboot :) you can edit this manually or you can do it using Slackware "configuration tools" , run in the command prompt pkgtool -> Setup -> netconfig And there reconfigure your network and hostname, changes will be saved and keep on each reboot. Regards. |
Thank you littleball,
Unfortunately, that does not work. And I'm not surprised because I connect in ssh and I already defined this for my LAN addresses, so it should not consider the localhost address. PS: note that hostname is the same on local screen without ssh. |
I am not very clever with networking, sorry if I cannot explain too much deep into it. If you edit inside Slackware 14.1 Server /etc/hosts file like this:
# cat /etc/hosts 127.0.0.1 localhost audio 192.168.10.12 audio.example.org audio 192.168.200.1 audio.example.org audio and reboot networking /etc/rc.d/rc.inet1 restart, logout and login and do "hostname" command, do you keep getting the output of "main"?. Slackware won,t read /etc/hostname this is not an standard hostname path for Slack, (it is for other linux distros), Slack reads from /etc/hosts, you need to add hostname there but on localhost. |
Just in case you still want to know the default hostname file path of Slackware, edit /etc/HOSTNAME - yes HOSTNAME using caps -. Using /etc/hosts should be enough, or running netconfig as root and making changes, but if you want to edit /etc/HOSTNAME, you should see "main" word there :) . rc.M boot script reads from that file to set Slackware hostname.
regards. |
AHHH!!! :)
That's it! It's uppercase HOSTNAME and not hostname! SOLVED! Thank you! :) |
You,re welcome MisterBark, glad you solved it :)
|
All times are GMT -5. The time now is 04:00 PM. |