Ubuntu live cd’s, now 33% faster
One of the goals for the Lucid cycle was to investigate why it took so long to boot an Ubuntu live cd session. Why is this important I hear you ask? Well the live cd is usually the first thing a potential new Ubuntu user sees. They get an Ubuntu Desktop (or other flavour) cd from their friend/colleague/random person, insert it into their machine, wait for a while and are then presented with a live session. All well and good but if your running on slower hardware, even a different architecture such as ARM, this initial slowness can be orders of magnitude more than a fast desktop/laptop. For example, the ARM images we shipped for Karmic took over 3 minutes to boot into a live desktop session.
How do you boot a live cd session?
The first thing to do was find out why it was slow. There are a few ways to do this but I chose to first use simple time-stamping methods and afterwards, the much prettier bootchart package.
A bit of background on how the live cd session is booted. There are two broad steps in the process of booting a live cd, the first is setting up the environment ready for the session, and the second, you guessed it, is actually booting into the session. Initial hunches were that the first step, setting up the session, was the major cause of slowness so investigations started there.
Casper
Setting up the session is the responsibility of a project called casper. Casper is a set of scripts that are run on boot to do such things as unpack the initial filesystem, add a dummy user, setup languages and keyboard layouts and so forth. Its mainly written in perl.
The time-stamping stage of investigates confirmed that casper was indeed slower than it should be. I’ll skip ahead to the bootchart part of the story as thats much more visually interesting.
Casper before

Above you can see the casper section of the live cd boot process. I’ve highlighted the bits that immediately stand out. The overall boot was 3 minutes and 15 seconds with casper responsible for around 2 minutes of that.
The highlighted bits seemed to have one thing in common, they all interacted with the debconf database. From the debconf programmers tutorial document:
“debconf is a backend database, with a frontend that talks to it and presents an interface to the user. There can be many different types of frontends, from plain text to a web frontend. The frontend also talks to a special config script in the control section of a debian package, and it can talk to postinst scripts and other scripts as well, all using a special protocol. These scripts tell the frontend what values they need from the database, and the frontend asks the user questions to get those values if they aren’t set.”
So communicating with the debconf database was slowing the boot. Initiating the call, sending the data and receiving a response, was taking up to 4 seconds at a time and when there are many of these calls, they all soon add up.
After many a head-scratching moment it was decided that the best way to solve this would be to initiate the communication once and keep it open so that when debconf was needed, the overhead in setting it up was removed. The implementation details are all in the code history but the results are much easier to show.
Casper after

With a couple of other tweaks besides the debconf one, the boot is now down to 1 minute 53 seconds and casper takes just under 50 seconds of that. There is more room for improvement, pre-generating a default locale (although which locale that would be is a tough choice), pre-generating fonts and looking into SSL, but for now, this is a big win.
The bootcharts above are for the ARM based iMX51 device made by Freescale which is only just beginning to proliferate onto the market. Intel/AMD based machines show an equivalent speed-up.
Conclusion
So there you have it. The next time you boot into a Lucid live cd session it shouldn’t take quite so long, and now you know why.
Hi, my name is Jamie Bennett. I'm a technologist, programmer, researcher, tech evangelist, open source monkey, Linux lover and self confessed gadget freak.
Great work!
jorge
12 Feb 10 at 3:39 am
This is good news. New users first impression is so important
Besides, it’s very annoying when you want to show off Ubuntu to someone, and boot into the LiveCD and have to wait 3-5 minutes before showing off the promised land.
So great work, and let us see even further boot performance
Martin Pihl
12 Feb 10 at 8:47 am
Great work! Hope it helps to bring more users into Ubuntu community.
w1ngnutz
12 Feb 10 at 11:11 am
This is exciting. Knoppix currently has some really great technology going into offering a great Live CD experience. I think Ubuntu can follow the lead and begin leading in this area as well.
Maxo
13 Feb 10 at 12:16 am
[...] The shiniest and fastest ARMs ever in ubuntu … By ograblog As JamieBennett writes on his blog here and here [...]
The shiniest and fastest ARMs ever in ubuntu … « Ogra’s blog
15 Feb 10 at 11:19 am
Can’t all the locales not be pregenerated?
Meneer R
15 Feb 10 at 11:43 am
Yes but that would increase the image size on the cd. There is a possibility to generate say, the top 5 locales and ship them. This is being looked into.
JamieBennett
15 Feb 10 at 11:47 am
Nice work! I’m glad to see this old code getting some love. It’s come a long way since Hoary!
Matt Zimmerman
16 Feb 10 at 8:49 pm
[...] Read | Permalink | Email this | Comments Linux – Ubuntu – Booting – Live CD – Compact Disc [...]
Ubuntu live CDs now boot 33% faster! | Tech Industry News
18 Feb 10 at 10:34 pm
[...] Read | Permalink | Email this | Comments [...]
Ubuntu live CDs now boot 33% faster! » Shai Perednik.com
19 Feb 10 at 12:02 am
[...] Read | Permalink | Email this | Comments Linux – Ubuntu – Booting – Live CD – Compact Disc View full post on Download Squad [...]
Ubuntu live CDs now boot 33% faster! | World Wide Web
20 Feb 10 at 1:27 am
My mates HDD died so he now exclusively runs ubuntu as a live CD. I’ve taught him the basics of the OS and hes getting on great, this will make his experience even better.
Sim
10 Apr 10 at 12:05 pm
[...] Read more about the Live CD boot time improvements. [...]
Ubuntu Lucid Lynx on ARM « linuxuk.org
11 May 10 at 9:22 pm