The officially official Devuan Forum!

You are not logged in.

#1 2025-12-21 12:41:55

Roberto
Member
Registered: 2023-08-20
Posts: 12  

[SOLVED] Unmount CIFS shares before shutdown

I am using Devuan Excalibur and I have mounted various CIFS shares in fstab at startup.
Now I want to unmount these shares before shutdown.

I created the folders Data and Storage in my home directory as mountpoint for theses shares.

I tried this with the following simple script:

#!/bin/sh

umount -l /home/user/Data
umount -l /home/user/Storage

exit

I saved this script in the folder /etc/NetworkManager/dispatcher.d/pre-down.d and then made it executable with the command

sudo chmod +x /etc/NetworkManager/dispatcher.d/pre-down.d/umount.sh

Nevertheless, it takes about 3 minutes for the system to shut down.

Thank you in advance for your help an tips.

Regards
Roberto

Last edited by Roberto (2025-12-21 12:46:13)

Offline

#2 2025-12-21 13:36:07

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,611  

Re: [SOLVED] Unmount CIFS shares before shutdown

Do you really want that script to exit before the unmounting has completed?
If not, then don't use "-l" as umount option.

Offline

#3 2025-12-21 13:44:03

Dutch_Master
Member
Registered: 2018-05-31
Posts: 319  

Re: [SOLVED] Unmount CIFS shares before shutdown

Rename the script cifsdown.sh, copy to /etc/init.d, give it executable rights like you already did then create a symlink in /etc/rc0.d Make sure the sym-link in /etc/rc0.d is named K01cfisdown.sh DO NOT deviate from that name, as the order of shutting down services is important.

Alternatively, execute the following line by line:

sudo su #only if you use sudo, otherwise just use su instead
mv /etc/NetworkManager/dispatcher.d/pre-down.d/umount.sh /etc/init.d/cifsdown.sh
chmod +x /etc/init.d/cifsdown.sh
ln -s /etc/init.d/cifsdown.sh /etc/rc0.d/K01cifsdown.sh

You can use cp instead of mv to keep a copy in the original location. That's the difference between cp and mv: cp leaves a copy, mv (move) doesn't. Make sure you disable the script left there before rebooting:

chmod -x /etc/NetworkManager/dispatcher.d/pre-down.d/umount.sh

HTH!

Online

#4 2025-12-22 18:26:50

Roberto
Member
Registered: 2023-08-20
Posts: 12  

Re: [SOLVED] Unmount CIFS shares before shutdown

Hi guys,

thank you for your help.
The tip from Dutch_Master has solved my problem.

Regards
Roberto

Offline

#5 2026-02-12 20:43:06

Roberto
Member
Registered: 2023-08-20
Posts: 12  

Re: [SOLVED] Unmount CIFS shares before shutdown

Please excuse me for reopening this thread.

I reinstalled Devuan Exclaibur 6.1 today.
I installed openRC as the init system.

To unmount my cifs shares during shutdown, I followed the exact same advice given in this post, which worked great last time.
After logging in as root with sudo su, I ran the following:

nano /etc/init.d/cifsdown.sh

I filled this script with the following:

#!/bin/sh

umount -l /home/user/Data
umount -l /home/user/NAS
umount -l /home/user/Storage

exit

All mount points are available in my home directory.

Then I executed the following commands:

chmod +x /etc/init.d/cifsdown.sh
ln -s /etc/init.d/cifsdown.sh /etc/rc0.d/K01cifsdown.sh
ln -s /etc/init.d/cifsdown.sh /etc/rc0.d/K06cifsdown.sh

Despite all this, the system still takes at least 3 minutes to shut down.

Does anyone have any idea why unmounting the CIFS shares isn't working this time?

Thanks in advance for your help.

greets
Roberto

Offline

Board footer