How to: Tips and Tricks

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 scripts
  2. Disable password prompt
  3. Make nice launchers for reboot and shutdow

1. Create scripts

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

gedit init0

and paste this into it

#!/bin/bash
sudo umount -a -t cifs
sudo init 0

4. Edit file init6

gedit 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 /bin directory:

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.

2. Disable password prompt

If You do not want to be prompted with password, edit file /etc/sudoers with visudo. Enter this command in Terminal:

sudo visudo

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

sudo init6

or for shutdown

sudo init0

3. Make nice launchers for reboot and shutdown

Next step is to make two launchers with nice icons.

1. Right click on the Desktop and select Create Launcher…

Menu: Create Launcher

2. Fill out needed fields.

Type: Application
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.

Create Launcher

I know, it's not elegant, but it works :)

  • Ha, this is what I call a pretty dirty hack, I’m sure there is an ‘official’ way to do this!