Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Feb 2025 01:25:20 +0100
From:      Lars Tunkrans <drsnx60@gmail.com>
To:        Rick Macklem <rick.macklem@gmail.com>
Cc:        FreeBSD CURRENT <freebsd-current@freebsd.org>, Gleb Smirnoff <glebius@glebi.us>
Subject:   Re: RFC: mount_nfs failure due to dns not running yet
Message-ID:  <CAGB138yCGHfqCfcGewg4bWZhK0V3JmVVK-jpUwDXPrzSLuNT0A@mail.gmail.com>
In-Reply-To: <CAM5tNy5wA9DyBP%2BJdq1O6J=VVtXm6Rmm5rtXjJqyJRKvJ8WY=A@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
This situation has existed these past 40 years.  You have to put your
ipadress : hostname pairs into /etc/hosts  if you dont have accsss to a
working DNS.    This is not a bug.  Its the way name resolution works.

Den ons 19 feb. 2025 23:40Rick Macklem <rick.macklem@gmail.com> skrev:

> Hi,
>
> The subject line basically describes the problem glebius@
> ran into.  When doing an NFS mount in /etc/fstab, it failed
> since the DNS service was not yet working and, as such,
> the DNS lookup of the server fqdn failed, causing the mount
> to fail. Note that this behaviour has existed for decades.
>
> He feels this is a bug and that mount_nfs(8) should retry
> getaddrinfo(3) calls until success, instead of failing the
> mount when the first attempt fails.
> The problem with just retrying getaddrinfo(3) is that it
> could retry forever for simple failures like a typo in the
> server fqdn.
> I can see several ways this can be handled and would
> like feedback from others w.r.t. these alternatives.
>
> 1) Simply document this case and encourage use of
>     host names in /etc/hosts for NFS servers along with
>     specifying use of file before dns in nsswitch.conf.
>      Doing this results in the mounts working whether or
>       not DNS is working.
>
> 2) Call it a bug and patch mount_nfs(8) to retry getaddrinfo(3)
>      until it succeeds. (I feel this would be a POLA violation,
>      given that the current behaviour has existed for decades
>      and for simple cases where the fqdn will never resolve
>      the behaviour would be to hang at the mount attempt
>      during boot unless "bg" is specified for the /etc/fstab entry.)
>
> 3) Add a new NFS mount option "retrydns=<N>", which would enable
>     retries of getaddrinfo(3). This would avoid any POLA violation and
>     would allow for a convenient way to document the behaviour in
>     "man mount_nfs".
>
> 4) ???
>
> So, what do you think is the preferred change?
>
> rick
> ps: I looked and the return value from getaddrinfo(3) does not
>       appear to be useful to discern the case of "DNS service not
>       running yet". (I think it replies EAI_FAIL for this case.)
>
>

[-- Attachment #2 --]
<p dir="ltr">This situation has existed these past 40 years.  You have to put your ipadress : hostname pairs into /etc/hosts  if you dont have accsss to a working DNS.    This is not a bug.  Its the way name resolution works.</p>
<br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">Den ons 19 feb. 2025 23:40Rick Macklem &lt;<a href="mailto:rick.macklem@gmail.com">rick.macklem@gmail.com</a>&gt; skrev:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
The subject line basically describes the problem glebius@<br>
ran into.  When doing an NFS mount in /etc/fstab, it failed<br>
since the DNS service was not yet working and, as such,<br>
the DNS lookup of the server fqdn failed, causing the mount<br>
to fail. Note that this behaviour has existed for decades.<br>
<br>
He feels this is a bug and that mount_nfs(8) should retry<br>
getaddrinfo(3) calls until success, instead of failing the<br>
mount when the first attempt fails.<br>
The problem with just retrying getaddrinfo(3) is that it<br>
could retry forever for simple failures like a typo in the<br>
server fqdn.<br>
I can see several ways this can be handled and would<br>
like feedback from others w.r.t. these alternatives.<br>
<br>
1) Simply document this case and encourage use of<br>
    host names in /etc/hosts for NFS servers along with<br>
    specifying use of file before dns in nsswitch.conf.<br>
     Doing this results in the mounts working whether or<br>
      not DNS is working.<br>
<br>
2) Call it a bug and patch mount_nfs(8) to retry getaddrinfo(3)<br>
     until it succeeds. (I feel this would be a POLA violation,<br>
     given that the current behaviour has existed for decades<br>
     and for simple cases where the fqdn will never resolve<br>
     the behaviour would be to hang at the mount attempt<br>
     during boot unless &quot;bg&quot; is specified for the /etc/fstab entry.)<br>
<br>
3) Add a new NFS mount option &quot;retrydns=&lt;N&gt;&quot;, which would enable<br>
    retries of getaddrinfo(3). This would avoid any POLA violation and<br>
    would allow for a convenient way to document the behaviour in<br>
    &quot;man mount_nfs&quot;.<br>
<br>
4) ???<br>
<br>
So, what do you think is the preferred change?<br>
<br>
rick<br>
ps: I looked and the return value from getaddrinfo(3) does not<br>
      appear to be useful to discern the case of &quot;DNS service not<br>
      running yet&quot;. (I think it replies EAI_FAIL for this case.)<br>
<br>
</blockquote></div>
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGB138yCGHfqCfcGewg4bWZhK0V3JmVVK-jpUwDXPrzSLuNT0A>