0

Issue: An nfs server is down and it takes your computer down with it!

Specifically it blocks booting. A less drastic example is you take your laptop to your friends and then it can't boot because it's trying to mount an nfs server on your lan.

Confounding issue: You don't want to manually mount it after boot, or perhaps the user who needs it doesn't have mount permission. Maybe you're just lazy? Who cares, it should mount if it can.

When I researched this problem I found there used to be a boot option called nowaitboot that would have solved this issue. Unfortunately it was removed 10 years ago. What's the alternative?

Commonly suggested replacements:

nofail: causes a massive delay (edit: per further testing not always a massive hang. A DNS failure will cause a quick hang, but the server being down will cause a long one)

noauto: doesn't automatically mount

    2 Answers 2

    3

    Instead of hard fixed mount in fstab try to move to usage of autofs

    https://www.redhat.com/en/blog/mount-nfs-filesystems-autofs

    Is will mount NFS share on the first access instead of at the boot time.

    2
    • 1
      Took a bit to figure out configuration, but now soon as you open the folder it mounts. I left the fstab entry but added noauto so KDE will keep the network drive shortcut, but let autofs handle mounting. I'm going to see what else I can use autofs for. Thanks for telling me about it!
      – netsplit
      CommentedDec 25, 2024 at 22:53
    • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
      – CommunityBot
      CommentedJan 5 at 20:03
    0

    Solution:

    bg

    Explanation: Nfs defaults to fg for mounting. It runs in the foreground, or the main thread. Meaning it blocks further booting until the mount either fails or succeeds. This is a good option when booting without a mount point could causes issues. However if a boot stalling is worse than a share not being mounted, then it has the bg option. The bg option runs in the background, strangely enough. This means that forks a new thread to handle mounting the share so the computer can continue booting.

    Further it can be combined with retry=[count], and timeo=[number of 1/10ths of a second] to further tune mounting behavior. For example: bg,retry=15,timeo=60 would retry 15 times with a 6 second wait between attempts. This gives a delay if network is down when booting but network is up during the user session.

    Example in the wild:

    /etc/fstab

    myserver:/ /myservermount nfs4 defaults,users,bg,retry=15,timeo=60,soft 0 0 

    Potential issues: If a critical process needs the network server or bad things will happen, then if the network server is unavailable, bad things will happen. fg is the default for a reason.

    Summary: fg is the default for good reasons, but if those reasons don't apply to you bg can be a usefull replacement for nowaitboot

    3
    • Or, you could simply add the nofail option to The fourth field; ref man fstab.
      – Seamus
      CommentedDec 24, 2024 at 18:07
    • When I tried it the first time nofail did not prevent a significant hang. I just tried it again and it did hang a bit, but a tolerable amount. I don't know what changed for me between then and now. However bg had no identifiable hang when the server wasn't available. So I still say it's superior. For nonessential shares backgrounding the mount should improve boot times regardless.
      – netsplit
      CommentedDec 24, 2024 at 19:07
    • 1
      Actually I figured it out. dns failure will cause a small hang for the nofail option, but if there's a dns record it will hang a very long time trying to connect. So that's the issue with nofail.
      – netsplit
      CommentedDec 24, 2024 at 19:18

    You must log in to answer this question.

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.