LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 10-28-2014, 10:45 AM   #1
MisterBark
Member
 
Registered: Jul 2012
Location: Republic of Krakozhia
Distribution: Slackware & Zenwalk core + compile
Posts: 104

Rep: Reputation: 6
Question Hostname always back to old one after reboot


Hi,

My old hostname was "main".

I changed it:
Code:
hostname audio
I also wrote it:
Code:
echo audio > /etc/hostname
And for my ip addresses:
Code:
# cat /etc/hosts
127.0.0.1		localhost
192.168.10.12		audio.example.org audio
192.168.200.1		audio.example.org audio
 
# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.12  netmask 255.255.255.0  broadcast 192.168.10.255
        ether 44:8a:5b:9a:xx:xx  txqueuelen 1000  (Ethernet)
        RX packets 186  bytes 17511 (17.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 120  bytes 23567 (23.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 18  

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.200.1  netmask 255.255.255.0  broadcast 192.168.200.255
        ether 68:05:ca:27:xx:xx  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 19  memory 0xf78c0000-f78e0000  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 0  (Local Loopback)
        RX packets 4  bytes 344 (344.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4  bytes 344 (344.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
But after rebooting:
Code:
# hostname
main

# cat /etc/hostname 
audio

# cat /etc/hosts
127.0.0.1		localhost
192.168.10.12		audio.example.org audio
192.168.200.1		audio.example.org audio
Slackware64 14.1, but very custom built.

How on earth is it possible???
Where is "main" written? I can't find it anywhere with grep...

THANKS!
 
Old 10-28-2014, 11:06 AM   #2
littleball
Member
 
Registered: Jan 2011
Distribution: Slackware, Red Hat Enterprise
Posts: 47

Rep: Reputation: 8
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.

Last edited by littleball; 10-28-2014 at 11:11 AM.
 
Old 10-28-2014, 11:34 AM   #3
MisterBark
Member
 
Registered: Jul 2012
Location: Republic of Krakozhia
Distribution: Slackware & Zenwalk core + compile
Posts: 104

Original Poster
Rep: Reputation: 6
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.

Last edited by MisterBark; 10-28-2014 at 11:48 AM.
 
Old 10-28-2014, 12:19 PM   #4
littleball
Member
 
Registered: Jan 2011
Distribution: Slackware, Red Hat Enterprise
Posts: 47

Rep: Reputation: 8
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.

Last edited by littleball; 10-28-2014 at 12:20 PM.
 
Old 10-28-2014, 12:29 PM   #5
littleball
Member
 
Registered: Jan 2011
Distribution: Slackware, Red Hat Enterprise
Posts: 47

Rep: Reputation: 8
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.
 
Old 10-28-2014, 12:39 PM   #6
MisterBark
Member
 
Registered: Jul 2012
Location: Republic of Krakozhia
Distribution: Slackware & Zenwalk core + compile
Posts: 104

Original Poster
Rep: Reputation: 6
AHHH!!!
That's it!

It's uppercase HOSTNAME and not hostname!
SOLVED!


Thank you!
 
Old 10-28-2014, 12:43 PM   #7
littleball
Member
 
Registered: Jan 2011
Distribution: Slackware, Red Hat Enterprise
Posts: 47

Rep: Reputation: 8
You,re welcome MisterBark, glad you solved it
 
  


Reply

Tags
hostname, hostname change



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help my linux box keep reboot after change the hostname findingnemo Linux - Newbie 2 01-06-2009 06:33 PM
weird hostname appeared, want the original back rksanders Debian 2 12-05-2004 05:53 PM
hostname resetting to localhost on unclean reboot brian_h1 Linux - Networking 0 05-11-2004 08:18 PM
hostname keeps changin on reboot FlyingSmurf Mandriva 13 10-06-2003 08:09 PM
Hostname changes after reboot spg001 Linux - Newbie 6 08-14-2003 02:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration