Live manual Debian Live

# Debian Live Manual

# Overview of tools

295

# 5. Overview of tools

296

This chapter contains an overview of the three main tools used in building live systems: live-build, live-boot and live-config.

297

5.1 The live-build package

298

live-build is a collection of scripts to build live systems. These scripts are also referred to as "commands".

299

The idea behind live-build is to be a framework that uses a configuration directory to completely automate and customize all aspects of building a Live image.

300

Many concepts are similar to those used to build Debian packages with debhelper:

301

- The scripts have a central location for configuring their operation. In debhelper, this is the `debian/` subdirectory of a package tree. For example, dh_install will look, among others, for a file called `debian/install` to determine which files should exist in a particular binary package. In much the same way, live-build stores its configuration entirely under a `config/` subdirectory.

302

- The scripts are independent - that is to say, it is always safe to run each command.

303

Unlike debhelper, live-build provides the tools to generate a skeleton configuration directory. This could be considered to be similar to tools such as dh-make. For more information about these tools, read on, since the remainder of this section discuses the four most important commands. Note that the preceding `lb` is a generic wrapper for live-build commands.

304

- lb config: Responsible for initializing a Live system configuration directory. See The lb config command for more information.

305

- lb build: Responsible for starting a Live system build. See The lb build command for more information.

306

- lb clean: Responsible for removing parts of a Live system build. See The lb clean command for more information.

307

5.1.1 The `lb config` command

308

As discussed in live-build, the scripts that make up live-build read their configuration with the `source` command from a single directory named `config/`. As constructing this directory by hand would be time-consuming and error-prone, the `lb config` command can be used to create the initial skeleton configuration tree.

309

Issuing `lb config` without any arguments creates the `config/` subdirectory which is populated with some default settings in configuration files, and two skeleton trees named `auto/` and `local/`.

310

$ lb config
[2025-02-15 12:34:56] lb config
P: Using http proxy: http://127.0.0.1:3142
P: Creating config tree for a debian/testing/amd64 system
P: Symlinking hooks...

311

Using `lb config` without any arguments would be suitable for users who need a very basic image, or who intend to provide a more complete configuration via `auto/config` later (see Managing a configuration for details).

312

Normally, you will want to specify some options. For example, to specify which package manager to use while building the image:

313

$ lb config --apt aptitude

314

It is possible to specify many options, such as:

315

$ lb config --binary-images netboot --bootappend-live "boot=live components hostname=live-host username=live-user" ...

316

A full list of options is available in the `lb_config` man page.

317

5.1.2 The `lb build` command

318

The `lb build` command reads in your configuration from the `config/` directory. It then runs the lower level commands needed to build your Live system.

319

5.1.3 The `lb clean` command

320

It is the job of the `lb clean` command to remove various parts of a build so subsequent builds can start from a clean state. By default, `chroot`, `binary` and `source` stages are cleaned, but the cache is left intact. Also, individual stages can be cleaned. For example, if you have made changes that only affect the binary stage, use `lb clean --binary` prior to building a new binary. If your changes invalidate the bootstrap and/or package caches, e.g. changes to `--mode`, `--architecture`, or `--bootstrap`, you must use `lb clean --purge`. See the `lb_clean` man page for a full list of options.

321

5.2 The live-boot package

322

live-boot is a collection of scripts providing hooks for the initramfs-tools, used to generate an initramfs capable of booting live systems, such as those created by live-build. This includes the live system ISOs, netboot tarballs, and USB stick images.

323

At boot time it will look for read-only media containing a `/live/` directory where a root filesystem (often a compressed filesystem image like squashfs) is stored. If found, it will create a writable environment, using OverlayFS, for Debian like systems to boot from.

324

More information on initial ramfs in Debian can be found in the Debian Linux Kernel Handbook at ‹https://kernel-team.pages.debian.net/kernel-handbook/› in the chapter on initramfs.

325

5.3 The live-config package

326

live-config consists of the scripts that run at boot time after live-boot to configure the live system automatically. It handles such tasks as setting the hostname, locales and timezone, creating the live user, inhibiting cron jobs and performing autologin of the live user.