Umount CIFS problem: Reboot and Shutdown
If You mount samba shares using cifs method like I, You probably have met with delays at shutdown or restart.
[18.312000] CIFS VFS: Server not responding [18.312000] No response for cmd 5 mid 8
To avoid this delay it is necessary to umount all samba shares before rebooting or shutdown your computer. There are many solutions to fix this problem, but no one did not work for me when i am connected via wifi. So I made two simple launchers for Reboot (init 6) and Shutdown (init 0).
1. Create hidden directory (eg
.scripts) in your home directory, that will contain files you will create:
cd mkdir .scripts
2. Create two files eg. init0, init6 and make them executable:
cd ~/.scripts touch init0 touch init6 chmod +x init0 chmod +x init6
3. Edit file init0
and paste this into it
#!/bin/bash sudo umount -a -t cifs sudo init 0
4. Edit file init6
and paste this
#!/bin/bash sudo umount -a -t cifs sudo init 6
Note: For more info about umount type
man umount in Terminal.
5. Make symbolic links in
sudo ln -s ~/.scripts/init0 /bin/init0 sudo ln -s ~/.scripts/init6 /bin/init6
That's it. Now if You enter
sudo init6 in the terminal, all samba shares with cifs will be umounted and the computer will be restarted without any delay. This solution works also with wifi connection.
If You do not want to be prompted with password, edit file
visudo. Enter this command in Terminal:
at the end of the file enter
%admin ALL=(ALL) NOPASSWD: /sbin/init, /bin/umount
This line means, that all users in admin group can use the init command without password prompt.
Save the file with
ctrl+x key, hit
y to owerwrite the file. Now You can type in Terminal for reboot
or for shutdown
Next step is to make two launchers with nice icons.
1. Right click on the Desktop and select Create Launcher…
2. Fill out needed fields.
Name: Shutdown (Reboot)
Command: init0 (init6)
Comment is not necessary
Click on the icon to choose an icon from disc. If you do not have any, Google helps you.
I know, it's not elegant, but it works :)