You are not logged in.

#1 2018-02-01 22:09:29

chowbok
Member
Registered: 2017-11-27
Posts: 20

[SOLVED] NFS umount delays systemd shutdown or reboot

Okay, I know this has been reported before ad nauseum, but I have yet to find a working solution. Whenever I forget to manually umount my NFS share before rebooting or shutting down, systemd makes me wait 90 seconds while it tries to unmount it. So far I have tried:

  1. Adding _netdev to the fstab entry.

  2. Adding x-systemd.requires=network.target to the fstab entry.

  3. Adding a script to /etc/NetworkManager/dispatcher.d/pre-down.d/ to umount NFS shares, and enabling/starting the NetworkManager-dispatcher service.

  4. Adding the remote-fs target to the multi-user target.

  5. Adding this service file to the multi-user target:

    [Unit]
    Description=Unmount the damn NFS mounts
    After=networking.target
    
    [Service]
    Type=oneshot
    RemainAfterExit=true
    ExecStop=/usr/bin/umount -f -a -t nfs4
    
    [Install]
    WantedBy=multi-user.target

None of these work. Nothing works. What is the magical formula to fix this seemingly common issue?

Last edited by chowbok (2018-02-14 09:47:42)

Offline

#2 2018-02-01 22:15:49

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] NFS umount delays systemd shutdown or reboot

Please edit your thread title and choose one that actually reflects your issue, not your frustration: https://wiki.archlinux.org/index.php/Co … ow_to_post


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2018-02-02 09:00:42

seth
Member
Registered: 2012-09-03
Posts: 51,165

Re: [SOLVED] NFS umount delays systemd shutdown or reboot

The most important question is how *exactly* you mount the remote FS itfp.

Edit: 2nd next question, lmg: NetworkManager?

Last edited by seth (2018-02-02 09:02:58)

Offline

#4 2018-02-02 19:03:19

chowbok
Member
Registered: 2017-11-27
Posts: 20

Re: [SOLVED] NFS umount delays systemd shutdown or reboot

seth wrote:

The most important question is how *exactly* you mount the remote FS itfp.

I currently have this line in my fstab:

remote:/	/remote	nfs	noauto,noatime,x-systemd.requires=network.target,_netdev	0 0

I've tried various other things in the options, but it's always been noauto and I mount it as needed from the command line.

Edit: 2nd next question, lmg: NetworkManager?

Yep. That's why I was experimenting with the NetworkManager-dispatcher service.

Offline

#5 2018-02-02 20:52:00

Buddlespit
Member
From: Chesapeake, Va.
Registered: 2014-02-07
Posts: 501

Re: [SOLVED] NFS umount delays systemd shutdown or reboot

This is my NFS mount service. I don't have an issue with it auto unmounting on shutdown/reboot. I should also note that I have NetworkManager-wait-online.service enabled.

[Unit]
Description=Mount Share (nfs) at boot
Requires=NetworkManager-wait-online.service
After=network-online.target
Wants=network-online.target

[Mount]
What=server:/shares
Where=/mnt/nfs
Options=rw,auto,x-systemd.automount,rsize=8192,wsize=8192,timeo=14
Type=nfs
TimeoutSec=30

[Install]
WantedBy=multi-user.target

Also, this is my fstab entry, just in case systemd breaks:

## NFS
#server:/shares  /mnt/nfs   nfs   rw,auto,x-systemd.automount,rsize=1048576,wsize=1048576,timeo=14	 0  0

Last edited by Buddlespit (2018-02-02 20:55:19)

Offline

#6 2018-02-03 02:29:10

chowbok
Member
Registered: 2017-11-27
Posts: 20

Re: [SOLVED] NFS umount delays systemd shutdown or reboot

Buddlespit wrote:

This is my NFS mount service. I don't have an issue with it auto unmounting on shutdown/reboot. I should also note that I have NetworkManager-wait-online.service enabled.

Interesting, thanks. The problem is that I'm on a laptop, and not always on the same network as my NFS service, so I can't have it auto-mount. But I guess I don't have to enable the unit, right? I can just start it when I need it and it should still use it for the unmounting. I'll try that a few times and let you know how it goes.

Offline

#7 2018-02-03 11:59:30

Buddlespit
Member
From: Chesapeake, Va.
Registered: 2014-02-07
Posts: 501

Re: [SOLVED] NFS umount delays systemd shutdown or reboot

chowbok wrote:

Interesting, thanks. The problem is that I'm on a laptop, and not always on the same network as my NFS service, so I can't have it auto-mount. But I guess I don't have to enable the unit, right? I can just start it when I need it and it should still use it for the unmounting. I'll try that a few times and let you know how it goes.

Ahhh! The plot thickens! I didn't realize that you weren't always on the same network as your server. If my (hardware) server is down (power outage, ect.al), I go thru the 'wait' for both my samba server and my nfs server. Since my desktop is KDE and we were having issues with "waiting for c1" issues on shutdown/reboot, I adjusted the wait time from 90 to 30 seconds.

Offline

#8 2018-02-03 12:52:12

seth
Member
Registered: 2012-09-03
Posts: 51,165

Re: [SOLVED] NFS umount delays systemd shutdown or reboot

tried a "soft" mount (nfs option)

Offline

#9 2018-02-05 17:31:53

chowbok
Member
Registered: 2017-11-27
Posts: 20

Re: [SOLVED] NFS umount delays systemd shutdown or reboot

Buddlespit wrote:

Ahhh! The plot thickens! I didn't realize that you weren't always on the same network as your server. If my (hardware) server is down (power outage, ect.al), I go thru the 'wait' for both my samba server and my nfs server. Since my desktop is KDE and we were having issues with "waiting for c1" issues on shutdown/reboot, I adjusted the wait time from 90 to 30 seconds.

Well, that was what seems to have solved (or at least worked around) my problem. I noticed after using a modified version of your unit file, the umount wait time got reduced to 30 seconds. So I just set TimeoutSec to 1, and now it shuts down right away. Not sure if this counts as a solution since the source of the problem remains, but I'm happy with it. Thanks for your help.

Should I mark this "solved"?

Offline

#10 2018-02-14 09:46:39

chowbok
Member
Registered: 2017-11-27
Posts: 20

Re: [SOLVED] NFS umount delays systemd shutdown or reboot

Okay, after chatting with people in the #systemd IRC channel, I think I've been given the real solution. The mount needs to be specified in fstab with "x-systemd.requires=network-online.target", not "x-systemd.requires=network.target". I've had no problems since mounting it this way. I changed the wiki page that had the wrong target, and I'm going to mark this solved.

Last edited by chowbok (2018-02-14 09:47:10)

Offline

Board footer

Powered by FluxBB