It appears that with the recent versions of Fedora (>= 33?) the default placement of “myhostname” inside the “/etc/nsswitch.conf” file is after “files”.
hosts: files myhostname mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns
This, however, does no longer allow DNS services to resolve the hostname to its FQDN. When trying to join a domain, it will even fail due to that reason.
While I can work around by manually placing it to where it used to be (in between “resolve” and “dns”)…
hosts: files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] myhostname dns
… as soon as I join the machine, it starts some processes in the background and flips it right back to before my change. While the joining works and I can, of course, throw it back to where I placed it 5 minutes ago again, I fear that without a proper configuration, this may as well be undone again in the future at a time I least expect it to happen.
I want to avoid adding the immutable attribute to that file as it may have other consequences and/or using a script in a cron job to watch that my settings are keeping sane.
My impression is that this may have been introduced at the same time SystemD ResolveD was introduced (maybe even due to its introduction), but cannot be sure.
Re-reading “/etc/nsswitch.conf”, I can see in its comments:
myhostname Use systemd host names
So, it indeed appears to originate from SystemD ResolveD.
Since I doubt that SystemD ResolveD is all but a short-time farce, which will pass by, it may be better to get this properly configured. It’s default settings at least do not seem to care too much about the very reason it was developed to replace (which includes other DNS services to resolve its own hostname to the FQDN).
Is there a way to configure SystemD ResolveD to accept that there are DNS servers out there to resolve the hostname for it or is the only way really the above dodgy workaround and/or to get rid of it entirely?