Saturday, 27 August 2011

Kubuntu - CIFS Mounts Hang at Shutdown

One of the problems I've experienced with my recent installation of Kubuntu is something I've come across before: the process that unmounts CIFS shares hangs at shutdown, delaying the power-down sequence by several minutes (some users report even longer delays!).

After some effort, I finally understand what causes the problem and discovered a fix that works on my test machine (signs of Linux maturity perhaps?). However, I had to dig very deep to resolve the issue: I came across the following solution on page 7 of my Google search (after following pretty much every link on the first six pages) and the answer wasn't even on a direct link, but a link from a link! The actual instructions are in post #160 of the bug report, demonstrating the benefits of persistence!

The problem is well documented and caused by an error in the shutdown sequence. It seems that the Network Manager is closed before the share(s) are dis(un)mounted - the effect of this sequence is that, once the Network Manager has been closed, there is no longer a network over which to make or receive a call to unmount. There are several solutions posted on the Internet, most revolve around scripts for unmounting the CIFS shares that are then symlinked to earlier processes in the shutdown sequence - I tied them all, but none worked (for me). Kudos then to c0l2e, the author of the following:

"found a better fix via /etc/init/dbus.conf

add the pre-stop script:

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

It works for me and few tested notebooks and desktop PC."

(c0l2e post #160 - Ubuntu Bug Reports: Bug #211631)

I can confirm that this solution works for a DELL Inspiron 1501 and that my Kubuntu installation now closes in under fifteen seconds.

Sources & References:

1 comment:

  1. I can confirm that this fix works on my DELL Inspiron 6400.

    It's ironic that something that I was prepared to tolerate on a stable machine was almost a "deal breaker" on a test.