LiveCD optimisations

Martin Owens doctormo at
Fri May 21 04:41:39 UTC 2010

Hey Louis,

Sounds great and looks like a pretty good script, I have some comments:

You may be able to make it a little faster by using the find results in
one like like this:

find / -type f -name "*.svg" -print0 | xargs -0 -I FILE sh -c
'/tmp/scour/ --enable-id-stripping --indent=none -i FILE -o
FILE-opt && test -s FILE-opt && mv FILE-opt FILE || rm FILE-opt'

Although if you can get all that into a script file, so much the better
so it's not all on one line. But at least it's not doing a find 3 times
for the same files.

Do you need to chroot into the file system to perform these steps?
considering that your downloading code to do it (with bzr which isn't
installed ont he cd). Would it not be good to perform these steps
outside of the squashfs and iso file system?

For instance I got resolve issues when it tried to do the apt update.

Consider doing a check to see if the iso exists before reserving
scratch, errors are likely if you don't.

Are there no more things that could be optimised? For instance does
using xmllint with --noblanks on the 12496 xml files save any space?

Finally... should some of these optimisations work their way upstream so
all packages have optimised files, smaller downloads, smarter mirror
storage etc?


On Thu, 2010-05-20 at 20:35 -0400, Louis Simard wrote:
> Greetings ubuntu-devel-discuss :)
> I have a proposal for you, and I'll present it simply with the 5 W's.
> -- WHAT? --
> Optimise the PNG images and SVG files on the Ubuntu LiveCD.
> Optimise the Ubuntu LiveCD by putting start-up files and programs near
> the end of the CD.
> -- WHY? --
> Optimising the PNG images saves 5.5 MB on the filesystem.squashfs.
> Optimising the SVG files saves an additional 7 MB. This is a total of
> 12.5 MB which could be used to pack more software or another language
> pack or two onto the LiveCD.
> Optimising the CD to put files at the end allows it to boot marginally
> faster (about 10 seconds on my benchmarks), start applications faster,
> and allows the CD drive on a user's computer to run quieter while
> using his/her applications, as reading near the end (edge of the disc)
> requires slower spinning.
> These changes will give prospective users a better view of Ubuntu
> right from the LiveCD. There might also be additional benefits to
> having smaller PNG and SVG images, such as saving space on a user's
> hard disk when installed. The uncompressed (pre-squashfs) savings for
> the SVG images is 18 MB.
> -- WHEN? --
> Now! :) Just kidding. As soon as possible would be nice. Maybe even
> for the next Ubuntu version, codename Maverick Meerkat!
> -- WHO? --
> Ubuntu developers. But don't go thinking that you'll do all the grunt
> work of testing these optimisations for yourself! (See HOW? below)
> -- HOW? --
> Attached to this email is a bash script I've made to perform all of
> these optimisations on any Canonical-supported Ubuntu 10.04
> LiveCD image, almost automatically. (After optimisations are done, you
> can check the state of the LiveCD in a bash shell from within it. The
> rest is fully automatic.)
> The real savings would come from optimising the PNG and SVG images
> right in the packages themselves, not just the LiveCD. Given a
> directory containing PNG and SVG images, the part of my script dealing
> with OptiPNG and can automatically optimise these files. The
> best candidate for such a Scouring would be ubuntu-docs, as it has
> tons of PNG images. Most application packages have an SVG icon or two
> as well.
> Thanks for your time!
> - Louis

More information about the Ubuntu-devel-discuss mailing list