Difference between revisions of "Bootchart"

From ArchWiki
Jump to: navigation, search
(Bootchart2 info is added. Remove out of date flag.)
(Installing Bootchart: install style)
 
(18 intermediate revisions by 10 users not shown)
Line 1: Line 1:
 
[[Category:Boot process]]
 
[[Category:Boot process]]
 +
[[de:Bootchart]]
 
[[fr:Bootchart]]
 
[[fr:Bootchart]]
 
[[it:Bootchart]]
 
[[it:Bootchart]]
[[zh-CN:Bootchart]]
+
[[ja:Bootchart]]
 +
[[ru:Bootchart]]
 +
[[zh-cn:Bootchart]]
 
[https://meego.gitorious.org/meego-developer-tools/bootchart Bootchart] is a handy tool used for profiling the Linux boot sequence, generally used for making your computer boot faster. It consists of the bootchartd daemon, which records and renders a chart of profiling data.
 
[https://meego.gitorious.org/meego-developer-tools/bootchart Bootchart] is a handy tool used for profiling the Linux boot sequence, generally used for making your computer boot faster. It consists of the bootchartd daemon, which records and renders a chart of profiling data.
 +
 +
{{Note|Bootchart is now a part of systemd, see [[Improve boot performance#Analyzing the boot process]] for details. This page covers the original bootchart and bootchart2 (init daemon) before it was merged.}}
  
 
== Installing Bootchart ==
 
== Installing Bootchart ==
Bootchart is currently unsupported, but available in the [[AUR]] with the most popular entry being [https://aur.archlinux.org/packages.php?ID=43477 this one].
+
Install the {{Pkg|bootchart}} package.
 
+
{{Note|An alternative to Bootchart is [https://github.com/mmeeks/bootchart bootchart2], which at least has more recent activity than 2005. It can be found on the [[AUR]] as {{AUR|bootchart2-git}}. It uses python for generating the final chart instead of a JVM, and only requires: pygtk, git and busibox. See GRUB and GRUB2 configuration bellow}}
+
 
+
== Running Bootchart2 ==
+
 
+
=== Boot loader setup ===
+
This generally involves making a copy of the boot option you want to profile and adding {{Ic|<nowiki>initcall_debug printk.time=y init=/sbin/bootchartd</nowiki>}} to it. When started from the boot loader, bootchart2 will stop after either a default 120 seconds, or when you get to the login prompt (as opposite.
+
 
+
==== Grub ====
+
Open up {{ic|/boot/grub/menu.lst}}, and copy/paste the entry you want to log. Append {{Ic|<nowiki>initcall_debug printk.time=y quiet init=/sbin/bootchartd</nowiki>}} to the kernel line.
+
 
+
==== Lilo ====
+
TODO
+
 
+
==== Grub 2 ====
+
Edit one of grub-mkconfig's custom files such as {{ic|/etc/grub.d/40_custom}} (the parameters can also be added to the variable {{Ic|<nowiki>GRUB_CMDLINE_LINUX_DEFAULT</nowiki>}} in {{ic|/etc/defaults/grub}}), or create a new file, copy the boot option you want to profile from {{ic|/boot/grub/grub.cfg}}, and add bootchartd as follows:
+
 
+
menuentry "Arch Linux with Bootchart2" {
+
set root=(hd0,1)
+
linux /boot/vmlinuz-linux root=/dev/sda1 ro '''initcall_debug printk.time=y''' quiet '''init=/sbin/bootchartd'''
+
initrd /boot/initramfs-linux.img
+
}
+
 
+
Once this is done, generate a new {{ic|grub.cfg}}:
+
# grub-mkconfig -o /boot/grub/grub.cfg
+
 
+
Now you can reboot and choose the new bootcharting option.
+
 
+
=== Configure Bootchart2 ===
+
==== Stop Bootchartd2 after login ====
+
Bootchart2 '''/etc/bootchartd.conf'''
+
 
+
EXIT_PROC="kdm_greet xterm konsole gnome-terminal metacity mutter compiz ldm icewm-session enlightenment"
+
 
+
can be adjusted, or left empty for logging to be stopped manually rather than at a predetermined programme start.
+
 
+
== Generating a chart ==
+
Is as straightforward with Bootchart2 as it is with Bootchart Legacy: After bootup, run
+
$ pybootchartgui -i
+
to get an interactive chart rendering tool. You can get more details on the [http://wiki.gentoo.org/wiki/Bootchart2 Gentoo Wiki] until someone further edit this page.
+
 
+
Note that Bootchart2 can be used along with [[E4rat]].
+
  
 
== Running Bootchart ==
 
== Running Bootchart ==
Line 54: Line 17:
  
 
=== Boot loader setup ===
 
=== Boot loader setup ===
This generally involves making a copy of the boot option you want to profile and adding {{Ic|<nowiki>init=/usr/bin/bootchartd</nowiki>}} to it. When started from the boot loader, bootchart will stop when you get to the login prompt.
+
This generally involves making a copy of the boot option you want to profile and adding {{Ic|<nowiki>init=/usr/bin/bootchartd</nowiki>}} to it. See [[kernel parameters]] for instructions. When started from the boot loader, bootchart will stop when you get to the login prompt.
 
+
==== Grub ====
+
Open up {{ic|/boot/grub/menu.lst}}, and copy/paste the entry you want to log.  Append {{Ic|<nowiki>init=/usr/bin/bootchartd</nowiki>}} to the kernel line. Example:
+
 
+
# (1) Arch Linux Bootchart
+
title  Arch Linux
+
root  (hd0,0)
+
kernel /vmlinuz-linux root=/dev/disk/by-uuid/d531ff5b-de65-499a-9942-d18682375163 ro quiet '''init=/usr/bin/bootchartd'''
+
initrd /initramfs-linux.img
+
 
+
==== Lilo ====
+
TODO
+
==== Grub 2 ====
+
Edit one of grub-mkconfig's custom files such as {{ic|/etc/grub.d/40_custom}} or create a new file, copy the boot option you want to profile from {{ic|/boot/grub/grub.cfg}}, and add bootchartd as follows:
+
 
+
menuentry "Arch Linux with Bootchart" {
+
set root=(hd0,1)
+
linux /boot/vmlinuz-linux root=/dev/sda1 ro quiet '''init=/usr/bin/bootchartd'''
+
initrd /boot/initramfs-linux.img
+
}
+
 
+
Once this is done, generate a new {{ic|grub.cfg}}:
+
# grub-mkconfig -o /boot/grub/grub.cfg
+
 
+
Now you can reboot and choose the new bootcharting option.
+
 
+
=== rc.sysinit setup ===
+
This one is dangerous (you can make your Arch Linux unbootable) - use it only when the first approach fails. When run in this way, not only you'll have to stop bootchartd manually after you boot up (or it will completely fill your harddrive) but it will start with every boot too. Also, any changes to {{ic|/etc/rc.sysinit}} will be reverted next time you update the initscripts package.
+
On the positive side, you'll end up with a bootchart that shows what happens after you log in.
+
 
+
==== Edit /etc/rc.sysinit ====
+
Now, we're going to add this line:
+
/usr/bin/bootchartd start
+
to {{ic|/etc/rc.sysinit}}
+
 
+
It cannot be too high up, because that would render the system unbootable, but placing it too far into the script will hide anything that happened before from the bootchart.
+
It should be safe to put this right before the section that brings up the system clock.
+
Look for this line:
+
stat_busy "Configuring System Clock"
+
Put this:
+
/usr/bin/bootchartd start
+
before it.
+
 
+
==== Stop bootchartd after login ====
+
As stated previously, you have to stop bootchartd manually.
+
Either run this as root:
+
/usr/bin/bootchartd stop
+
Or with sudo if you have that set up:
+
sudo /usr/bin/bootchartd stop
+
  
 
== Generating a chart ==
 
== Generating a chart ==
Line 114: Line 28:
 
Bootchart-render cannot generate a 'bootchart.png' image and shows the error message:
 
Bootchart-render cannot generate a 'bootchart.png' image and shows the error message:
 
  /var/log/bootchart.tgz not found
 
  /var/log/bootchart.tgz not found
It mostly means that bootchartd was unable to detect when the booting process was finished. This can happen when you are using different login manager than [[KDM]] or GDM such as [[SLIM]] or entrance. You have to open {{ic|/usr/bin/bootchartd}} script and append those applications to {{Ic|exit_proc}} variable, for example:
+
It mostly means that bootchartd was unable to detect when the booting process was finished. This can happen when you are using different login manager than [[KDM]] or GDM such as [[SLiM]] or entrance. You have to open {{ic|/usr/bin/bootchartd}} script and append those applications to {{Ic|exit_proc}} variable, for example:
 
  # The processes we have to wait for
 
  # The processes we have to wait for
 
  local exit_proc="gdmgreeter gdm-binary kdm_greet kdm slim"
 
  local exit_proc="gdmgreeter gdm-binary kdm_greet kdm slim"
Line 127: Line 41:
  
 
This article is really awesome and along with a bunch of bootcharts provides some tips on how to boot faster. Some of those improvements are beyond reach of the ordinary user though (patching X.org, kernel, etc.).
 
This article is really awesome and along with a bunch of bootcharts provides some tips on how to boot faster. Some of those improvements are beyond reach of the ordinary user though (patching X.org, kernel, etc.).
 +
 +
== Bootchart2 ==
 +
 +
{{Note|An alternative to Bootchart is [https://github.com/mmeeks/bootchart bootchart2]. It uses python for generating the final chart instead of a JVM, and only requires: pygtk, git and busybox. See GRUB and GRUB2 configuration bellow}}
 +
 +
=== Running Bootchart2 ===
 +
 +
==== Boot loader setup ====
 +
This generally involves making a copy of the boot option you want to profile and adding {{Ic|<nowiki>initcall_debug printk.time=y init=/usr/bin/bootchartd2</nowiki>}} to it. See [[kernel parameters]] for instructions. When started from the boot loader, bootchart2 will stop after either a default 120 seconds, or when you get to the login prompt (as opposite). Note that Bootchart2-git can also be run as a '''systemd''' service, as described in [[Improve boot performance#Using bootchart2]]
 +
 +
==== Configure Bootchart2 ====
 +
===== Stop Bootchartd2 after login =====
 +
Bootchart2 '''/etc/bootchartd2.conf'''
 +
 +
EXIT_PROC="kdm_greet xterm konsole gnome-terminal metacity mutter compiz ldm icewm-session enlightenment"
 +
 +
can be adjusted, or left empty for logging to be stopped manually rather than at a predetermined programme start.
 +
 +
=== Generating a chart ===
 +
Is as straightforward with Bootchart2 as it is with Bootchart Legacy: After bootup, run
 +
$ pybootchartgui -i
 +
to get an interactive chart rendering tool. You can get more details on the [http://wiki.gentoo.org/wiki/Bootchart2 Gentoo Wiki] until someone further edit this page.
 +
 +
Note that Bootchart2 can be used along with [[E4rat]].
  
 
== Useful links ==
 
== Useful links ==
 
* [http://www.bootchart.org/ Bootchart home page]
 
* [http://www.bootchart.org/ Bootchart home page]

Latest revision as of 20:41, 2 April 2016

Bootchart is a handy tool used for profiling the Linux boot sequence, generally used for making your computer boot faster. It consists of the bootchartd daemon, which records and renders a chart of profiling data.

Note: Bootchart is now a part of systemd, see Improve boot performance#Analyzing the boot process for details. This page covers the original bootchart and bootchart2 (init daemon) before it was merged.

Installing Bootchart

Install the bootchart package.

Running Bootchart

To make use of bootchart, you have to either set it as the init process in your boot loader or starting it manually from one of the init scripts (rc.sysinit preferably). Note that if you start bootchartd manually, you have to stop it manually too. In general, be extra careful with this step.

Boot loader setup

This generally involves making a copy of the boot option you want to profile and adding init=/usr/bin/bootchartd to it. See kernel parameters for instructions. When started from the boot loader, bootchart will stop when you get to the login prompt.

Generating a chart

Generating a bootchart involves running:

bootchart-render

in a folder to which you have write access. This will generate a bootchart.png image with your chart. You'll have to have a Java runtime installed and properly set up before you can do this.

Troubleshooting

Bootchart-render cannot generate a 'bootchart.png' image and shows the error message:

/var/log/bootchart.tgz not found

It mostly means that bootchartd was unable to detect when the booting process was finished. This can happen when you are using different login manager than KDM or GDM such as SLiM or entrance. You have to open /usr/bin/bootchartd script and append those applications to exit_proc variable, for example:

# The processes we have to wait for
local exit_proc="gdmgreeter gdm-binary kdm_greet kdm slim"

If you are using no login manager, edit the exit_proc variable in this way:

# The processes we have to wait for
local exit_proc="login"

Example bootcharts

Boot in 5 seconds

LWN Article on fast booting netbooks

This article is really awesome and along with a bunch of bootcharts provides some tips on how to boot faster. Some of those improvements are beyond reach of the ordinary user though (patching X.org, kernel, etc.).

Bootchart2

Note: An alternative to Bootchart is bootchart2. It uses python for generating the final chart instead of a JVM, and only requires: pygtk, git and busybox. See GRUB and GRUB2 configuration bellow

Running Bootchart2

Boot loader setup

This generally involves making a copy of the boot option you want to profile and adding initcall_debug printk.time=y init=/usr/bin/bootchartd2 to it. See kernel parameters for instructions. When started from the boot loader, bootchart2 will stop after either a default 120 seconds, or when you get to the login prompt (as opposite). Note that Bootchart2-git can also be run as a systemd service, as described in Improve boot performance#Using bootchart2

Configure Bootchart2

Stop Bootchartd2 after login

Bootchart2 /etc/bootchartd2.conf

EXIT_PROC="kdm_greet xterm konsole gnome-terminal metacity mutter compiz ldm icewm-session enlightenment"

can be adjusted, or left empty for logging to be stopped manually rather than at a predetermined programme start.

Generating a chart

Is as straightforward with Bootchart2 as it is with Bootchart Legacy: After bootup, run

$ pybootchartgui -i 

to get an interactive chart rendering tool. You can get more details on the Gentoo Wiki until someone further edit this page.

Note that Bootchart2 can be used along with E4rat.

Useful links