You are not logged in.
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:
Adding _netdev to the fstab entry.
Adding x-systemd.requires=network.target to the fstab entry.
Adding a script to /etc/NetworkManager/dispatcher.d/pre-down.d/ to umount NFS shares, and enabling/starting the NetworkManager-dispatcher service.
Adding the remote-fs target to the multi-user target.
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
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
Offline
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
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
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
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
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
tried a "soft" mount (nfs option)
Offline
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
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