Did you set up a static hostname in /etc/hostname
? It should be empty if you want to use the Transient hostname or containing localhost
. If possible remove the /etc/hostname
file, without network the fallback hostname is used and it is hardcoded in systemd. NM and systemd-netweorkd will only update the Transient hostname with the value receiving from the DHCP server. The static hostname will not be touched.
By default systemd/hostnamectl will ignore the Transient hostname if a valid static hostname in /etc/hostname
is found. If the static hostname is localhost
the Transient hostname is used. But again the /etc/hostname
file will not be touched. The problems are programs that read form /etc/hostname
. But for example journalctl
will pick up the Transient hostname.
For example (with systemd-networkd, DHCP provided Hostname arch)
With /etc/hostname
containing localhost
$ hostnamectl
Static hostname: localhost
Transient hostname: arch
Icon name: computer-vm
...
With /etc/hostname
removed
$ hostnamectl
Static hostname: n/a
Transient hostname: arch
Icon name: computer-vm
...
with a hostname on /etc/hostname
$ hostnamectl
Static hostname: arch-static
Icon name: computer-vm
Please post the real log entry.