Shutdown Hangs for 5 Minutes on Kubuntu 14.04

5,392

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.

Share:
5,392

Related videos on Youtube

Augustinus
Author by

Augustinus

Updated on September 18, 2022

Comments

  • Augustinus
    Augustinus over 1 year

    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.

    • bain
      bain about 10 years
    • Augustinus
      Augustinus about 10 years
      I will try using the debug logging feature mentioned in the discussion for this bug. I'll let you know how it goes. In the meantime, though, I'm wondering if this is really the same problem. I had no issues with the shutdown process with a fresh installation of Kubuntu 14.04. This problem appeared after 1-1.5 weeks. Thus, I'm reluctant to call it a bug in modem-manager. My suspicion is that perhaps there's another process spawning modem-manager and preventing it from stopping normally at shutdown.
    • bain
      bain about 10 years
      It looks like nm-dispatcher.action may still be running at shutdown, which would indicate that network manager may have somehow launched modem manager. Could not acquire the 'org.freedesktop.ModemManager1' service name - is this warning usual for your setup? If not, it could indicate that modem manager is being launched, but there is already a running process that has claimed the name. There would now be two modem-manager processes, which could explain the hang.
    • Augustinus
      Augustinus almost 10 years
      That warning happens on almost every shutdown attempt, so in that sense, it is common. As I mentioned in another comment below, however, removing the modem-manager warnings disappeared after I removed modem-manager, but the nm-dispatcher.action message still occurs. I recently configured a brand-new kubuntu installation using the latest iso image, and there was no delay at shutdown. After installing software, though, the delay began with the exact same error messages listed above.
  • Augustinus
    Augustinus about 10 years
    Thank you for the background information about modem-manager. By mobile broadband modems, are you referring to things like 4G LTE USB keys? Or would a cable modem connected via ethernet also be managed by modem-manager? I could try including a kill timeout or removing modem-manager completely, but is there something else I could try first? I'm mystified that this problem appeared when it was previously working fine. Ideally, I'd like to figure out what caused it and fix the root problem.
  • bain
    bain about 10 years
    Yes, things like 4G modems, or a cable modem directly connected. An ethernet connected device would not require modem-manager. See freedesktop.org/wiki/Software/ModemManager
  • Augustinus
    Augustinus almost 10 years
    Thanks for the clarification, @bain. I've been putting up with this problem for the last few months, but I've recently been trying to solve it again. I removed modem-manager using sudo apt-get autoremove modem-manager. Now, the messages relating to modem-manager no longer appear at shutdown, but all the other messages I listed in my original question still occur, most notably the one saying: nm-dispatcher.action: Caught signal 15, shutting down. I've also tried adding kill timeout 1 and stop on runlevel [06] to the network-manager.conf file. Neither of those made any difference.
  • Just a guy
    Just a guy almost 9 years
    I'm hoping a solution is found eventually. I've been living with this on a laptop for about 2 years now.