Ubuntu – Ubuntu hanging on shutdown/reboot


My situation is very similar to Shutdown Hangs for 5 Minutes on Kubuntu 14.04 but I am using 14.10 with a gnome environment instead of KDE (Ubuntu with gnome package added not the native version). That alone shouldn't be causing it as I have coworkers with same hardware and setup with no issues.

The verbose shutdown screen prints the same line

* Asking all remaining processes to terminate...

* All Processes ended within 300 seconds...
nm-dispatcher.action: Caught signal 15, shutting down...
* Deactivating swap...
mount: / is busy
* Will now halt
[ 486.185416] reboot: Power down

Unlike the original poster I don't have modem manager installed and there isn't anything outputted between nm-dispatcher and deactivating the swap for me to use as a guideline :/

If anyone knows some things to check for or a way to force a shutdown after 60 seconds of hanging vs 300 it would be much appreciated.

Best Answer

I finally found a heavy-handed way to force a shutdown sooner than 300 seconds. The 300 second waiting period is specified in /etc/init.d/sendsigs, which is a shutdown script that attempts to kill remaining processes that have not successfully ended in previous parts of the shutdown sequence. Find the following code in the script:

if [ $seq -ge 300 ] ; then

This is where the 300 second maximum wait time is specified. Change 300 to a desired number of seconds greater than 10 (other parts of the script already specify a wait time of 10 seconds). You will need to use sudo to change this file, since it does not have write permissions for an ordinary user.

This is a very heavy-handed tactic, and it's not a good long-term solution. If you have network file storage which might be hanging at shutdown, or if any other process (ie. mySQL) might be legitimately waiting at shutdown, do not follow this method. But for a laptop or general purpose computer with a standard software configuration, it will at least allow you to shutdown and restart without waiting 5 minutes every time.