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,
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: <warn> Could not acquire the 'org.freedesktop.ModemManager1' service name ModemManager: <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:
- Uninstalled ModemManager. (I still received the same 5 minute delay with different error messages regarding NetworkManager.)
- Killed NetworkManager before shutdown.
- Added lines to the scripts in /etc/init.d to halt NetworkManager at runlevel
- Updated Kernel and other packages
- Changed the order of shutdown scripts in /etc/rc0.d/ and reboot scripts in /etc/rc6.d/.
- 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.