I use network manager and mount a NFS drive via a custom script




if [ "${IF}" = "eth0" ] && [ "${STATUS}" = "up" ]; then

        mount /media/media
        exit $?

elif [ "${IF}" = "eth0" ] && [ "${STATUS}" = "down" ]; then
        umount /media/media

But when I shutdown my computer it does not switch of. Pressing ESC revealed that the stop job for unmounting /media/media does not stop running.

How can I properly umount on shutdown? I think the unmount has to happen before NetworkManager disconnects.


Based on adonis' comment I was able to fix this as follows:

  • create a new file /etc/NetworkManager/dispatcher.d/pre-down.d/99nfs.sh
  • make it executable
  • contents:

    logger "down: unmounting nfs shares PREDOWN"
    umount /media/media

of course I could also have checked for the interface, but I did not this time.

edit This solution broke. See Networkmanager: dispatcher.d/pre-down.d is not executed on shutdown anymore for followup.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.