On Fri, Apr 10, 2020 at 07:44:51PM +0200, Thomas HUMMEL wrote:
On 4/9/20 10:59 AM, Beniamino Galvani wrote:alking about D-Bus, I see this in the begining of all 3 (default, none, dhcp) traces : Apr 08 14:53:29 maestro-1000.maestro.pasteur.fr NetworkManager[25235]: <trace> [1586350409.2521] policy: get-hostname: "maestro-1000.maestro.pasteur.fr" (from dbus) Apr 08 14:53:29 maestro-1000.maestro.pasteur.fr NetworkManager[25235]: <trace> [1586350409.2521] policy: hostname-original: set to "maestro-1000.maestro.pasteur.fr" how is this hostname fully qualified who sets it ? The original hostname always seems to be this one.I don't know, it is set before NM starts.Hello, again I tried to figure out the simplier case : hostname-mode=none. I guess the above fqdn hostname read from D-Bus is the transient hostname, correct ?
Yes.
I don't think it can be set by dhcp if NM is the one which starts dhclient.
Correct. But I see that when NM starts, there are already dynamic addresses configured on the interface: Apr 08 14:53:28 maestro-1000.maestro.pasteur.fr NetworkManager[25235]: <debug> [1586350408.9701] platform: (enp33s0f0) signal: address 4 added: 192.168.152.2/20 lft 43173sec pref 43173sec ... and so probably DHCP was run before NM. Is this machine booting from a network share? Are you passing any network-related command line to kernel, like for example ip=... ? In such case, networking would be configured in the initrd by dracut.
As a matter of fact, I saw that dhconfig() from dhcpd-scripts /usr/sbin/dhclient-script can indeed set the transient hostname. The problem is that it sets the transient name only if hostname is needed, which, looking at the script is if transient hostname is empty or localhost : need_hostname () { CHECK_HOSTNAME=$(hostnamectl --transient) if [[ "${CHECK_HOSTNAME}" = "(none)" ]] || [[ "${CHECK_HOSTNAME}" = "localhost" ]] || [[ "${CHECK_HOSTNAME}" = "localhost.localdomain" ]]; then return 0 else return 1 fi } which must not be the case because of the fqdn hostname we see BEFORE NM starts (I am assuming that dhclient is only started by NM of course here)...
The dhclient-script is not run when dhclient is started by NM.
Or could that initial fqdn hostname come from systemd-hostnamed at boot which would fall back setting the transient hostname by reverse dns lookup of the ip address ?
No, I don't think it does. I think that DHCP is run before NM, probably in initrd or by other services. Beniamino
Attachment:
signature.asc
Description: PGP signature