Today I'm so fucked up facing Ubuntu having problem while restarting and shutting down. There were times that Ubuntu took more than a minute to halt even in a fast drive like SSD.

However, i finally managed to find a solution that solved this f****** problem and the fixes also improve the shutdown time and boot time.

The steps are as follows:

1. Open network-manager.conf (located in /etc/init/) and add this line ("kill timeout 1") after "stop on stopping dbus" line. See diagram for reference. Note that you'll need the root privilege to edit the file so simply type this command in the terminal:

gksudo gedit /etc/init/network-manager.conf



Then, save all changes made to the file.

2. Open modemmanager.conf (located in /etc/init/) and add this line ("kill timeout 1") after "stop on stopped network-manager" line. See diagram for reference. Note that you'll need the root privilege to edit the file so simply type this command in the terminal:

gksudo gedit /etc/init/modemmanager.conf



Then, save all changes made to the file. Reboot/shutdown/power on your computer too see the result.

There's some case where this don't usually work and you'll have to do more than just editing the configuration file. To solve this, you have remove modem manager package from Ubuntu and delete the modemmanager.conf file manually (if somehow it's not deleted after removing the package).

To get this done, open a terminal session and run these commands:

sudo apt-get autoremove modemmanager

sudo rm /etc/init/modemmanager.conf

The 2 commands above removed modemmanager package and deleted modemmanager.conf file respectively. If you run into problems with your mobile broadband after running those commands, feel free to install back modemmanager package by running this command:

sudo apt-get install modemmanager

Modemmanager is sort of an extension, that mainly brings few hardware related patches (only supports mobile broadband modems) to the existing Network (Gnome) manager in Ubuntu. Usually the default network manager should be able to handle the modem.

Source:
hecticgeek.com

Special thanks:
ActionPinarch from #ubuntu channel on freenode