Hardcore Linux

Anything about Ubuntu, Centos, openSuSe and Fedora

Ubuntu 11.04 Shutdown and Restart Problem with CIFS

UPDATE(07/29/2011): The GRUB thing didn’t work at all, back to basic trapping signal via upstart scripts in /etc/init/dbus.conf.  I tried it before using /etc/init/network-manager.conf but on Ubuntu 10.10, it’s not working anymore. Here’s another test and works for me.

1. Modify the current /etc/init/dbus.conf.

$> sudo vi /etc/init/dbus.conf

2. Add a pre-stop script, which looks like this:

pre-stop script
       trap "TERM signal" TERM
      /bin/umount -a -t cifs -l -f
      trap - TERM
end script 

3. Save the script and have a test.

4. Done.

UPDATE(07/28/2011): Found a better alternative via GRUB, link here. Mainly you just need to modify the  /etc/default/grub. Here’s the details:

1. Edit the /etc/default/grub

$> sudo vi /etc/default/grub

2. Add “reboot=pci” on the GRUB_CMDLINE_LINUX line, it should look something like this:

... GRUB_CMDLINE_LINUX="reboot=pci" ...

3. Update the grub

$> sudo update-grub


4. Done


It’s an ancient bug (here), which still exist in Ubuntu 11.04, or even in other distros. When you got a mounted samba shares before the shutdown or restart process, the machine waits for around 10 minutes before it complete the operation. Very troublesome that’s why I tried various workaround but none of them  works with Ubuntu 11.04. Not even the /etc/rc6.d/K*  or the upstart /etc/init configurations, nor the old python script I posted before (here’s the link).

After few considerations, I made a desperate workaround, creating a script that triggers before the /sbin/shutdown, /sbin/reboot and /sbin/restart commands.

1. Rename the current shutdown, reboot and restart commands in /sbin.

#> mv /sbin/shutdown /sbin/shutdown2
#> mv /sbin/reboot /sbin/reboot2
#> mv /sbin/restart /sbin/restart2 

2. Then create scripts with names of the previous commands in /sbin, which contains the following:

umount -t cifs -a -f -l
/sbin/shutdown2 $@
exit 0 

3. Make similar script for reboot and restart command which also points to /sbin/reboot2 and /sbin/restart2.

4.  Until the dbus implementation of stop on deconfiguring-networking comes to Ubuntu 11.04, which I think working with
Ubuntu 11.10 oneiric. I think this is the least workaround that works for me.

5. Done

7 responses to “Ubuntu 11.04 Shutdown and Restart Problem with CIFS

  1. iain.mckeand@gmail.com June 30, 2011 at 10:11 am

    I found the same difficulties and did not find it easy to track down. I created a script which just umounts the mounted CIFS then shutsdown the machine:-


    # shutdown the computer unmounting network drives cleanly

    sudo umount /path/to/mount1
    sudo umount /path/to/mount2 etc

    sudo shutdown -P -h now

    Set the script options to run in a terminal window ( I keep a shortcut in the KDE Desktop ) and one I type the sudo password the computer reliably shutsdown

  2. Gigglo July 26, 2011 at 1:35 am

    Hi hardc0l2e,

    thank you for this solution.

    Unfortunately it doesn’t work for me. Instead of shutdown, it makes a reboot. This system also automatically logs off from time to time.😦

    • hardc0l2e July 26, 2011 at 11:56 am

      I’m also experiencing the reboot instead of shutdown, but it’s better than waiting for several minutes. the automatic log-off.. i think it not within this topic.. might be a hardware problem or something in the kernel modules.

  3. Bob July 26, 2011 at 9:14 pm

    THANK YOU!! I also experience a reboot rather than a shutdown but you cares, that’s what a power button is for as the machine is rebooting.

    It is absolutely ridiculous that Ubuntu does not fix a three year old bug, but can create a whole new window manager ‘Unity’. They need to change their priorities to the user not their personal agenda.

  4. Ivan July 30, 2011 at 10:57 pm

    unfortunately it seems, that this does not work if I am connected through WIFI.

  5. Bob August 3, 2011 at 11:12 am

    Works perfectly!! Thanks! I’m connected through wifi as well, but no problems.

  6. Thorsten October 26, 2011 at 11:40 pm

    I got that problem after updating to ubuntu 11.10. None of these hints worked for me. The entry into dbus.conf just didn’t change anything. When i create the scripts in /sbin, my computer reboots instead of shutting down. Any other ideas to fix this anoying bug?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: