Saturday, October 27, 2012

A Trick to Speed Up Ubuntu’s Shutdown Process



When compared with the excellent and robust Ubuntu 12.04 LTS release (at least in my experience), though the current 12.10 version brought few new features, it does not seem robust at all, as I’m having some serious issues with Compiz (which has never been the case for me as my Intel HD 3000 GPU worked really well with it).

Anyway, that is a hardware related issue, and perhaps the next one too might be as such. That is, despite Ubuntu 12.10 booting as fast as the 12.04 did, and I don’t know how it is in your computer, but I do notice a slight slowdown (2-3 seconds) when it is shutting down.
By default, there is very little that one can do to track down shutting down related issues as Ubuntu displays an image (logo), rather than showing-up the ‘old-school’ text output (which includes: listing programs that are shutting down, errors etc).
Nevertheless, you can alway bypass it (while booting and shutting down) by simply pressing the ‘ESC’ key. So I did that, and saw that a program called ‘modem-manager’ is taking few seconds to terminate. Now ‘modem-manager’, 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.
I do not have a mobile broadband modem, plus, even if I had one, the default network manager should be able to handle it, so I just went ahead and removed it (yikes! :D ). Then I rebooted, hoping that it would fix the issue, sadly though, it did not work.
Next time, after a wild guess, just before shutting down, while I was still logged on to the desktop, I manually terminated the network-manager service. Then I hit the shutdown button, and this time, Ubuntu 12.10 shutdown like a champ ;-) .
I was able to reduce 2-3 seconds, which it might not sound like much, but when considering the fact that usually Ubuntu shutdown within like 2-3 seconds (12.04 for example) in my notebook, ‘thanks’ to this network-manager issue in 12.10, now it was taking like 5-6 seconds, so after the ‘manual fix’, I was able to achieve the same awesome shutdown speed the notebook had before.
But, terminating the network-manager manually was a temporary fix (of course). So I looked for a permanent solution.
Ubuntu uses a core software utility called ‘upstart‘, for executing and terminating certain OS services, including the ‘network-manager’. And ‘upstart’ mainly stores the configuration files of those system services it manages, in ‘/etc/init’. So I opened that folder, and had a look at the ‘network-manager.conf’ file.
Now, by default, ‘upstart’ waits for about ’5′ seconds, till a process terminates, before taking any ‘manual action’. So all I did was nothing but add simple command (built-in one of ‘upstart), and reduced that ‘waiting seconds’ to ’1′ for ‘network-manager’. And it did the trick.
I do not know, if this will help you, if you are too experiencing a slowed down shutting down times in Ubuntu 12.10. But, if it is because of the ‘network-manager’, then this should help.
For fixing that (hopefully), please follow the below steps.
Step 1:
Open your Terminal window and enter the below command.
gksudo gedit /etc/init/network-manager.conf
Once the configuration file is opened, copy and paste the below code, below the existing ‘stop on stopping dbus’, as shown in the below screenshot.
kill timeout 1
Then, save your changes, and close the configuration file.
Step 2:
I do not think the below step is necessary, but you can do the same to the ‘modem-manager’, just in case. For that, enter the below command.
gksudo gedit /etc/init/modemmanager.conf
Then look for the existing ‘stop on stopped network-manage’ text line, and simply paste the below code just below it.
kill timeout 1
Now, save your changes and close the configuration file. That’s it!.
Now try shutting down the computer, and if it was any of those services that were causing the slowdown, then hopefully, it will be fixed. Good luck.

1 comment:

  1. I think works. Thanks for the tip. I added it to my desktop.

    ReplyDelete