-
Bug
-
Resolution: Unresolved
-
Normal
-
None
-
rhel-9.2.0, rhel-9.5
-
No
-
Moderate
-
rhel-sst-network-management
-
ssg_networking
-
3
-
False
-
-
None
-
None
-
-
None
-
None
-
None
What were you trying to do that didn't work?
If the static hostname in /etc/hostname is set to "localhost", NetworkManager ignores it (here) and tries to determine the transient hostname via different means such as DHCP or reverse DNS lookup. After it finds a valid transient hostname, it tells systemd-hostnamed to set it; however the transient hostname is ignored by systemd-hostnamed because there is already a static hostname set.
This behavior is confusing: if there is already a static hostname NetworkManager should not even start the machinery to determine the transient hostname, because that is unnecessary work; and especially because when reading the log it is not clear why the transient hostname is not being set in the system, as there is no error or warning.
The considerations above apply only when using systemd-hostnamed. If the service is not available, NetworkManager reads /etc/hostname by itself and sets the hostname directly in kernel. In that case, it will set the "transient" hostname in kernel even if /etc/hostname contains "localhost".
Please provide the package NVR for which bug is seen:
1.42.2, 1.49-dev, probably all versions since at least 5 years
How reproducible:
Always
Steps to reproduce
- hostnamectl hostname localhost
- restart NM or reboot
Expected results
NetworkManager does not try to resolve the transient hostname via DNS. Instead it logs that there is already a static hostname set.
Actual results
NetworkManager resolves the hostname via DNS, and sets the transient hostname via systemd-hostnamed. Hower, that doesn't work and there is no error in the logs.