Note: Almost all content here will eventually be revised and merged into the live-manual. Please do not add new content to the wiki, but contribute to the manual directly.

This page explains how to make a small live image. The resulting image won't be a general purpose Debian, but it's useful if you want to quickly boot and use one single tool.

Forewords

Through out this page, we use the arbitrary-named environment variable $LOCALOPTS, which can contain your local options, expecially the proxy settings, like :

Main hints

The hints listed here are officially included in live-helper.

--bootstrap-flavour minimal

A typical minimal flavour of DebianLive is 93MiB (on i386 ; Debian/etch 2008-05 ; ISO ;binary_etch,minimal-flavour--93MB.packages.txt).

You need to pass the option --apt apt, otherwise lh_build will fail with :

--linux-flavours

If you don't specify --linux-flavours, you may end-up with multiple kernel flavours on the image (486, 686 ...)

This can save up to 30MiB.

--hooks minimal / stripped

The option --hooks minimal or stripped can be used in conjunction with --bootstrap-flavour to remove further stuffs :

(--packages-lists "minimal" is synonym to --hooks minimal see mail).

--binary-indices disabled

Removing binary-indices (i.e. /var/lib/apt/lists/*) saves 6MiB on Etch @i386 (with just main and security enabled).

Purging /var/lib/apt/lists implies that anybody willing to install a package within DebianLive will have to run apt-get update first. (which one should, anyway! ).

--debootstrap cdebootstrap

The option --debootstrap cdebootstrap will instruct lh_build to use cdebootstrap instead of debootstrap. which used to be much more aggressive on package selection. We need to explicit list some package that wouldn't be installed otherwise. (Note : It's difficult to switching to cdebootstrap without removing aptitude).

Note to non US-keyboard users : you probably want to add the package console-common to the list (which will pull console-tools or kbd ).

--memtest disabled

You can save hundreds of KiB by removing memtest :

--apt-recommends

You can fine-tune installed packages by preventing apt-get(8) from installing recommended dependencies.

Exclude packages

You can also explicitly ask not to include some packages :

This is mainly useful if you use a list (like minimal) with debootstrap, but you want to prune some of the software listed in those lists.(/usr/share/live-helper/lists/)

Extra hints

The hints listed here are not officially included/supported by live-helper.

No locales

If you don't need locales and UTF-8, you can save a lot of space. (actually the "stripped" hook deletes the files in /usr/share/locales/ anyway).

1. Tell lh_config that you want to install the package debconf-english 2. Use the variable LH_BOOTSTRAP_EXCLUDE to prevent the installation of locales and debconf-english-i18n 3. Create a script (01-removelocales.sh) to remove locales in case it's got installed :

then

Squeeze

Recent versions of live-helper/live-config do not support 'nolocales' any more. The locale will default to 'en_US.UTF-8'.

Remove kernel from within squashfs file

The kernel is shipped twice on the final CD :

The easiest way is to tell squashfs not to include the /boot folder :

lh_config [YOUR_OTHER_OPTIONS_HERE]
export MKSQUASHFS_OPTIONS="-e boot"
lh_build

Delete arbitrary files

Some files are often "less" needed, let's delete some of them (YMMV).

remove networking tools

You can add/remove the networking tools (YMMV). List or don't list the following packages  --packages="netbase iputils-ping sysklogd  update-inetd tcpd dhcp3-client"

Beyond

some ideas to save more space

Bad ideas :

All in one script

The following scripts builds a 36Mib (on i386 ; Debian/Etch ; ISO ; etch-live-stripped-packages.txt)

# Copyright 2007 Franklin Piat ; License GPL + LGPL
#Some local options
[ ! -d /srv/mini-live-helper ] && mkdir -p /srv/mini-live-helper
cd /srv/mini-live-helper || exit 1
LOCALOPTS="  --mirror-binary http://ftp.fr.debian.org/debian/ --mirror-bootstrap http://ftp.fr.debian.org/debian/"
LOCALOPTS=" --mirror-bootstrap http://192.168.0.10:9999/debian/ --mirror-chroot http://192.168.0.10:9999/debian/ --mirror-binary http://192.168.0.10:9999/debian/ --mirror-chroot-security http://security.eu.debian.org/ --mirror-binary-security http://security.eu.debian.org"


#Let's configure live-helper
lh_config --bootstrap-flavour minimal --packages-lists "stripped" --apt apt --apt-recommends disabled --tasksel none --binary-indices disabled --distribution etch --linux-flavours 686 --union-filesystem unionfs --packages "console-common console-tools  klogd netbase iputils-ping sysklogd update-inetd tcpd dhcp3-client debconf-english" --memtest disabled --bootappend-live "nolocales" $LOCALOPTS


#let's create some scripts

cat <<CHROOTLOCALHOOKS01 > config/chroot_local-hooks/01-removelocales.sh
#!/bin/sh
# Remove locales
# (this could remove other applications. add "-y" if your are confident)
apt-get remove locales  --purge
apt-get remove dselect -y --purge
echo "don t fail on abort (set ERRORLEVEL to zero)" > /dev/null
CHROOTLOCALHOOKS01
chmod +x "config/chroot_local-hooks/01-removelocales.sh"

cat <<CHROOTLOCALHOOKS02 > config/chroot_local-hooks/02-purge-some-modules.sh
#!/bin/sh
# delete the modules we won't need (YMMMV)
rm -Rf /lib/modules/*/kernel/drivers/isdn
rm -Rf /lib/modules/*/kernel/drivers/media
rm -Rf /lib/modules/*/kernel/drivers/net/wireless
CHROOTLOCALHOOKS02
chmod +x "config/chroot_local-hooks/02-purge-some-modules.sh"


# We could exclude some unused  stuffs.
#export LH_BOOTSTRAP_EXCLUDE="vim-tiny,nano,ed"

# exclude some stuffs from the squashfs root
export MKSQUASHFS_OPTIONS="-e boot"
nice ionice -c2 lh_build --debug