Author Topic: Hostname changes on every reboot  (Read 1015 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Hostname changes on every reboot
« on: February 23, 2018, 09:28:00 AM »
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... :'(

Offline
*
Re: Hostname changes on every reboot
« Reply #1 on: February 23, 2018, 09:42:37 AM »
Are you using AWS ec2 or Google cloud?

Offline
*
Re: Hostname changes on every reboot
« Reply #2 on: February 23, 2018, 09:44:57 AM »
I am using a VPS from vpscheap.net

Offline
*
Re: Hostname changes on every reboot
« Reply #3 on: February 23, 2018, 10:05:51 AM »
Kindly change the hostname through Change Hostname option in CWP admin panel.

Offline
*
Re: Hostname changes on every reboot
« Reply #4 on: February 23, 2018, 10:07:57 AM »
I did but when it reboots or updating it reset back to "server1"

Offline
****
Re: Hostname changes on every reboot
« Reply #5 on: February 23, 2018, 10:19:19 AM »
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.

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

Offline
*
Re: Hostname changes on every reboot
« Reply #6 on: February 23, 2018, 10:48:42 AM »
Million things popped up dont know what to do with it really sorry

Offline
****
Re: Hostname changes on every reboot
« Reply #7 on: February 23, 2018, 11:07:01 AM »
more refined search, yielding less results. it may take a few minutes to complete the searcch

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

Offline
****
Re: Hostname changes on every reboot
« Reply #8 on: February 23, 2018, 11:12:09 AM »
The most likely places where the hostname is stipulated are

Quote
/etc/hosts
/etc/hostname

Offline
*
Re: Hostname changes on every reboot
« Reply #9 on: February 23, 2018, 11:28:12 AM »
for some reason now all my pages are "HTTP Test Page" so everything is kinda broken and dont know what to do about it :(

Offline
*
Re: Hostname changes on every reboot
« Reply #10 on: February 23, 2018, 11:35:56 AM »
Ok I sorted out the http test I accidentally changed the shared IP

But still sorting out host name 

Offline
*
Re: Hostname changes on every reboot
« Reply #11 on: February 23, 2018, 12:02:52 PM »
/etc/hosts
This does not change until I update the hostname from the web interface
Code: [Select]
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
Code: [Select]
server1.domain.comafter reboot
Code: [Select]
server1

Offline
*
Re: Hostname changes on every reboot
« Reply #12 on: February 23, 2018, 12:07:55 PM »
Just want to add one thing its not the vps settings that is set to "server1.domain.com"

Offline
*
Re: Hostname changes on every reboot
« Reply #13 on: February 23, 2018, 12:53:57 PM »
I am thinking I am getting confused between fqdn and hostnames but still not sure how to sort it out

Offline
*
Re: Hostname changes on every reboot
« Reply #14 on: February 27, 2018, 03:47:16 PM »
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

Code: [Select]
chattr +i /etc/hosts /etc/hostname
To unlock

Code: [Select]
chattr -i /etc/hosts /etc/hostname
If there is a problem with this to cwp please some one let me know thank you