• Tutorial: boot Parallella from USB external hard drive (using standard SD image)

    I’ve been using my Parallella for a few months now and I’ve already burnt a couple of SD Cards…

    Therefore I thought that it would be better to load the OS from an USB attached Hard Disk, using the SD Card for the boot process only.

    Parallella Board

    In general Linux allows to easily change the root partition by passing the appropriate parameters to the Kernel (or through a bootloader). However in the standard image used by Parallella, a Device Tree is used. This means that you cannot pass directly the desired parameters to the Kernel, but you need modify the standard Device Tree. This is located in the Kernel package available at: http://www.parallella.org/create-sdcard/. See the point #2 (Parallella Linux Kernel – with ot without HDMI support, as you prefer) to download it.

    Once you have decompressed the content (as explained in the instructions), you will see that one of the files is called “devicetree.dtb”. The file is compiled so we’ll need to decompile it. On the Parallella, make a copy of the file in another folder and launch the command:

    dtc -I dtb -o dev.dts -O dts devicetree.dtb

    if the command cannot be found, just install it using:

    sudo apt-get install device-tree-compiler

     

    Now the file dev.dts is in text again and can be customized.

    Open the file with your favourite text editor and look for the line that begins with “bootargs”. In there you can specify any kernel boot options as described here.

    In our case, we want to boot from a USB attached drive. In order to do so, we need to use the instructions we saw before at Parallella site to copy the official image to an Hard Disk (CAUTION, YOU WILL DELETE YOUR HARD DISK CONTENT – YOU’VE BEEN WARNED!!!). It’s quite simple as you just need to adapt the command to create the partitions by using the appropriate /dev/sdxx device that is related to your external hard disk.

     

    Therefore the bootargs line will have to look like:

    bootargs = "rootwait root=/dev/sda2 rw rootfstype=ext4";

     

    Finally, re-compile the new Device Tree:

    dtc -I dts -O dtb -o devicetree.dtb dev.dts

    And now overwrite the old Device Tree with the new one. Happy OS loading from USB!

  • 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!