# Ubuntu – Networkmanager: dispatcher.d/pre-down.d is not executed on shutdown anymore

network-managershutdown

I am using this (https://askubuntu.com/a/674106/39966) solution to unmount a NFS on shutdown.
But now I discovered, that in most of the cases, when I shutdown the computer via the XFCE menu, the pre-down script is not executed (I see this by a logger message which is not appearing)

• Others where having the same problem.

It looks like there was a change in Network Manager which no longer closes the connection on shutdown of Network Manager. I was able to add a systemd service to be executed when the network goes offline.

I created a file /etc/systemd/system/networkdown.service with the content:

[Unit]
Wants=network-online.target
After=network.target network-online.target

[Service]
Type=oneshot
ExecStart=/bin/true
ExecStop=/bin/umount /media/media
RemainAfterExit=yes


This seems to work.