- 282,727 hits
Anything about Ubuntu, Centos, openSuSe and Fedora
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.
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
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:
#!/bin/sh 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.