Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, August 29, 2014 7:35 PM
I'm struggling with a strange problem on a Ubuntu 14.04.1 LTS VM running on Azure. My hostname keeps getting reverted to the hostname displayed in the Azure Portal.
This is my /etc/hostname
dbc1mdb
And this my /etc/hosts
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
10.0.1.6 dbc1mdb
10.0.1.7 dbc1sdb1
I am really pulling my hair out. Any suggestions?
All replies (5)
Wednesday, September 3, 2014 5:38 AM âś…Answered
Hi Oliver,
Yes, please make sure Provisioning.MonitorHostName is set to "y" in /etc/waagent.conf
# Please restart walinuxagent
service walinuxagent restart
hostname musicbox
# You will then see an entry in the /var/log/waagent.log similar to
2014/09/02 11:32:43 EnvMonitor: Detected host name change: testing -> musicbox
2014/09/02 11:32:43 Setting host name: lunchbox
Regards,
Manu Rekhar
Saturday, August 30, 2014 5:51 AM
Hi,
If you rename the hostname from the guest, the Azure portal should reflect the new name within a few minutes. Note that this changes just the instance name and not the DNS name (i.e. *.cloudapp.net) since the latter belongs to the cloud service. If you want to change the DNS name, you'll need to delete the cloud service, recreate it using the new name, and then redeploy the VM inside of it.
You may change the hostname using the following commands WITHOUT REBOOT:
$ sudo vim /etc/hostname
$ sudo vim /etc/hosts
$ sudo /etc/init.d/hostname restart
First, edit both files /etc/hostname to change the hostname, and edit /etc/hosts to add the new name. Then, run the hostname script as shown above.
All you need to do now is to terminate your current SSH session and reconnect to see the new host name.
Regards,
Manu Rekhar
Saturday, August 30, 2014 6:01 AM
Hi Manu
Thanks for your reply. Two points:
- That the hostname is correctly setup at boot time is imperative for certain services in the VM to start up correctly. The change needs to be persistent. Is there a way to do that?
- Second, do I need to set Provisioning.MonitorHostName=y in /etc/waagent.conf to make your suggestion work?
Oliver
Saturday, August 30, 2014 10:30 AM
Just for testing I've created a brand new VM from the same base Image (Ubuntu Server 14.04 LTS) that I've used for my current VM.
Without installing and additional packages, I've tried the following to permanently change the hostname:
- Change the host name in /etc/hostname and /etc/hosts
- Change the host name with: hostnamectl set-hostname foobar
- Edit /etc/dhcp/dhclient.conf and comment out host-name from the request
- Edit /etc/dhcp/dhclient.conf and add supersede host-name "foobar";
- Add log statements to /usr/sbin/waagent to verify if the agent is overriding the hostname. It is not.
- apt-get remove walinuxagent (uninstalled azure linux agent) to make sure its really not the agent
All of these attempts have been followed by a restart after which the hostname reverted to the original hostname. All my configuration file edits were still in place but totally ignored.
Then I created a new VM based OpenLogic CentOS based image. Editing /etc/sysconfig/network and restarting the VM immediately had the desired effect.
I don't know but I think both Ubuntu Server 14.04 LTS and Ubuntu Server 12.04 LTS images (tried both) have a serious problem in this regard. This has already cost me at least a day to resolve with no solution in sight.
I would encourage you or anyone from MS Azure Staff to test it yourself.
Tuesday, September 2, 2014 9:23 AM
Hi Oliver,
I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.
Sorry for any inconvenience.
Regards,
Manu Rekhar