[SOLVED] Hostname always back to old one after reboot
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
Last edited by littleball; 10-28-2014 at 11:11 AM.
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.
Last edited by MisterBark; 10-28-2014 at 11:48 AM.
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:
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.
Last edited by littleball; 10-28-2014 at 12:20 PM.
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.
Last edited by littleball; 10-28-2014 at 12:32 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.