Container loses domain from hostname at (re) boot


May 20, 2020
My Ubuntu 20.04LTS containers are losing the domain part from the hostname when the container is (re) started.

The impacted system (currently a 2-node cluster, 3rd node to be added) is running Proxmox 6.1-7 and was provisioned a few days ago. This has several Ubuntu 20.04LTS containers and VMs. The VMs are not affected. The LXC template was downloaded from the default pveam list. I need the domain part included in the hostname to keep my monitoring system happy.

I also have 2 other Proxmox clusters (also 6.1-7) running a variety of VMs and containers - including Ubuntu 18.04LTS, but not 20.04LTS. These do not display the same issue.

In Proxmox, Options->hostname contains myname.mydomain

I have tried:

  1. chmod a-w /etc/hostname (+reboot)
  2. Removed "myname" entry in /etc/hosts file (leaving "myname.mydomain") (+reboot)
  3. root@myhost:/etc# chattr +i hostname
    chattr: Operation not permitted while setting flags on hostname
  4. set "kernel.domainname = myname.mydomain" in /etc/sysctl.conf (+reboot)
  5. Set "Domains=bip" in resolved.conf (+reboot)
/var/log/syslog shows the hostname being set correctly at boot, but the login prompt, the shell prompt and /etc/hostname (updated at boot) all show "myname"

May 20 13:16:35 myname dbus-daemon[148]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.8' (uid=0 pid=634 comm="hostnamectl set-hostname myname.mydomain " label="unconfined")
May 20 13:16:35 myname systemd-resolved[164]: System hostname changed to 'myname.mydomain'.
May 20 13:16:35 myname systemd-hostnamed[635]: Changed static host name to 'myname.mydomain'


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!