Tutorial: troubleshoot and improve Boot Time in Ubuntu Linux with Bootchart

When you install a fresh copy of any operating system, the boot phase is generally good, mostly because there is any software installed a part from the ones provided with the OS installation itself. But when you start using you computer you will install other software, start playing and tweaking the OS and you will see longer boot times.

How do you know if there is anything wrong with your boot time?

First thing to understand is that if you’ve installed any program that does something at startup time, you will have to accept longer boots time, no matter what, but sometimes it’s just a badly written software or after an update that you may notice that something is wrong.

In order to understand if your system has an issue or not, you will probably need help. And Ubuntu can help you out very well by installing the application Bootchart.

Open the Ubuntu Software Center or the Synaptic Package Manager and search for “bootchart” (or just type sudo apt-get install bootchart in the terminal window); you will be able to install this very useful piece of software. Obviously you will have to reboot you machine, so the logs will be captured.

Bootchart is a utility that compiles all the relevant logs when the machine is booting and renders them in a Gantt chart. It has been developed in Java and is basically a script that reads all the info gathered by the bootchartd (boot logger) daemon (it’s launched by the kernel).

The result is an image showing the boot time on the horizontal axis and all the various processes started during boot on the vertical axis. Please note that you will be able to see dependencies (if a process has launched another one) and different colors to indicate CPU/Disk usage.

Here you have an example boot chart image:

Test Bootchart Image
Test Bootchart Image

The logs captured and the images generated are saved by default under /var/log/bootchart/

A good thing to do is to take a snapshot of your system right after has been installed, and then taking snapshots on a regular basis in order to see if there has been an increment in boot time and which processes have caused this. Another good reason to check your boot time is before adding a new hardware or making an important change to your system. By having a snapshot before and after the change you will be easily able to identify any problem and its root cause.

On the Ubuntu’s Wiki site you can see other users Boot Charts that can be interesting for you to compare with and you can even upload your own.

It’s important to remember that once you’ve done your tests, it’s recommendable to remove Bootchart from your system, otherwise:

1. Your /var/log/bootchart/ folder will be filled with Boot charts at every boot.
2. Your boot will be slightly slower as it has to collect the logs and compile the graph.

You can obviously remove it from the Software Center or Synaptic or by running sudo apt-get remove bootchart from a terminal console. Please remember to save all the logs you may need and leave the folder /var/log/bootchart clean and tidy!