Thursday, 6 March 2014

Comparing Boot Times between Kanux (Kano OS) and Raspbian

I've spent a couple of hours playing around with Kano OS this morning. I was interested to see the claim that it boots twice as fast as Raspbian (it doesn't according to my calculations below) and wondering what special sauce had been sprinkled.

Boot to desktop time using two reformatted Samsung Class 6 Micro SD Card (previously had NOOBS):

NetworkKanux boot time (s) Raspbian boot time (s)
Wifi card (not enabled)2839
Wifi enabled*39
* Couldn't connect to my Wifi using standard Edimax ew-7811un

They've removed a fair amount of stuff from Raspbian and replaced two packages.

If we look in the default runlevel for Kanux and Raspbian (2) and then diff the scripts found we see that Kanux replaces some standard Raspbian packages with alternatives (dropbear instead of OpenSSH and inetutils-syslogd instead of rsyslogd). They remove the swapfile process, NFS, NTP and rsync daemons.

tng@coalman:/tng_nfs/RASPBERRY_PI/Kanux_Raspbian_Comparison$ diff init.raspbian init.kanux 
< dphys-swapfile
> dropbear
> inetutils-syslogd
< motd
< nfs-common
< ntp
< rpcbind
< rsync
< rsyslog
< ssh
< triggerhappy
> update-motd

This is reflected in the running processes:

tng@coalman:/tng_nfs/RASPBERRY_PI/Kanux_Raspbian_Comparison$ diff proc.raspbian proc.kanux 
< [bcm2708_spi.0]
> -bash
> /bin/login
> /bin/login
> /bin/sh
< dhclient
< [ext4-dio-unwrit]
> [ext4-rsv-conver]
> idesk
> ifup
< [iscsi_eh]
> [kintegrityd]
> [ksmd]
< [kthrotld]
< [kworker/0:0]
< [nfsiod]
< pcmanfm
< [rpciod]
< /sbin/getty
< /sbin/getty
< /sbin/getty
< /sbin/getty
< /sbin/getty
< /sbin/getty
< /sbin/getty
< /sbin/wpa_cli
< /sbin/wpa_supplicant
< sshd:
< sshd:
> /sbin/udhcpc
< udisks-daemon:
< /usr/lib/arm-linux-gnueabihf/lxpolkit
< /usr/lib/gvfs/gvfs-afc-volume-monitor
< /usr/lib/gvfs/gvfsd
< /usr/lib/gvfs/gvfs-gdu-volume-monitor
< /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
< /usr/lib/udisks/udisks-daemon
> /usr/sbin/dropbear
< /usr/sbin/ntpd
< /usr/sbin/rsyslogd
< /usr/sbin/sshd
< /usr/sbin/thd
> [VCHIQka-0]
> [watchdog/0]
> wpa_supplicant

I'm not against trimming down the OS, but I wouldn't want to drop NFS from the Raspbian startup as it's so useful (LTSP). I certainly don't want NTP being dropped. Tonight I'm going to party like it's 1999:
From /etc/network/interfaces:

allow-hotplug eth0 
 iface eth0 inet manual 
 post-up /sbin/udhcpc -p /var/run/ -S -i eth0 && (/usr/local/bin/tzupdate && /usr/bin/rdate -ncv $(cat /etc/timeserver.conf)) | logger -t kanuxnet -i -t kanuxnet

  tng@kano /etc/network $ more /etc/timeserver.conf


I was poking about through their network scripts and discovered they have a mountnfs in /etc/network/if-up.d.Maybe I'm just being too critical. They have removed the nfs tools (and kernel modules in their rebuilt kernel). Interesting move.


tng@coalman:/tng_nfs/RASPBERRY_PI/Kanux_Raspbian_Comparison$ ssh tng@
tng@'s password: 
tng@kano ~ $ exit

tng@coalman:/tng_nfs/RASPBERRY_PI/Kanux_Raspbian_Comparison$ sftp tng@
tng@'s password: 
bash: /usr/lib/sftp-server: No such file or directory
Connection closed


I have used the wonderful bootchart2 command to determine the boot times of Raspbian versus Kano as per Alejandro Simon's comments. I entirely agree with his readings of boot times using this tool

I now need to find out why the timings in bootcommand2 do not correspond to those of my stopwatch. I'm starting my time at power on and stopping the stopwatch when I see the first icon appear on the desktop. Intriguing.


Reading more about bootchart2, I see the following:

To make bootchart2 work best, please ensure your kernel is
configured with CONFIG_PROC_EVENTS=y and CONFIG_TASKSTATS=y, without
these we are slower, less accurate, and produce an uglier task hierarchy.

CONFIG_PROC_EVENTS is enabled in Kano but not in Raspbian:

tng@coalman:/tng_nfs/RASPBERRY_PI/Kanux_Raspbian_Comparison$ grep CONFIG_PROC_EVENTS config.kano
tng@coalman:/tng_nfs/RASPBERRY_PI/Kanux_Raspbian_Comparison$ grep CONFIG_PROC_EVENTS config.raspbian 

Q: How are we supposed to accurately compare the startup times of the two O/S one of which is configured to produce faster, more accurate results with the measuring tool and one of which isn't?
A: Using a stopwatch. I stand by my timings.


Anonymous said...

Hi Tim,

Thanks for taking the time to look into Kanux in such detail -- it's really useful for us to get detailed feedback from the community.

The way we have measured the boot time is the following:
- Tool used: bootchart2
- OS: Kanux Beta v1.0 and (Raspbian both out of the box. Just minimal required changes performed.
- SD card used: Transcend SDHC Class 10 8GB (Please take into account that boot time and performance in general depends on the SD card, so you won't get the same results without using the same card...)
- You can check the detailed results here:
Bootchart-raspbian -
Bootchart-kanux -

To achieve those results, as you correctly noted, we have trimmed the OS down to the minimum and performed a bunch of other optimizations.*

We have removed NFS tools among other utilities that we thought a beginning user might not need. If you want to use sftp, why not use scp instead? It works perfectly fine ;-)



Tim Gibbon said...

Thanks for getting back to me Alejandro and providing such the detailed bootcharts you used. I now need to study them and understand them. I still stand by my figures. I've re-run the tests (with a stopwatch from plug in through to icons appearing on the desktop).

I'm fine with you removing NFS, but you should also clean up after yourselves, such as removing

Personally, I think that removing sftp-server means that you won't be able to use Filezilla. Some of your users may not be happy using the scp command but would be happy using a graphical tool(?).

If you really aren't using SFTP, then it might be a good idea to turn off the subsystem in sshd_config rather than getting an error.

I've looked through your kernel configuration and it would be good to have a detailed discussion about that either in the forums or elsewhere. Do you have any plans to publish your kernel config in github? That would be the easiest place to raise issues.

Tim Gibbon said...

Can you explain why you have different fbwidth and fbheight for the comparison tests between kanux and raspbian. I get the following for both raspbian and kanux.
bcm2708_fb.fbwidth=1600 bcm2708_fb.fbheight=1200

Are they run against the same screen?

Anonymous said...

Hi Tim,

The most efficient way to measure boot time is by using bootchart rather than stopwatch. It just requires couple of steps to setup:
1) Install it: sudo apt-get install bootchart2 pybootchartgui
2) Add the following line to /boot/cmdline.txt: init=/sbin/bootchartd
3) reboot and generate the graph: pybootchartgui

Thanks for the heads up about /etc/network/if-up.d/mountnfs , I will have a look.

You are right, you won't be able to use Filezilla, however you can transfer data by scp or even use sshfs which is closer to a graphical tool. We might need to write a tutorial on how to do this.

"it might be a good idea to turn off the subsystem in sshd_config" Well spotted! I'll create a ticket to solve this.

It would definitely be a great idea for you to have a look to our kernel configuration. You can find it here: Please share your feedback! We are using kernel version 3.12.9-ck2 with BFS scheduler. This definitely has a great impact in boot time.

"Can you explain why you have different fbwidth and fbheight" - I'm using the same screen, the same Pi and the same sd card for the tests. However, I think the difference is the overscan. Kanux fills the whole screen by default, while Raspbian has the black margin/frame around.

You can contact me at, open issues in GitHub or join our forum: