Using Bootchart to profile the booting of Edubuntu Feisty Thin Clients

Comments/corrections to gmccullagh [AT] gmail [dot] com

Detailed instructions for getting bootchart to profile the boot of your thin clients.

  1. Create a new, separate LTSP chroot for profiling thin clients
    sudo ltsp-build-client --base /opt/ltsp-profiling
  2. Go into that chroot and install bootchart
    sudo chroot /opt/ltsp-profiling/i386 apt-get install bootchart
    a bunch of packages will be installed, including Cups and Java(!). Not to worry, you created a new ltsp chroot environment for a reason.
  3. Using your favourite editor, open the file /opt/ltsp-profiling/i386/etc/usr/share/initramfs-tools/scripts/nfs, go to line 93 and add in a single line, init=/sbin/init so it looks like:
            # loop until nfsmount succeds
            init=/sbin/init
            while [ ${retry_nr} -lt ${delay} ] && [ ! -e ${rootmnt}${init} ]; do
    
    If you're interested, this little hack avoids a problem booting where /sbin/bootchartd is only available on the initramfs.
  4. Update your initrd image and sync to the tftp server so the thin client gets the updated initrd.
    sudo chroot /opt/ltsp-profiling/i386 update-initramfs -u -k all
    sudo ltsp-update-kernels
  5. Add an extra line to /etc/exports on the server to allow your new nfs root to be mounted by thin clients
    /opt/ltsp-profiling       *(ro,no_root_squash,async)
    and then run this command to restart the nfs server
    sudo /etc/init.d/nfs-kernel-server restart
  6. Set the root password on your thin client chroot with the command.
    sudo chroot /opt/ltsp-profiling/i386 passwd
  7. Pick a thin client to profile and determine it's MAC address. Setup an entry in /etc/ltsp/dhcpd.conf to point that client to your new chroot, eg.
    host tilly { 
    	hardware ethernet 00:B0:D0:05:FA:20;
    	fixed-address tilly.homenet;
    	option root-path "/opt/ltsp-profiling/i386";
    }
    
    remember to restart the DHCP server so this takes effect.
    sudo /etc/init.d/dhcp3-server restart
  8. Create a custom pxelinux.cfg file to modify the booting details for this mac address. Do this by copying the default, as follows:
    cd /var/lib/tftpboot/ltsp/i386/pxelinux.cfg/
    cp default 01-00-b0-d0-05-fa-20
    where 00:B0:D0:05:FA:20 is the mac address of the computer to use it (NB the 01- at the start and the lower case letters throughout).
  9. Edit the pxelinux config you just created and change the DEFAULT line to remove the silent and splash and add an init, as follows:
    	DEFAULT vmlinuz ro initrd=initrd.img init=/sbin/bootchartd
  10. Boot your thin client. When you get to the ldm screen, press <CTRL><ALT><F1> to get to a text screen and login with username root and the password you set a moment ago.
  11. If you look in /var/log/bootchart/ you should see either a file called bootchart.tgz (the temporary data file), or a png image. If the png image is there, bootchart is finished. If you see the data file, the bootchart image creator may still be running (try 'top' to see it) or may have died (some lesser thin clients probably can't do the image creation). Use scp to transfer the files back to the server.
    	scp -r /var/log/bootchart/ <username>@192.168.1.2:/tmp
  12. If you only have the data file at this point, you can install bootchart on the server (or use the one in the chroot) to convert it by hand. You can get instructions for the conversion by looking in /etc/init.d/stop-bootchart
  13. To revert the thin client back to normal, just remove the DHCP entry and the pxelinux.cfg file. To profile another client you need only repeat steps 7 onwards. This should not affect any of your other working thin clients.

The final output should be a PNG image like the one below, generated from my Dell Latitude L400 laptop.

Results

Dell Latitude L400 laptop.

700MHz P3 CPU, 256MB RAM.

References

DebianEdu/HowTo/LtspBootChart
BootChart Docs
Comments/corrections to gmccullagh [AT] gmail [dot] com