Hostname changes on every reboot

Started by crazyeyes19877, February 23, 2018, 09:28:00 AM

Previous topic - Next topic

crazyeyes19877

Hostname changes on every reboot I want the hostname to be "server1.domain.com" it changes like it should but when I reboot it goes back to "server1" I dont have a clue what to do I type in hostname it responds with "server1" and then hostname -f "server1.domain.com" that does not change even after reboot I am bit new to this... :'(



Jamshed Datori

Kindly change the hostname through Change Hostname option in CWP admin panel.

crazyeyes19877

I did but when it reboots or updating it reset back to "server1"

n8v8r

there are couple of places to specify the hostname. You may run a meta search for that string in question and see where it pops up and adjust accordingly.

grep --exclude-dir={boot,dev,media,mnt,proc,run,sys,root} -rnw '/' -e "server1"

crazyeyes19877

Million things popped up dont know what to do with it really sorry

n8v8r

more refined search, yielding less results. it may take a few minutes to complete the searcch

grep --exclude-dir={boot,dev,media,mnt,proc,run,sys,root,var,postfix,dovecot,lvm} -rnw '/' -e "server1"

n8v8r

The most likely places where the hostname is stipulated are

Quote/etc/hosts
/etc/hostname

crazyeyes19877

for some reason now all my pages are "HTTP Test Page" so everything is kinda broken and dont know what to do about it :(

crazyeyes19877

Ok I sorted out the http test I accidentally changed the shared IP

But still sorting out host name 

crazyeyes19877

/etc/hosts
This does not change until I update the hostname from the web interface

127.0.0.1 localhost.localdomain localhost
# Auto-generated hostname. Please do not remove this comment.
123.123.123.123 server1.domain.com  server1
::1 localhost

/etc/hostname
This does change when I update or restart
that is what I change it to
server1.domain.com
after reboot
server1

crazyeyes19877

Just want to add one thing its not the vps settings that is set to "server1.domain.com"

crazyeyes19877

I am thinking I am getting confused between fqdn and hostnames but still not sure how to sort it out

crazyeyes19877

I did some research on this problem and I have sort it out by locking the hostname file and I just did hosts aswell just incase I think its the hosting provider that did this but here i used this code.

To lock

chattr +i /etc/hosts /etc/hostname

To unlock

chattr -i /etc/hosts /etc/hostname

If there is a problem with this to cwp please some one let me know thank you