This may be related to running 18.04 LTS as a virtual machine (Host is Win 2016 DC) but I can't figure it out how. I have tried every method of I know of to change the hostname but it always reverts to the hostname I entered when I built the machine on reboot. I have tried the following:
- hostnamectl set-hostname xxx.
- Editing hostname directly.
- Adding --static to hostnamectl.
- Editing hosts file and adding desired hostname.
- Searching drive for references to old hostname before reboot.
- A few other weird suggestions I found on the internet not worth mentioning.
I have no DNS for this server at this time.
Example:
XXXX@iwrxmail:~# hostnamectl
Static hostname: iwrxmail
Pretty hostname: Interwrx Ubuntu Mail Server
Transient hostname: ctl
Icon name: computer-vm
Chassis: vm
Machine ID: 01ef0d836d2c4945b51a4fab8e506381
Boot ID: e6608fe238d843f883cde52af7631a79
Virtualization: microsoft
Operating System: Ubuntu 18.04 LTS
Kernel: Linux 4.15.0-20-generic
Architecture: x86-64
XXXX@iwrxmail:~# hostnamectl set-hostname test
XXXX@iwrxmail:~# hostnamectl
Static hostname: test
Icon name: computer-vm
Chassis: vm
Machine ID: 01ef0d836d2c4945b51a4fab8e506381
Boot ID: e6608fe238d843f883cde52af7631a79
Virtualization: microsoft
Operating System: Ubuntu 18.04 LTS
Kernel: Linux 4.15.0-20-generic
Architecture: x86-64
root@iwrxmail:~# cat /etc/hostname
test
root@iwrxmail:~# cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
However on reboot I get this again ....
XXXX@iwrxmail:~# hostnamectl
Static hostname: iwrxmail
Icon name: computer-vm
Chassis: vm
Machine ID: 01ef0d836d2c4945b51a4fab8e506381
Boot ID: 25a00676b22048eb8d43492c9de4f147
Virtualization: microsoft
Operating System: Ubuntu 18.04 LTS
Kernel: Linux 4.15.0-20-generic
Architecture: x86-64
I had had this issue with the beta of 18.04, but I figured I would wait for the release copy. I also considered it might be a problem with the fact I had cloned the VMs, but this was a brand new version built from scratch with the just released distro.
What am I missing?
Thanks in advance.