You are not logged in.

#1 2021-01-18 15:51:59

ozooha
Member
Registered: 2009-09-29
Posts: 184

[SOLVED] nfs systemd mount - hangs on boot if fileserver unavailable

Below is my systemd enabled mnt-NFSDrive.mount file to mount my nfs drive.

[Unit]
Description=Mount Share at boot

[Mount]
What=myserver:/media
Where=/mnt/NFSDrive
Options=noauto
Type=nfs
TimeoutSec=30
ForceUnmount=true

[Install]
WantedBy=multi-user.target

What are the Options I need to ensure that if the myserver is unavailable then it should continue to boot into the desktop?
As of now this hangs on boot and shows a black screen, with a cursor, without getting into the desktop.

Let me know your thoughts and suggestions.
Thanks,
OZooHA

Last edited by ozooha (2021-01-24 16:59:00)

Offline

#2 2021-01-18 16:31:11

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,623

Re: [SOLVED] nfs systemd mount - hangs on boot if fileserver unavailable

"noauto" should™ prevent the mount from happen… well, automatically.

Ensure that this is the offending file and there's no other reference to that FS.
Then remove the unit, add an fstab entry

myserver:/media	/mnt/NFSDrive 	nfs  users,intr,noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,actimeo=3,noatime,soft,bg,proto=tcp,mountproto=tcp 0 0

and see how that behaves.
(What you can expect is that the FS isn't mounted until you try to access /mnt/NFSDrive and soft-fails w/o permanently stalling the foregound process, eg. your shell)

Offline

#3 2021-01-23 04:25:14

ozooha
Member
Registered: 2009-09-29
Posts: 184

Re: [SOLVED] nfs systemd mount - hangs on boot if fileserver unavailable

The point of my post was not use the fstab way as you suggested but to go with the systemd way.
Can I port some of those fstab options into systemd? if yes, which ones are those?
OZooHA

Offline

#4 2021-01-23 09:12:15

loqs
Member
Registered: 2014-03-06
Posts: 19,025

Re: [SOLVED] nfs systemd mount - hangs on boot if fileserver unavailable

ozooha wrote:

The point of my post was not use the fstab way as you suggested but to go with the systemd way.
Can I port some of those fstab options into systemd? if yes, which ones are those?

See the FSTAB section of man 5 systemd.mount.

Offline

#5 2021-01-23 09:28:07

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,623

Re: [SOLVED] nfs systemd mount - hangs on boot if fileserver unavailable

The point of my post was not use the fstab way as you suggested but to

make your life harder…

man systemd.mount wrote:

   Default Dependencies
       The following dependencies are added unless DefaultDependencies=no is set:

       •   All mount units acquire automatic Before= and Conflicts= on umount.target in order to
           be stopped during shutdown.

       •   Mount units referring to local file systems automatically gain an After= dependency on
           local-fs-pre.target, and a Before= dependency on local-fs.target unless nofail mount
           option is set.

       •   Network mount units automatically acquire After= dependencies on remote-fs-pre.target,
           network.target and network-online.target, and gain a Before= dependency on
           remote-fs.target unless nofail mount option is set. Towards the latter a Wants= unit
           is added as well.

       When reading /etc/fstab a few special mount options are understood by systemd which
       influence how dependencies are created for mount points. systemd will create a dependency
       of type Wants= or Requires= (see option nofail below), from either local-fs.target or
       remote-fs.target, depending whether the file system is local or remote.

       noauto, auto
           With noauto, the mount unit will not be added as a dependency for local-fs.target or
           remote-fs.target.
This means that it will not be mounted automatically during boot,
           unless it is pulled in by some other unit. The auto option has the opposite meaning
           and is the default. Note that the noauto option has an effect on the mount unit itself
           only — if x-systemd.automount is used (see above), then the matching automount unit
           will still be pulled in by these targets.

Offline

#6 2021-01-24 16:58:24

ozooha
Member
Registered: 2009-09-29
Posts: 184

Re: [SOLVED] nfs systemd mount - hangs on boot if fileserver unavailable

So appending nofail did the trick.

Offline

Board footer

Powered by FluxBB