Re: Problem automatically unmounting VPN shares

On Sat, 28 Jul 2012 12:50:13 +0100
Peter Rockett <p rockett sheffield ac uk> wrote:

> Hi
> I am trying to automatically mount and unmount a share at my office.
> I have a script in /etc/NetworkManager/dispatch.d which runs along
> the lines:
> #!/bin/bash
> case "$2" in
>      vpn-up)
>          exec mount blah-blah-blah
>          ;;
>      vpn-down)
>          exec umount blah-blah-blah
>          ;;
> esac
> which mounts the share in my home directory (on Ubuntu 11.10 +
> Network Manager v. I swear this all worked fine when I set
> it up in 2010. But some time in the intervening period it has broken.
> (I am infrequent user of VPN since I got DropBox!) I have also
> upgraded from Natty to Oneiric in the meantime...
> Now, VPN connects fine, the remote share is mounted OK. I can
> see/access all the remote files. But when I disconnect from VPN, the
> running of the umount seems to go very wrong. After disconnect, if I
> open a terminal and type "ls" to list the contents of my home
> directory (the mount point), the "ls" command hangs. (Nautilus also
> hangs - either it won't start or, if it was running already, it
> hangs.) Everything else in the OS seems to work OK. It seems for all
> the world as if the mount point is getting screwed and the only
> recovery is to restart (in which the shutdown takes much longer than
> usual).
> The weird thing is that, if I delete the dispatcher script above, 
> connect to VPN, mount the drive manually in a terminal, then umount
> it manually, and disconnect from VPN, everything is fine and as it
> should be. So it seems like the dispatcher daemon is making a mess of
> running the unmount... but not the mount.
> Any ideas where to go with this?

See mount(8), particularly the -l and -f options:

  -f  Force unmount (in case of an unreachable NFS system).
  -l  Lazy unmount. Detach the filesystem from the filesystem 
        hierarchy now, and cleanup all references to the
        filesystem as soon as it is not busy anymore.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]