Skip to content

Instantly share code, notes, and snippets.

@ekussa
Last active March 22, 2021 19:54
Show Gist options
  • Save ekussa/c73db4fb42fb4dbeb7f1de20ac85d409 to your computer and use it in GitHub Desktop.
Save ekussa/c73db4fb42fb4dbeb7f1de20ac85d409 to your computer and use it in GitHub Desktop.
live-build
Install live-build
The live-build package can be found and installed directly from Debian repository, in all the trees, from Debian stable to sid
Install live-build with:
$ sudo apt install live-build
live-build use
Live build package provide the executable lb, used to create the environment, build live distribution and for the cleanup
Configure the environment with lb config
We configure the environment, of our live CD, using lb config inside the git directory:
$ sudo lb config
This command will download and create configuration files necessary for build the distribution
We can to add and push the files to git in order to keep track of the first default configuration
$ cat auto/config
#!/bin/sh
set -e
lb config noauto \
--mode debian \
--architectures amd64 \
--debian-installer live \
--archive-areas "main contrib non-free" \
--apt-indices false \
--memtest none \
-d buster \
--compression lzip \
--system live \
--backports true \
--bootappend-live "boot=live components locales=it_IT.UTF-8 keyboard-layouts=it splash" \
--mirror-bootstrap http://deb.debian.org/debian/ \
--mirror-binary http://deb.debian.org/debian/ \
"${@}"
Let's see the definition in the script
-d|--distribution CODENAME
defines the distribution of the resulting live system
--compression bzip2|gzip|lzip|none
defines the compression program to be used to compress tarballs.
--mode debian|progress|ubuntu
defines a global mode to load project specific defaults.
-a|--architectures ARCHITECTURE
defines the architecture of the to be build image.
--archive-areas ARCHIVE_AREA|"ARCHIVE_AREAS"
defines which package archive areas of a debian packages archive should be used for configured debian package mirrors.
--system live|normal
defines if the resulting system image should a live system or a normal, non-live system.
The full manual can be found on lb config Debian man pages
We can add some packages, creating a list on the package-list directory
$ nano config/package-lists/
Execute script in the live CD chroot adding them in this directory
$ nano config/hooks/live/my-chroot-script.sh
Is possible to include files in the chroot, using the same directory tree as the one desired in the live CD, adding them in this directory:
config/includes.chroot
Build Debian live CD with lb build
We can now build the live CD with live build, this will download all the packages from the mirror and create the .iso file of the distribution
$ sudo lb build
After the completion of the process or for build a new version, we need to cleanup the environment from previous build
$ sudo lb clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment