Thursday, April 6, 2017

Boot Ubuntu Fast

Recently I noticed that my Ubuntu installation has become slow to boot. It has seen couple of dist upgrades and a lot of application install/remove's.
So I decided to dig in and see if there's anything I can do about it. First thing is how to measure current boot time. After a quick google search I ended up with following commands.
systemd-analyze blame
systemd-analyze critical-path
systemd-analyze plot > plot.svg

systemd-analyze prints something like:
Startup finished in 9.002s (kernel) + 22.322s (userspace) = 31.325s
Which means system is taking 31.325 Secs to boot, out of which kernel part is 9Sec and remaining is user part.

systemd-analyze blame prints list of applications/ services according to time taken to load.
critical-path option shows a critical path graph and highlights applications/services which are taking more than average time.
plot option plots a nice graph of the booting process.

There are other ways too. E.g. if you want to see more in what kernel is doing for 9 secs, you can look at output of dmesg command.
For more details on userspace operations there's journalctl.

Anyway to start with I noticed my machine taking almost a minute to boot. After going through above data I noticed following:
Networkmanager wait online service taking long - not needed - masked it.
modem-manager service not needed - mask it.
VirtualBoxDriver taking more time in dmesg logs - don't need VirtualBox anymore - purge it.
Some more minute tuneups - and now my system boots in 30-40 secs, which is huge improvement from a full minute.

No comments:

Post a Comment