Ubuntu – Shutdown Hangs for 5 Minutes on Kubuntu 14.04

14.04kubuntumodem-managernetwork-managershutdown

I've had persistent problems with a 5 minute hang at shutdown for the last three versions of Kubuntu (13.04, 13.10, and now 14.04). I suspect this is not a KDE-specific problem. Recently, I performed a fresh installation of Kubuntu 14.04 from a live-USB, and shutdown worked normally for about a week. The hang-up is now happening again, and I can't figure out why.

A brief description of the problem:

The hang-up occurs with all methods of initiating a normal shutdown:

Clicking the shutdown or restart button in KDE,

sudo shutdown -h now,

sudo reboot

The shutdown splash screen appears. Using the down-arrow to access verbose messages, I see "Asking all remaining processes to terminate." This message remains for 5 minutes with no disk activity. Finally, a rapid series of messages flurries to the screen:

 * All processes ended within 300 seconds...                    [ OK ]
nm-dispatcher.action: Caught signal 15, shutting down...
ModemManager[852]: <warn> Could not acquire the 'org.freedesktop.ModemManager1' service name

ModemManager[852]: <info>  ModemManager is shut down

 * Deactivating swap...                                         [ OK ]
 * Unmounting local filesystems...                              [ OK ]
 * Will now restart`

Possible Sources of the Problem:
[Update]
It's been over a year since I originally posted this question, and I still can't find the source of this problem. I have a better sense of what isn't causing the problem, though, after trying all of the following steps individually without success:

  1. Uninstalled ModemManager. (I still received the same 5 minute delay with different error messages regarding NetworkManager.)
  2. Killed NetworkManager before shutdown.
  3. Added lines to the scripts in /etc/init.d to halt NetworkManager at runlevel[0]
  4. Updated Kernel and other packages
  5. Changed the order of shutdown scripts in /etc/rc0.d/ and reboot scripts in /etc/rc6.d/.
  6. added acpi=off to /etc/default/grub (this was a long shot, but suggested on some forums for a similar problem)

I think it's safe to say that ModemManager is not the culprit, and NetworkManager probably isn't either (killing it before shutdown doesn't help). Perhaps another program is trying to access the internet and keeps NetworkManager running.

I believe the problem may lie somewhere in a fluid dynamics simulation package I have installed called the Weather Research and Forecasting Environmental Modelling System (WRF-EMS). Here are the instructions I followed to get it running on Kubuntu.

I did a nearly identical install of Kubuntu 14.04 LTS on a different machine without the WRF-EMS package, and that machine shuts down in a few seconds with no delay. Furthermore, if I run the WRF-EMS before shutting down, sometimes I have no delay, but if I don't run it, I always experience the 5 minute delay.

Removing the WRF-EMS does not solve the problem, though, so perhaps the shutdown hang is only affected by the WRF-EMS, not directly caused by it.

Best Answer

It's impossible to be sure without actually experimenting on the given machine, but it's most likely a service and quite possibly modem-manager.

Modem-manager is a package related to mobile broadband modems, so if you aren't using any of those, you could just remove it entirely.

If that isn't possible (because you do use it) or fails to stop the issue, then try shutting down some services manually before a reboot, and see if one of these results in a dependably faster (and error-free) shut-down.

That service is therefore the (or a) culprit. If you know you don't need it, you can remove it. Otherwise you can try setting kill timeout 1 to the shut-down parts of its script, though that takes a bit of reading up on the config files for the service in question.

Related Question