Re: hostname-mode : short vs fqdn name

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 NetworkManager[25235]:
<trace> [1586350409.2521] policy: get-hostname:
"" (from dbus)
Apr 08 14:53:29 NetworkManager[25235]:
<trace> [1586350409.2521] policy: hostname-original: set to

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 ? I don't think it can be set by dhcp if NM is the one which starts dhclient.

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
        return 1

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)...

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 ?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]