I am trying to fix this issue right now. What are the correct commands to run?
I am trying to fix this issue right now. What are the correct commands to run?
How comes Ubuntu isn't able to unmount network drives all by itself when it shuts down entirely?
IMO nobody should need to Google for a script to have Ubuntu behave a little bit like a modern OS.
When I click "Shut down" or "Restart" why isn't it obvious for Ubuntu that my machine will eventually power off completely and that network drives are not needed anymore?
I'd like to understand.
It's not the OS that is at fault. It's the cifs driver.
The cifs driver does not run inside the kernel like all the other drivers but runs inside a separate daemon. Don't ask me why. Ubuntu tries to do the right thing: first shut down all applications, then unmount all network disks, then unmount all local disks. Because this daemon is a separate program, it leads to a catch-22 situation. When Ubuntu shuts down all other programs prior to unmounting, it also shuts down the cifs driver.
That means your network shares have vanished without being unmounted. When in the next step Ubuntu tries to unmount the network shares, you get an error because you don't have connection with the shares anymore.
What my script above does is quite simple. Before the step "stop all applications" it will "stop all applications that use the network shares" and "unmount cifs shares". So, you end up with:
* stop all applications using the cifs share
* unmount the cifs share
* stop all applications (also kills the cifs daemon)
* unmount other network shares
* unmount local disks
Which is the correct order.
Thanks for the explanation (and thanks for the script!), I can see now why things are happening this way.
Still, I find this default behaviour a serious shortcomming.
To the end user it doesn't matter who of the kernel or the driver is responsible for this issue. What they see is: windows connects flawlessly to my NAS (no matter what protocol it uses), Linux does not (unless very complicated and cryptic commands are typed in). Guess what they'll prefer... Arguing that windows is unsafe and part of a world domination plan, and such, doesn't make a point to them. They (and I) want it to "Just Work".
I really want to use Ubuntu, but it is clear that it doesn't allow me to do everything I did (easely) with Windows, unless I become a Linux guru... and sadly I don't have the time and energy to become one... (I prefer to spend my time with my family than to spend it on learning linux cmd lines)
I just hope some day the Ubuntu developers will put the user instead of the system in the center of their concern. I strongly believe it is the only factor which will allow people to massively migrate from windows to linux.
Ubuntu, almost "Just Works".
Humanity <> geeks
Better <> Cmd line
I agree with svdb, this could use some dev attention. It is still not fixed in Gutsy, which makes me wonder what method is everybody else using for this shared drives? The "Connect to server" method, which creates smb mappings is the most obvious and is handled correctly on shutdown, but is not suitable for applications that don't support the smb: protocol.
This problem is still occuring in Gutsy.
Reported as bug:
https://bugs.launchpad.net/ubuntu/+bug/153444
I'm using the umountcifs script and I'm still seeing the messages; however now after it drops to the terminal it goes back to the progress bar and then shuts down...is it actually working I wonder?
Well, the biggest annoyance that the script fixes isn't the the messages but the time it waits for a timeout. Does it shut down fast in you case? Or does it wait?
If the script doesn't work, then the most likely thing that goes wrong is that it's run too late. If you linked it as e.g. K19umountcifs in your rc.X directory, try lowering the number to e.g. K10umountcifs or even K05umountcifs. If you don't run any programs on the cifs and don't have any important directories mounted from cifs (e.g. /home) then you can probably even run it as K01umountcifs.
Experiment a bit. You'll want the script to run as late as possible without failing to work.
Thanks for this script, it's worked perfectly for me!
Bookmarks