Ubuntu 11.04. Hostname has reverted to default value.

Hello people,

recently I have installed Ubuntu 11.04 to VPS and have changed hostname using following steps:

1. Create /etc/hostname file and put "mydomain.com" to it

2. Edit /etc/hosts file and put these new lines:

127.0.1.1  mydomain.com
123.456.789.0 mydomain.com

where 123.456.789.0 is IP address of VPS.

3. Type as root:

# hostname mydomain.com

After these operations, hostname was changed, but it has been reverted back to default Linode's value in three cases:

1. Just after some hours.

2. After VPS reboot.

3. After doing

# service networking restart

I have no this problem with older Ubuntu versions: 9.10, 10.04, 10.10 on Linode VPS.

7 Replies

Try this:

http://library.linode.com/getting-start … ian-ubuntu">http://library.linode.com/getting-started#sph_debian-ubuntu

Thanks waldo!

I have commented SET_HOSTNAME='yes' in /etc/default/dhcpcd and at least after restarting "networking" service, hostname has not reverted.

Thanks, Waldo. So useful!

I am a cloud newbie and can see why dhcpcd is used and why I never hit this one before. Saved a lot of pulling out of hair!

i have comment out the setting as per the doc, but still facing the same problem, any one can help ?

@knight:

i have comment out the setting as per the doc, but still facing the same problem, any one can help ?

If you have not already done so, try rebooting the linode. That is what it took for one of the debian systems I'm managing to finally get in line.

Make sure /etc/hostname contains the correct hostname for your server prior to rebooting.

it seem like reboot does the trick , thanks !

@knight:

it seem like reboot does the trick , thanks !

You are welcome, however before you jump for joy check it in a few hours and see if it reverted, if not then cheer.

Good luck. :)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct