You are not logged in.

#1 2015-06-13 09:24:48

jotterson
Member
Registered: 2015-03-14
Posts: 4

NetworkManager umounts NFS shares on VPN disconnect.

Hello Folks,

I a couple of scripts to connect to nfs shares depenant on my home or work connections.  I have those sorted out and working fine.  I found that if I attempt to reboot or shutdown with those shares mounted, networkmanager hangs my machine for about 5 minutes before finally shutting down.

I got around this by adding a script to /etc/NetworkManager/dispatcher.d/pre-down.d

#!/bin/bash
umount -a -l -t nfs4

That works like a charm and networkmanager no longer hangs.  I did find a side affect, however.  If I connect to the OpenVPN connection I have setup in networkmanager and then disconnect, it runs that pre-down script and umounts my NFS shares.

I tried wrapping the umount command in an if statement much like I have for the nfs mount scripts I have

#!/bin/bash
if [ "$2" = "down" ] && [ "$CONNECTION_UUID" = "7184a43e-5a14-4735-ba56-533b07fd453d" ]
then
  umount -a -l -t nfs4
fi

With that, my nfs shares do not dismount when the VPN is diconnected, however, they don't dismount when the box is rebooted either.  I guess that this means that "$2" never equals "down" in the "pre-down" stage, so I get why that doesn't work as I hoped.

Anyone have any insight on what I can do for a script that will umount the nfs shares on shutdown, but not on VPN disconnect?

Offline

#2 2015-06-19 16:59:27

Guidobelix
Member
From: Italy
Registered: 2013-06-21
Posts: 31

Re: NetworkManager umounts NFS shares on VPN disconnect.

Indeed, pre-down actions are no longer working (see here).
I am also struggling with the same problem, but haven't found a solution yet.
A solution (maybe not the most elegant one) could be to add a mount statement in your script if $2 is UP, so that, indeed the NFS shares umount on VPN disconnect, but then mount again on reconnect.

Last edited by Guidobelix (2015-06-19 17:07:32)

Offline

Board footer

Powered by FluxBB