New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nss-resolve: example nsswitch.conf renders myhostname unused #5742
Comments
It also seems that |
Hmm, but nss-resolve does return UNVAIL if it can't talk to resolved, hence the dns/myhostname fallback should be used in that case. (But you are right, we should drop the internal dlopen() shortcut to libnss_dns, it makes no sense anymore) |
how precisely did you turn off resolved btw? mask it? disable it? |
It would return UNAVAIL if the libnss_dns fallback didn't exist. I believe the latter returns NOTFOUND.
I don't remember doing anything special to disable it. I believe it's just not running by default on Arch. |
I'm starting to understand why
The above removes the I also noticed that I can't say I mind |
If we could not communicate with systemd-resolved, we would call into libnss_dns. libnss_dns would return a fatal error for stuff like "localhost" and other names resolved by nss-myhostname. So the following recommended configuration in nsswitch.conf would not work: hosts: resolve [!UNAVAIL=return] myhostname Remove the internal fallback code completely so that the fallback logic can be configured in nsswitch.conf. Tested with hosts: resolve [!UNAVAIL=return] myhostname and hosts: resolve [!UNAVAIL=return] dns myhostname Fixes systemd#5742.
If we could not communicate with systemd-resolved, we would call into libnss_dns. libnss_dns would return NOTFOUND for stuff like "localhost" and other names resolved by nss-myhostname, which we would fall under the !UNAVAIL= condition and cause resolution to fail. So the following recommended configuration in nsswitch.conf would not work: hosts: resolve [!UNAVAIL=return] dns myhostname Remove the internal fallback code completely so that the fallback logic can be configured in nsswitch.conf. Tested with hosts: resolve [!UNAVAIL=return] myhostname and hosts: resolve [!UNAVAIL=return] dns myhostname Fixes systemd#5742.
If we could not communicate with systemd-resolved, we would call into libnss_dns. libnss_dns would return NOTFOUND for stuff like "localhost" and other names resolved by nss-myhostname, which we would fall under the !UNAVAIL= condition and cause resolution to fail. So the following recommended configuration in nsswitch.conf would not work: hosts: resolve [!UNAVAIL=return] dns myhostname Remove the internal fallback code completely so that the fallback logic can be configured in nsswitch.conf. Tested with hosts: resolve [!UNAVAIL=return] myhostname and hosts: resolve [!UNAVAIL=return] dns myhostname Fixes systemd#5742.
Arch ships
/etc/nsswitch.conf
with the following hosts line:This seems to be in accordance with the example /etc/nsswitch.conf file found in nss-resolve(8).
My understanding is that
dns
is meant as a fallback for nss-resolve when the latter isn't found on the system. An unintended side-effect of this is thatmyhostname
will not be used if nss-resolve exists, regardless of whethersystemd-resolved
is running.The net effect is that I cannot ping
localhost
or my hostname. (Assumingsystemd-resolved
is not running.) This is bad because I like the idea behindmyhostname
and it would be great if it was used.Maybe myhostname could be moved right before (or immediately after) mymachines?
I'm using systemd 233-3 with 8.8.8.8/8.8.4.4 as my nameservers in /etc/resolv.conf, systemd-resolved is disabled and not running, and my /etc/hosts file is empty.
The text was updated successfully, but these errors were encountered: