DEBIAN LIVE HANDBUCH ******************** ABOUT ===== 1. ABOUT THIS MANUAL -------------------- The main goal of this manual is to serve as a single access point to all documentation related to the Debian Live project. It does not include end-user documentation for using a Debian Live system as far as things are live specific. Some of the commands mentioned in the text must be executed with superuser privileges which can be obtained by becoming the root user via su or by using sudo. To distinguish between commands which may be executed by an unprivileged user and those requiring superuser privileges, commands are prepended by $ or # respectively. This symbol is not a part of the command. 1.1 FOR THE IMPATIENT ..................... While we believe that everything in this manual is important to at least some of our users, we realize it is a lot of material to cover and that you may wish to experience early success using the software before delving into the details. Therefore, we have provided three tutorials in the Examples section designed to teach you image building and customization basics. Read Using the examples first, followed by Tutorial 1: A standard image, Tutorial 2: A web browser utility and finally Tutorial 3: A personalized image. By the end of these tutorials, you will have a taste of what can be done with Debian Live. We encourage you to return to more in-depth study of the manual, perhaps next reading The basics, skimming or skipping Building a netboot image, and finishing by reading the Customization overview and the chapters that follow it. By this point, we hope you are thoroughly excited by what can be done with Debian Live and motivated to read the rest of the manual, cover-to-cover. 1.2 TERMS ......... * *Live system*: An operating system that can boot without installation to a hard drive. Live systems do not alter local operating system(s) or file(s) already installed on the computer hard drive unless instructed to do so. Live systems are typically booted from media such as CDs, DVDs or USB sticks. Some may also boot over the network. * *Debian Live*: The Debian sub-project which maintains the /live-boot/, /live-build/, /live-config/, and /live-manual/ packages. * *Debian Live system*: A live system that uses software from the Debian operating system that may be booted from CDs, DVDs, USB sticks, over the network (via netboot images), and over the Internet (via boot parameter fetch=URL). * *Host system*: The environment used to create the live system. * *Target system*: The environment used to run the live system. * */live-boot/*: A collection of scripts used to boot live systems. /live-boot/ was formerly a part of live-initramfs. * */live-build/*: A collection of scripts used to build customized Debian Live systems. /live-build/ was formerly known as live-helper, and even earlier known as live-package. * */live-config/*: A collection of scripts used to configure a live system during the boot process. /live-config/ was formerly a part of live-initramfs. * */live-manual/*: This document is maintained in a package called /live-manual/. * *Debian Installer (d-i)*: The official installation system for the Debian distribution. * *Boot parameters*: Parameters that can be entered at the bootloader prompt to influence the kernel or /live-config/. * *chroot*: The chroot program, chroot(8), enables us to run different instances of the GNU/Linux environment on a single system simultaneously without rebooting. * *Binary image*: A file containing the live system, such as binary.iso or binary.img. * *Target distribution*: The distribution upon which your live system will be based. This can differ from the distribution of your host system. * *Squeeze/Wheezy/Sid (stable/testing/unstable)*: Debian codenames for releases. At the time of writing, *Squeeze* is the current *stable* release and *Wheezy* is the current *testing* release. *Sid* will always be a synonym for the *unstable* release. Throughout the manual, we tend to use codenames for the releases, as that is what is supported by the tools themselves. The *stable* distribution contains the latest officially released distribution of Debian. The *testing* distribution is the staging area for the next *stable* release. A major advantage of using this distribution is that it has more recent versions of software relative to the *stable* release. The *unstable* distribution is where active development of Debian occurs. Generally, this distribution is run by developers and those who like to live on the edge. 1.3 AUTHORS ........... A list of authors (in alphabetical order): * Ben Armstrong * Brendan Sleight * Chris Lamb * Daniel Baumann * Franklin Piat * Jonas Stein * Kai Hendry * Marco Amadori * Mathieu Geli * Matthias Kirschner * Richard Nelson * Trent W. Buck 1.4 CONTRIBUTING TO THIS DOCUMENT ................................. This manual is intended as a community project and all proposals for improvements and contributions are extremely welcome. The preferred way to submit a contribution is to send it to the mailing list. Please see the section Contact for more information. When submitting a contribution, please clearly identify its copyright holder and include the licensing statement. Note that to be accepted, the contribution must be licensed under the same license as the rest of the document, namely, GPL version 3 or later. The sources for this manual are maintained using the Git version control system. You can check out the latest copy by executing: $ git clone git://live.debian.net/git/live-manual.git Prior to submission of your contribution, please preview your work. To preview the /live-manual/, ensure the packages needed for building are installed by executing: # apt-get install make po4a sisu-complete libnokogiri-ruby You may build the /live-manual/ from the top level directory of your Git checkout by executing: $ make build Since it takes a while to build the manual in all supported languages, you may find it convenient when proofing to build for only one language, e.g. by executing: $ make build LANGUAGES=en 1.4.1 APPLYING PATCHES ...................... Anyone can directly commit to the repository. However, we ask you to send bigger changes to the mailing list to discuss them first. To push to the repository, you must follow this procedure: * Fetch the public commit key: $ mkdir -p ~/.ssh/identity.d $ wget http://live.debian.net/other/keys/gitosis@live.debian.net \ -O ~/.ssh/identity.d/gitosis@live.debian.net $ wget http://live.debian.net/other/keys/gitosis@live.debian.net.pub \ -O ~/.ssh/identity.d/gitosis@live.debian.net.pub $ chmod 0600 ~/.ssh/identity.d/gitosis@live.debian.net* * Add the following section to your openssh-client config: $ cat >> ~/.ssh/config << EOF Host live.debian.net Hostname live.debian.net User gitosis IdentityFile ~/.ssh/identity.d/gitosis@live.debian.net EOF * Check out a clone of the manual through ssh: $ git clone gitosis@live.debian.net:/live-manual.git * After editing the files in manual/en/, please call the 'commit' target in the top level directory to sanitize the files and update the translation files: $ make commit * After sanitizing, commit the changes. Write commit messages that consist of full, useful sentences in English, starting with a capital letter and ending with a full stop. Usually, these will start with the form 'Fixing/Adding/Removing/Correcting/Translating', e.g. $ git commit -a -m "Adding a section on applying patches." * Push the commit to the server: $ git push 1.4.2 TRANSLATION ................. To submit a translation for a new language, follow these three steps: * Translate the about_manual.ssi.pot, about_project.ssi.pot and index.html.in.pot files to your language with your favourite editor (such as poedit). Send translated files to the mailing list. Once we have reviewed your submission, we will add the new language to the manual (providing the po files) and will enable it in the autobuild. * Once the new language is added, you can randomly start translating all po files in manual/po/. * Don't forget you need make commit to ensure the translated manuals are updated from the po files, before git commit -a and git push. 2. ÜBER DAS DEBIAN LIVE PROJEKT -------------------------------- 2.1 MOTIVATION .............. 2.1.1 WHAT IS WRONG WITH CURRENT LIVE SYSTEMS ............................................. When Debian Live was initiated, there were already several Debian based live systems available and they are doing a great job. From the Debian perspective most of them have one or more of the following disadvantages: * They are unofficial projects, developed outside of Debian. * They mix different distributions, e.g. *testing* and *unstable*. * They support i386 only. * They modify the behaviour and/or appearance of packages by stripping them down to save space. * They include unofficial packages. * They ship custom kernels with additional patches that are not part of Debian. * They are large and slow due to their sheer size and thus not suitable for rescue issues. * They are not available in different flavours, e.g. CDs, DVDs, USB-stick and netboot images. 2.1.2 WHY CREATE OUR OWN LIVE SYSTEM? ..................................... Debian is the Universal Operating System: Debian has an official live system for showing around and to officially represent the true, one and only Debian system with the following main advantages: * It would be an official Debian subproject. * It reflects the (current) state of one distribution. * It runs on as many architectures as possible. * It consists of unchanged Debian packages only. * It does not contain any unofficial packages. * It uses an unaltered Debian kernel with no additional patches. 2.2 PHILOSOPHY .............. 2.2.1 ONLY UNCHANGED, OFFICIAL PACKAGES ....................................... We will only use official packages from the Debian repository in the "main" section. The non-free section is not part of Debian and therefore cannot be used at all for official live system images. We will not change any packages. Whenever we need to change something, we will do that in coordination with its package maintainer in Debian. As an exception, our own packages such as /live-boot/, /live-build/ or /live-config/ may temporarily be used from our own repository for development reasons (e.g. to create development snapshots). They will be uploaded to Debian on a regular basis. 2.2.2 NO PACKAGE CONFIGURATION OF THE LIVE SYSTEM ................................................. In this phase we will not ship or install sample or alternative configurations. All packages are used in their default configuration as they are after a regular installation of Debian. Whenever we need a different default configuration, we will do that in coordination with its package maintainer in Debian. A system for configuring packages is provided using debconf in lb config (use --preseed FILE) allowing custom configured packages to be installed in your custom produced Debian Live images, but for official live images only default configuration will be used. For more information, please see Customization overview. Exception: There are a few essential changes needed to bring a live system to life (e.g. configuring pam to allow empty passwords). These essential changes have to be kept as minimal as possible and should be merged within the Debian repository if possible. 2.3 CONTACT ........... * *Mailing list*: The primary contact for the project is the mailing list at . You can email the list directly by addressing your mail to debian-live@lists.debian.org. The list archives are available at . * *IRC*: A number of users and developers are present in the #debian-live channel on irc.debian.org (OFTC). When asking a question on IRC, please be patient for an answer. If no answer is forthcoming, please email the mailing list. * *BTS*: The Debian Bug Tracking System (BTS) contains details of bugs reported by users and developers. Each bug is given a number, and is kept on file until it is marked as having been dealt with. For more information, please see Reporting bugs. * *Wiki*: The Debian Live wiki at is a place to gather information, discuss applied technologies, and document frameworks of Debian Live systems that go beyond the scope of this document. USER ==== 3. INSTALLATION --------------- 3.1 REQUIREMENTS ................ Building Debian Live images has very few system requirements: * Super user (root) access * An up-to-date version of /live-build/ * A POSIX-compliant shell, such as /bash/ or /dash/. * /debootstrap/ or /cdebootstrap/ * Linux 2.6.x Note that using Debian or a Debian-derived distribution is not required - /live-build/ will run on almost any distribution with the above requirements. 3.2 INSTALLING LIVE-BUILD ......................... You can install /live-build/ in a number of different ways: * From the Debian repository * From source * From snapshots If you are using Debian, the recommended way is to install /live-build/ via the Debian repository. 3.2.1 FROM THE DEBIAN REPOSITORY ................................ Simply install /live-build/ like any other package: # apt-get install live-build or # aptitude install live-build 3.2.2 FROM SOURCE ................. /live-build/ is developed using the Git version control system. On Debian systems, this is provided by the /git/ package. To check out the latest code, execute: $ git clone git://live.debian.net/git/live-build.git You can build and install your own Debian package by executing: $ cd live-build $ dpkg-buildpackage -rfakeroot -b -uc -us $ cd .. Now install whichever of the freshly built .deb files you were interested in, e.g. # dpkg -i live-build_2.0.8-1_all.deb You can also install /live-build/ directly to your system by executing: # make install and uninstall it with: # make uninstall 3.2.3 FROM 'SNAPSHOTS' ...................... If you do not wish to build or install /live-build/ from source, you can use snapshots. These are built automatically from the latest version in Git and are available on . 3.3 LIVE-BOOT AND LIVE-CONFIG ............................. *Note:* You do not need to install /live-boot/ or /live-config/ on your system to create customized Debian Live systems. However, doing so will do no harm and is useful for reference purposes. 3.3.1 FROM THE DEBIAN REPOSITORY ................................ Both /live-boot/ and /live-config/ are available from the Debian repository as per Installing live-build. 3.3.2 FROM SOURCE ................. To use the latest source from git, you can follow the process below. Please ensure you are familiar with the terms mentioned in Terms. * Checkout the /live-boot/ and /live-config/ source $ git clone git://live.debian.net/git/live-boot.git $ git clone git://live.debian.net/git/live-config.git Consult the /live-boot/ and /live-config/ man pages for details on customizing if that is your reason for building these packages from source. * Build /live-boot/ and /live-config/ .deb files You must build either on your target distribution or in a chroot containing your target platform: this means if your target is *Squeeze* then you should build against *Squeeze*. Use a personal builder such as /pbuilder/ or /sbuild/ if you need to build live-boot for a target distribution that differs from your build system. For example, for *Squeeze* live images, build live-boot in a *Squeeze* chroot. If your target distribution happens to match your build system distribution, you may build directly on the build system using dpkg-buildpackage (provided by the /dpkg-dev/ package): $ cd live-boot $ dpkg-buildpackage -b -uc -us $ cd ../live-config $ dpkg-buildpackage -b -uc -us * Use all generated .deb files As /live-boot/ and /live-config/ are installed by /live-build/ system, installing the packages in the host system is not sufficient: you should treat the generated .deb files like any other custom packages. Please see Customizing package installation for more information. You should pay particular attention to Additional repositories. 3.3.3 FROM 'SNAPSHOTS' ...................... You can let /live-build/ automatically use the latest snapshots of /live-boot/ and /live-config/ by configuring a third-party repository in your /live-build/ configuration directory. Assuming you have already created a configuration tree with lb config: $ lb config --repository live.debian.net 4. THE BASICS ------------- This chapter contains a brief overview of the build process and instructions for using the three most commonly used image types. The most versatile image type, iso-hybrid, may be used on a virtual machine, optical media or USB portable storage device. In certain special cases, usb-hdd may be more suitable for USB devices. The chapter finishes with instructions for building and using a net type image, which is a bit more involved due to the setup required on the server. This is a slightly advanced topic for anyone who is not familiar already with netbooting, but is included here because once the setup is done, it is a very convenient way to test and deploy images for booting on the local network without the hassle of dealing with image media. 4.1 WHAT IS A LIVE SYSTEM? .......................... A live system usually means an operating system booted on a computer from a removable medium, such as a CD-ROM or USB stick, or from a network, ready to use without any installation on the usual drive(s), with auto-configuration done at run time (see Terms). With Debian Live, it's a Debian GNU/Linux operating system, built for one of the supported architectures (currently amd64, i386, powerpc and sparc). It is made from the following parts: * *Linux kernel image*, usually named vmlinuz* * *Initial RAM disk image (initrd)*: a RAM disk set up for the Linux boot, containing modules possibly needed to mount the System image and some scripts to do it. * *System image*: The operating system's filesystem image. Usually, a SquashFS compressed filesystem is used to minimize the Debian Live image size. Note that it is read-only. So, during boot the Debian Live system will use a RAM disk and 'union' mechanism to enable writing files within the running system. However, all modifications will be lost upon shutdown unless optional persistence is used (see Persistence). * *Bootloader*: A small piece of code crafted to boot from the chosen media, possibly presenting a prompt or menu to allow selection of options/configuration. It loads the Linux kernel and its initrd to run with an associated system filesystem. Different solutions can be used, depending on the target media and format of the filesystem containing the previously mentioned components: isolinux to boot from a CD or DVD in ISO9660 format, syslinux for HDD or USB drive booting from a VFAT partition, extlinux for ext2/3/4 and btrfs partitions, pxelinux for PXE netboot, GRUB for ext2/3/4 partitions, etc. You can use /live-build/ to build the system image from your specifications, set up a Linux kernel, its initrd, and a bootloader to run them, all in one media-dependant format (ISO9660 image, disk image, etc.). 4.2 FIRST STEPS: BUILDING AN ISO IMAGE ...................................... The following sequence of /live-build/ commands will create a basic ISO hybrid image containing just the Debian standard system without X.org. It is suitable for burning to CD or DVD media, and also to copy onto a USB stick (as per Copying USB/HDD image to a USB stick, specifying ".iso" extension where ".img" is indicated). First, we run the lb config command which will create a "config/" hierarchy in the current directory for use by other commands: $ lb config By passing no parameters to lb config, we indicated that we wish to use the defaults (see The lb config command). Now that we have a "config/" hierarchy, we may build the image with the lb build command: # lb build This process can take a while, depending on the speed of your network connection (see The lb build command). 4.2.1 TESTING AN ISO IMAGE WITH QEMU .................................... Testing an ISO is simple: # apt-get install qemu $ qemu -cdrom binary.iso 4.2.2 TESTING AN ISO IMAGE WITH VIRTUALBOX-OSE .............................................. In order to test the ISO with virtualbox-ose: # apt-get install virtualbox-ose virtualbox-ose-dkms $ virtualbox Create a new virtual machine, change the storage settings to use binary.iso as the CD/DVD device, and start the machine. Note: For live systems containing X.org that you want to test with virtualbox-ose, you may wish to include the VirtualBox X.org driver package, virtualbox-ose-guest-x11, in your /live-build/ configuration. Otherwise, the resolution is limited to 800x600. $ lb config --packages virtualbox-ose-guest-x11 4.2.3 BURNING AN ISO IMAGE TO A PHYSICAL MEDIUM ............................................... Burning an ISO image is easy: # apt-get install wodim $ wodim binary.iso 4.3 BUILDING A USB/HDD IMAGE ............................ The following sequence of commands will create a basic USB/HDD image containing just the Debian standard system without X.org. It is suitable for booting from USB sticks, USB hard drives, and various other portable storage devices. Normally, an ISO hybrid image can be used for this purpose instead, but if you have a BIOS which does not handle hybrid images properly, or want to use the remaining space on the media for a persistence partition, you need a USB/HDD image. Note: if you created an ISO image with the previous example, you will need to clean up your working directory with the lb clean command (see The lb clean command): # lb clean --binary Run the lb config command with the parameters to configure the config/ hierarchy to create a USB/HDD image type: $ lb config -b usb-hdd Now build the image with the lb build command: # lb build 4.3.1 COPYING USB/HDD IMAGE TO A USB STICK .......................................... The generated binary image contains a VFAT partition and the syslinux bootloader, ready to be directly written on a USB stick. Plug in a USB stick with a size larger than that of binary.img and type: $ dd if=binary.img of=${USBSTICK} where ${USBSTICK} is the device file of your key, like /dev/sdb (not a partition like /dev/sdb1!); you can find the right device name by looking in dmesg's output after plugging in the stick, for example, or better yet, ls -l /dev/disk/by-id. *This will definitely overwrite any previous contents on your stick!* Note: As discussed earlier, this same process can be used for iso-hybrid type images (suffixed -hybrid.iso), but not iso type images. 4.3.2 TESTING A USB/HDD IMAGE WITH QEMU ....................................... # apt-get install qemu $ qemu -hda binary.img 4.3.3 USING THE SPACE LEFT ON A USB STICK ......................................... If you want to use the remaining free space after you have installed the binary.img, you can use a partitioning tool such as gparted or parted to create a new partition on the stick. The first partition will be used by the Debian Live system. # gparted ${USBSTICK} After the creation of the partition, you have to create a filesystem on it. One possible choice would be ext4. # mkfs.ext4 ${USBSTICK} If you want to use this data partition with Windows, use FAT32. # mkfs.vfat -F 32 *Remember: Every time you install a new binary.img on the stick, all data on the stick will be lost because the partition table is overwritten by the contents of the image.* 4.4 BUILDING A NETBOOT IMAGE ............................ The following sequence of commands will create a basic netboot image containing the Debian standard system without X.org. It is suitable for booting over the network. Note: if you performed any previous examples, you will need to clean up your working directory with the lb clean command: # lb clean --binary Run the lb config command as follows to configure your image for netbooting: $ lb config -b net --net-root-path "/srv/debian-live" --net-root-server "192.168.0.1" In contrast with the ISO and USB/HDD images, netbooting does not, itself, serve the filesystem image to the client, so the files must be served via NFS. The --net-root-path and --net-root-server options specify the location and server, respectively, of the NFS server where the filesytem image will be located at boot time. Make sure these are set to suitable values for your network and server. Now build the image with the lb build command: # lb build In a network boot, the client runs a small piece of software which usually resides on the EPROM of the Ethernet card. This program sends a DHCP request to get an IP address and information about what to do next. Typically, the next step is getting a higher level bootloader via the TFTP protocol. That could be pxelinux, GRUB, or even boot directly to an operating system like Linux. For example, if you unpack the generated binary-net.tar.gz archive in the /srv/debian-live directory, you'll find the filesystem image in live/filesystem.squashfs and the kernel, initrd and pxelinux bootloader in tftpboot/debian-live/i386. We must now configure three services on the server to enable netboot: the DHCP server, the TFTP server and the NFS server. 4.4.1 DHCP SERVER ................. We must configure our network's DHCP server to be sure to give an IP address to the netbooting client system, and to advertise the location of the PXE bootloader. Here is an example for inspiration, written for the ISC DHCP server isc-dhcp-server in the /etc/dhcp/dhcpd.conf configuration file: # /etc/dhcp/dhcpd.conf - configuration file for isc-dhcp-server ddns-update-style none; option domain-name "example.org"; option domain-name-servers ns1.example.org, ns2.example.org; default-lease-time 600; max-lease-time 7200; log-facility local7; subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.1 192.168.0.254; next-server servername; filename "pxelinux.0"; } 4.4.2 TFTP SERVER ................. This serves the kernel and initial ramdisk to the system at run time. You should install the tftpd-hpa package. It can serve all files contained inside a root directory, usually /srv/tftp. To let it serve files inside /srv/debian-live/tftpboot, run as root the following command: # dpkg-reconfigure -plow tftpd-hpa and fill in the new tftp server directory when being asked about it. 4.4.3 NFS SERVER ................ Once the guest computer has downloaded and booted a Linux kernel and loaded its initrd, it will try to mount the Live filesystem image through a NFS server. You need to install the nfs-kernel-server package. Then, make the filesystem image available through NFS by adding a line like the following to /etc/exports: /srv/debian-live *(ro,async,no_root_squash,no_subtree_check) and tell the NFS server about this new export with the following command: # exportfs -rv Setting up these three services can be a little tricky. You might need some patience to get all of them working together. For more information, see the syslinux wiki at or the Debian Installer Manual's TFTP Net Booting section at . They might help, as their processes are very similar. 4.4.4 NETBOOT TESTING HOWTO ........................... Netboot image creation is made easy with /live-build/ magic, but testing the images on physical machines can be really time consuming. To make our life easier, we can use virtualization. There are two solutions. 4.4.5 QEMU .......... * Install qemu, bridge-utils, sudo. Edit /etc/qemu-ifup: #!/bin/sh sudo -p "Password for $0:" /sbin/ifconfig $1 172.20.0.1 echo "Executing /etc/qemu-ifup" echo "Bringing up $1 for bridged mode..." sudo /sbin/ifconfig $1 0.0.0.0 promisc up echo "Adding $1 to br0..." sudo /usr/sbin/brctl addif br0 $1 sleep 2 Get, or build a grub-floppy-netboot (in the svn). Launch qemu with "-net nic,vlan=0 -net tap,vlan=0,ifname=tun0" 4.4.6 VMWARE PLAYER ................... * Install VMWare Player ("free as in beer" edition) * Create a PXETester directory, and create a text file called pxe.vwx inside * Paste this text inside: #!/usr/bin/vmware config.version = "8" virtualHW.version = "4" memsize = "512" MemAllowAutoScaleDown = "FALSE" ide0:0.present = "FALSE" ide1:0.present = "FALSE" floppy0.present = "FALSE" sound.present = "FALSE" tools.remindInstall = "FALSE" ethernet0.present = "TRUE" ethernet0.addressType = "generated" displayName = "Test Boot PXE" guestOS = "other" ethernet0.generatedAddress = "00:0c:29:8d:71:3b" uuid.location = "56 4d 83 72 5c c4 de 3f-ae 9e 07 91 1d 8d 71 3b" uuid.bios = "56 4d 83 72 5c c4 de 3f-ae 9e 07 91 1d 8d 71 3b" ethernet0.generatedAddressOffset = "0" * You can play with this configuration file (e.g. change memory limit to 256) * Double click on this file (or run VMWare player and select this file). * When running just press space if that strange question comes up... 5. OVERVIEW OF TOOLS -------------------- This chapter contains an overview of the three main tools used in building Debian Live systems: /live-build/, /live-boot/ and /live-config/. 5.1 LIVE-BUILD .............. /live-build/ is a collection of scripts to build Debian Live systems. These scripts are also referred to as "commands". 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. Many concepts are similar to those in the debhelper Debian package tools written by Joey Hess: * 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, amongst 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. * The scripts are independent - that is to say, it is always safe to run each command. Unlike debhelper, /live-build/ contains a tool to generate a skeleton configuration directory, lb config. This could be considered to be similar to tools such as dh-make. For more information about lb config, please see The lb config command. The remainder of this section discusses the three most important commands: * *lb config*: Responsible for initializing a Live system configuration directory. See The lb config command for more information. * *lb build*: Responsible for starting a Live system build. See The lb build command for more information. * *lb clean*: Responsible for removing parts of a Live system build. See The lb clean command for more information. 5.1.1 THE LB CONFIG COMMAND ........................... As discussed in live-build, the scripts that make up /live-build/ source their configuration 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 skeleton configuration folders. Issuing lb config without any arguments creates a config/ subdirectory which it populates with some default settings: $ lb config P: Creating config tree $ ls -l total 8 drwxr-xr-x 3 user user 4096 Sep 7 13:02 auto drwxr-xr-x 22 user user 4096 Sep 7 13:02 config $ ls -l config/ total 104 -rw-r--r-- 1 user user 4197 Sep 7 13:02 binary drwxr-xr-x 2 user user 4096 Sep 7 13:02 binary_debian-installer drwxr-xr-x 2 user user 4096 Sep 7 13:02 binary_debian-installer-includes drwxr-xr-x 2 user user 4096 Sep 7 13:02 binary_grub drwxr-xr-x 2 user user 4096 Sep 7 13:02 binary_local-debs drwxr-xr-x 2 user user 4096 Sep 7 13:02 binary_local-hooks drwxr-xr-x 2 user user 4096 Sep 7 13:02 binary_local-includes drwxr-xr-x 2 user user 4096 Sep 7 13:02 binary_local-packageslists drwxr-xr-x 2 user user 4096 Sep 7 13:02 binary_local-udebs drwxr-xr-x 2 user user 4096 Sep 7 13:02 binary_rootfs drwxr-xr-x 2 user user 4096 Sep 7 13:02 binary_syslinux -rw-r--r-- 1 user user 2051 Sep 7 13:02 bootstrap -rw-r--r-- 1 user user 1647 Sep 7 13:02 chroot drwxr-xr-x 2 user user 4096 Sep 7 13:02 chroot_apt drwxr-xr-x 2 user user 4096 Sep 7 13:02 chroot_local-hooks drwxr-xr-x 2 user user 4096 Sep 7 13:02 chroot_local-includes drwxr-xr-x 2 user user 4096 Sep 7 13:02 chroot_local-packages drwxr-xr-x 2 user user 4096 Sep 7 13:02 chroot_local-packageslists drwxr-xr-x 2 user user 4096 Sep 7 13:02 chroot_local-patches drwxr-xr-x 2 user user 4096 Sep 7 13:02 chroot_local-preseed drwxr-xr-x 2 user user 4096 Sep 7 13:02 chroot_sources -rw-r--r-- 1 user user 2954 Sep 7 13:02 common drwxr-xr-x 2 user user 4096 Sep 7 13:02 includes -rw-r--r-- 1 user user 205 Sep 7 13:02 source drwxr-xr-x 2 user user 4096 Sep 7 13:02 templates Using lb config without any arguments would be suitable for users who need a very basic image, or who intend to later provide a more complete configuration via auto/config (see Managing a configuration for details). Normally, you will want to specify some options. For example, to include the 'gnome' package list in your configuration: $ lb config -p gnome It is possible to specify many options, such as: $ lb config --binary-images net --hostname live-machine --username live-user ... A full list of options is available in the lb_config man page. 5.1.2 THE LB BUILD COMMAND .......................... The lb build command reads in your configuration from the config/ directory. It then runs the lower lower level commands needed to build your Live system. 5.1.3 THE LB CLEAN COMMAND .......................... 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. 5.2 THE LIVE-BOOT PACKAGE ......................... /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 Debian Live ISOs, netboot tarballs, and USB stick images. 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 aufs, for Debian like systems to boot from. More information on initial ramfs in Debian can be found in the Debian Linux Kernel Handbook at in the chapter on initramfs. 5.3 THE LIVE-CONFIG PACKAGE ........................... /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. 6. MANAGING A CONFIGURATION --------------------------- This chapter explains how to manage a live configuration from initial creation, through successive revisions and successive releases of both the /live-build/ software and the live image itself. 6.1 USE AUTO TO MANAGE CONFIGURATION CHANGES ............................................ Live configurations rarely are perfect on the first try. You'll likely need to make a series of revisions until you are satisfied. However, inconsistencies can creep into your configuration from one revision to the next if you aren't careful. The main problem is, once a variable is given a default value, that value will not be recomputed from other variables that may change in later revisions. For example, when the distribution is first set, many 'dependent' variables are given default values that suit that distribution. However, if you later decide to change the distribution, those dependent variables continue to retain old values that are no longer appropriate. A second, related problem is that if you run lb config and then upgrade to a new version of /live-build/ that has changed one of the variable names, you will discover this only by manual review of the variables in your config/* files, which you will then need to use to set the appropriate option again. All of this would be a terrible nuisance if it weren't for auto/* scripts, simple wrappers to the lb config, lb build and lb clean commands that are designed to help you manage your configuration. Simply create an auto/config script containing lb config command with all desired options, and an auto/clean that removes the files containing configuration variable values, and each time you lb config and lb clean, these files will be executed. This will ensure that your configuration is kept internally consistent from one revision to the next and from one /live-build/ release to the next (though you will still have to take care and read the documentation when you upgrade /live-build/ and make adjustments as needed). 6.2 EXAMPLE AUTO SCRIPTS ........................ Use auto script examples such as the following as the starting point for your new /live-build/ configuration. Take note that when you call the lb command that the auto script wraps, you must specify noauto as its parameter to ensure that the auto script isn't called again, recursively. Also, don't forget to ensure the scripts are executable (e.g. chmod 755 auto/*). auto/config #!/bin/sh lb config noauto \ --packages-lists "standard" \ "${@}" auto/clean #!/bin/sh lb clean noauto "${@}" rm -f config/binary config/bootstrap \ config/chroot config/common config/source rm -f binary.log auto/build #!/bin/sh lb build noauto "${@}" 2>&1 | tee binary.log We now ship example auto scripts with /live-build/ based on the examples above. You may copy those as your starting point. $ cp /usr/share/live/build/examples/auto/* auto/ Edit auto/config, changing or adding any options as you see fit. In the example above, --packages-lists standard is set to the default value. Change this to an appropriate value for your image (or delete it if you want to use the default) and add any additional options in continuation lines that follow. 7. CUSTOMIZATION OVERVIEW ------------------------- This chapter gives an overview of the various ways in which you may customize a Debian Live system. 7.1 BUILD TIME VS. BOOT TIME CONFIGURATION .......................................... Live system configuration options are divided into build-time options which are options that are applied at build time and boot-time options which are applied at boot time. Boot-time options are further divided into those occurring early in the boot, applied by the /live-boot/ package, and those that happen later in the boot, applied by /live-config/. Any boot-time option may be modified by the user by specifying it at the boot prompt. The image may also be built with default boot parameters so users can normally just boot directly to the live system without specifying any options when all of the defaults are suitable. In particular, the argument to lb --bootappend-live consists of any default kernel command line options for the Live system, such as persistence, keyboard layouts, or timezone. See Customizing locale and language, for example. Build-time configuration options are described in the lb config man page. Boot-time options are described in the man pages for /live-boot/ and /live-config/. Although the /live-boot/ and /live-config/ packages are installed within the live system you are building, it is recommended that you also install them on your build system for easy reference when you are working on your configuration. It is safe to do so, as none of the scripts contained within them are executed unless the system is configured as a live system. 7.2 STAGES OF THE BUILD ....................... The build process is divided into stages, with various customizations applied in sequence in each. The first stage to run is the *bootstrap* stage. This is the initial phase of populating the chroot directory with packages to make a barebones Debian system. This is followed by the *chroot* stage, which completes the construction of chroot directory, populating it with all of the packages listed in the configuration, along with any other materials. Most customization of content occurs in this stage. The final stage of preparing the live image is the *binary* stage, which builds a bootable image, using the contents of the chroot directory to construct the root filesystem for the Live system, and including the installer and any other additional material on the target media outside of the Live system's filesystem. After the live image is built, if enabled, the source tarball is built in the *source* stage. Within each of these stages, there is a particular sequence in which commands are applied. These are arranged in such a way as to ensure customizations can be layered in a reasonable fashion. For example, within the *chroot* stage, preseeds are applied before any packages are installed, packages are installed before any locally included files or patches are applied, and hooks are run later, after all of the materials are in place. 7.3 SUPPLEMENT LB CONFIG WITH FILES ................................... Although lb config does create a skeletal configuration in the config/ directory, to accomplish your goals, you may need to provide additional files in subdirectories of config/. Depending on where the files are stored in the configuration, they may be copied into the live system's filesystem or into the binary image filesystem, or may provide build-time configurations of the system that would be cumbersome to pass as command-line options. You may include things such as custom lists of packages, custom artwork, or hook scripts to run either at build time or at boot time, boosting the already considerable flexibility of debian-live with code of your own. 7.4 CUSTOMIZATION TASKS ....................... The following chapters are organized by the kinds of customization task users typically perform: Customizing package installation, Customizing contents and Customizing locale and language cover just a few of the things you might want to do. 8. CUSTOMIZING PACKAGE INSTALLATION ----------------------------------- Perhaps the most basic customization of a Debian live system is the selection of packages to be included in the image. This chapter guides you through the various build-time options to customize /live-build/' s installation of packages. The broadest choices influencing which packages are available to install in the image are the distribution and archive areas. To ensure decent download speeds, you should choose a nearby distribution mirror. You can also add your own repositories for backports, experimental or custom packages, or include packages directly as files. You can define your own lists of packages to include, use /live-build/' s predefined lists, use tasksel tasks, or a combination of all three. Finally, a number of options give some control over apt, or if you prefer, aptitude, at build time when packages are installed. You may find these handy if you use a proxy, want to disable installation of recommended packages to save space, or need to control which versions of packages are installed via APT pinning, to name a few possibilities. 8.1 PACKAGE SOURCES ................... 8.1.1 DISTRIBUTION, ARCHIVE AREAS AND MODE .......................................... The distribution you choose has the broadest impact on which packages are available to include in your live image. Specify the codename, which defaults to squeeze for the *Squeeze* version of /live-build/. Any current distribution carried in the Debian archive may be specified by its codename here. (See Terms for more details.) The --distribution option not only influences the source of packages within the archive, but also instructs live-build to behave as needed to build each supported distribution. For example, to build against the *unstable* release, *Sid*, specify: $ lb config --distribution sid Within the distribution archive, archive areas are major divisions of the archive. In Debian, these are main, contrib and non-free. Only main contains software that is official a part of the Debian distribution, hence that is the default. One or more values may be specified, e.g. $ lb config --archive-areas "main contrib" Experimental support is available for some Debian derivatives through a --mode option. By default, this option is set to debian, even if you are building on a non-Debian system. If you specify --mode ubuntu or --mode emdebian, the distribution names and archive areas for the specified derivative are supported instead of the ones for Debian. The mode also modifies /live-build/ behaviour to suit the derivatives. *Note:* The projects for whom these modes were added are primarily responsible for supporting users of these options. The Debian live project, in turn, provides development support on a best-effort basis only, based on feedback from the derivative projects as we do not develop or support these derivatives ourselves. 8.1.2 DISTRIBUTION MIRRORS .......................... The Debian archive is replicated across a large network of mirrors around the world so that people in each region can choose a nearby mirror for best download speed. Each of the --mirror-* options governs which distribution mirror is used at various stages of the build. Recall from Stages of the build that the *bootstrap* stage is when the chroot is initially populated by debootstrap with a minimal system, and the *chroot* stage is when the chroot used to construct the live system's filesystem is built. Thus, the corresponding mirror switches are used for those stages, and later, in the *binary* stage, the --mirror-binary and --mirror-binary-security values are used, superceding any mirrors used in an earlier stage. 8.1.3 DISTRIBUTION MIRRORS USED AT BUILD TIME ............................................. To set the distribution mirrors used at build time to point at a local mirror, it is sufficient to set --mirror-bootstrap and --mirror-chroot-security as follows. $ lb config --mirror-bootstrap http://localhost/debian/ \ --mirror-chroot-security http://localhost/debian-security/ The chroot mirror, specified by --mirror-chroot, defaults to the --mirror-bootstrap value. 8.1.4 DISTRIBUTION MIRRORS USED AT RUN TIME ........................................... The --mirror-binary* options govern the distribution mirrors placed in the binary image. These may be used to install additional packages while running the live system. The defaults employ cdn.debian.net, a service that chooses a geographically close mirror based on the user's IP number. This is a suitable choice when you cannot predict which mirror will be best for all of your users. Or you may specify your own values as shown in the example below. An image built from this configuration would only be suitable for users on a network where "mirror" is reachable. $ lb config --mirror-binary http://mirror/debian/ \ --mirror-binary-security http://mirror/debian-security/ 8.1.5 ADDITIONAL REPOSITORIES ............................. You may add more repositories, broadening your package choices beyond what is available in your target distribution. These may be, for example, for backports, experimental or custom packages. To configure additional repositories, create config/chroot_sources/your-repository.chroot, and/or config/chroot_sources/your-repository.binary files. As with the --mirror-* options, these govern the repositories used in the *chroot* stage when building the image, and in the *binary* stage, i.e. for use when running the live system. For example, config/chroot_sources/live.chroot allows you to install packages from the debian live snapshot repository at live system build time. deb http://live.debian.net/ sid-snapshots main contrib non-free If you add the same line to config/chroot_sources/live.binary, the repository will be added to your live system's /etc/apt/sources.list.d/ directory. If such files exist, they will be picked up automatically. You should also put the GPG key used to sign the repository into config/chroot_sources/your-repository.{binary,chroot}.gpg files. Note: some preconfigured package repositories are available for easy selection through the --repository option, e.g. for enabling live snapshots, a simple command is enough to enable it: $ lb config --repository live.debian.net 8.2 CHOOSING PACKAGES TO INSTALL ................................ There are a number of ways to choose which packages /live-build/ will install in your image, covering a variety of different needs. You can simply name individual packages to install, either with the --packages option for a few packages, or in a package list of your own for larger numbers. You can also choose larger predefined lists of packages, or use APT tasks. And finally, you may place package files in your config/ tree, which is well suited to testing of new or experimental packages before they are available from a repository. 8.2.1 CHOOSING A FEW PACKAGES ............................. When the number of packages added is small, simply specify --packages. For example: $ lb config --packages "package1 package2 package3" The behaviour of /live-build/ when specifying a package that does not exist is determined by your choice of APT utility. See Choosing apt or aptitude for more details. If you need to specify a large number of packages to be installed or you need flexibility regarding which packages to install, use package lists as discussed in the following section, Package lists. 8.2.2 PACKAGE LISTS ................... Package lists are a powerful way of expressing which packages should be installed. The list syntax supports included files and conditional sections which makes it easy to build lists from other lists and adapt them for use in multiple configurations. You can use predefined package lists, providing in a modular fashion package selections from each of the major desktop environments and some special purpose lists, as well as standard lists the others are based upon. You can also provide your own package lists, or use a combination of both. 8.2.3 PREDEFINED PACKAGE LISTS .............................. The simplest way to use lists is to specify one or more predefined lists with the --packages-lists option. For example: $ lb config --packages-lists "gnome-core rescue" In addition to these lists, /live-build/ supports four virtual package lists: gnome-desktop, kde-desktop, lxde-desktop and xfce-desktop, each of which provide a more extensive selection of packages that corresponds with Debian Installer defaults for these desktop environments. See Desktop and language tasks for more details. Note: The prebuilt GNOME, KDE, LXDE and XFCE images available for download at are built using the corresponding virtual *-desktop lists. The default location for the list files on your system is /usr/share/live/build/lists/. To determine the packages in a given list, read the corresponding file, paying attention to included files and conditionals as described in the following sections. 8.2.4 LOCAL PACKAGE LISTS ......................... You may supplement or replace entirely the supplied lists using local package lists stored in config/chroot_local-packageslists/. Package lists that exist in this directory need to have a .list suffix in order to be processed. Local package lists always override package lists distributed with /live-build/. This can cause undesired effects, we therefore recommend to use unique names for local package lists. 8.2.5 LOCAL BINARY PACKAGE LISTS ................................ In case you want to include some required .deb packages to live media's pool/ (without installing them onto the live image) you may need to use lists using binary local package lists stored in config/binary_local-packageslists/. Such media can be used as a customized Debian install image for offline installations. Package lists that exist in this directory need to have a .list suffix in order to be processed. 8.2.6 EXTENDING A PROVIDED PACKAGE LIST USING INCLUDES ...................................................... The package lists that are included with /live-build/ make extensive use of includes. Refer to these in the /usr/share/live/build/lists/ directory, as they serve as good examples of how to write your own lists. For example, to make a list that includes the predefined gnome list plus iceweasel, create config/chroot_local-packageslists/mygnome.list with the following contents: #include iceweasel 8.2.7 USING CONDITIONALS INSIDE PACKAGE LISTS ............................................. Any of the /live-build/ configuration variables stored in config/* (minus the LB_ prefix) may be used in conditional statements in package lists. Generally, this means any lb config option uppercased and with dashes changed to underscores. But in practice, it is only the ones that influence package selection that make sense, such as DISTRIBUTION, ARCHITECTURE or ARCHIVE_AREAS. For example, to install ia32-libs if the --architecture amd64 is specified: #if ARCHITECTURE amd64 ia32-libs #endif You may test for any one of a number of values, e.g. to install memtest86+ if either --architecture i386 or --architecture amd64 is specified: #if ARCHITECTURE i386 amd64 memtest86+ #endif You may also test against variables that may contain more than one value, e.g. to install vrms if either contrib or non-free is specified via --archive-areas: #if ARCHIVE_AREAS contrib non-free vrms #endif A conditional may surround an #include directive: #if ARCHITECTURE amd64 #include #endif The nesting of conditionals is not supported. 8.2.8 TASKS ........... The Debian Installer offers the user choices of a number of preselected lists of packages, each one focused on a particular kind of system, or task a system may be used for, such as "Graphical desktop environment", "Mail server" or "Laptop". These lists are called "tasks" and are supported by APT through the "Task:" field. You can specify one or more tasks in /live-build/ via the --tasks option, as in the example below. $ lb config --tasks "mail-server file-server" The primary tasks available in the Debian Installer can be listed with tasksel --list-tasks in the live system. The contents of any task, including ones not included in this list, may be examined with tasksel --task-packages. 8.2.9 DESKTOP AND LANGUAGE TASKS ................................ Desktop and language tasks are special cases. In the Debian Installer, if the medium was prepared for a particular desktop environment flavour, the corresponding task will be automatically installed. Thus, there are gnome-desktop, kde-desktop, lxde-desktop and xfce-desktop tasks, none of which are offered in tasksel's menu. Likewise, there are no menu entries for tasks for languages, but the user's language choice during the install influences the selection of corresponding language tasks. In /live-build/, therefore, these special cases are also given special consideration, but with three notable differences at the time of writing. First, there is no provision made yet automatically for language tasks, although a subset of those packages are included if you specify lb config --language. If you need those tasks, which include such things as language-specific fonts and input-method packages, you need to specify them in your configuration. For example: $ lb config --tasks "japanese japanese-desktop japanese-gnome-desktop" Second, /live-build/ supports *-desktop virtual package lists for each of the desktop flavours mentioned above, which select the standard-x11 predefined package list, the corresponding *-desktop task and three additional tasks: desktop, standard and laptop. So, for example, if you specify --packages-lists gnome-desktop, it is equivalent to specifying --packages /debian-installer-launcher/ --packages-lists standard-x11 --tasks "gnome-desktop desktop standard laptop". Third, if any of the tasks for these desktop flavours are selected, either explicitly through --tasks or implicitly by --packages-lists, /live-build/ will preseed the corresponding desktop value for Debian Installer (if it is included) to ensure it follows its own rules for installing different desktop flavours. *Note:* There is also an experimental --language option that has an overlapping purpose with language tasks. For any language for which it is known that there are *-l10n packages, if --language is specified, those packages will be installed. Furthermore, if any syslinux templates matching the language are found, they will be used instead of the default English templates. The package selection done by --language is a poor approximation of language tasks, as it requires that the list of packages to include per language be maintained internally in /live-build/, and besides, language tasks are more comprehensive and flexible. However, the syslinux aspect is still useful. Thus, if you use --bootloader syslinux and templates for the specified language exist either in /usr/share/live/build/templates/syslinux/ or config/templates/syslinux/, consider using this option, possibly in combination with tasks to ensure all relevant packages are installed. For example: $ lb config --language es Even so, it is limited in that it only supports a single language and a single bootloader. Therefore, for all of these reasons, the future of this option is under review, possibly to be replaced with something entirely different in the next major release of /live-build/. 8.3 INSTALLING MODIFIED OR THIRD-PARTY PACKAGES ............................................... Whilst it is against the philosophy of Debian Live, it may sometimes be necessary to build a Live system with modified versions of packages that are in the Debian repository. This may be to modify or support additional features, languages and branding, or even to remove elements of existing packages that are undesirable. Similarly, "third-party" packages may be used to add bespoke and/or proprietary functionality. This section does not cover advice regarding building or maintaining modified packages. Joachim Breitner's 'How to fork privately' method from may be of interest, however. The creation of bespoke packages is covered in the Debian New Maintainers' Guide at and elsewhere. There are two ways of installing modified custom packages: * chroot_local-packages * Using a custom APT repository Using chroot_local-packages is simpler to achieve and useful for "one-off" customizations but has a number of drawbacks, whilst using a custom APT repository is more time-consuming to set up. 8.3.1 USING CHROOT_LOCAL-PACKAGES TO INSTALL CUSTOM PACKAGES ............................................................ To install a custom package, simply copy it to the config/chroot_local-packages/ directory. Packages that are inside this directory will be automatically installed into the live system during build - you do not need to specify them elsewhere. Packages *must* be named in the prescribed way. One simple way to do this is to use dpkg-name. Using chroot_local-packages for installation of custom packages has disadvantages: * It is not possible to use secure APT. * You must install all appropriate packages in the config/chroot_local-packages/ directory. * It does not lend itself to storing Debian Live configurations in revision control. 8.3.2 USING AN APT REPOSITORY TO INSTALL CUSTOM PACKAGES ........................................................ Unlike using chroot_local-packages, when using a custom APT repository you must ensure that you specify the packages elsewhere. See Choosing packages to install for details. Whilst it may seem unnecessary effort to create an APT repository to install custom packages, the infrastructure can be easily re-used at a later date to offer updates of the modified packages. 8.3.3 CUSTOM PACKAGES AND APT ............................. /live-build/ uses APT to install all packages into the live system so will therefore inherit behaviours from this program. One relevant example is that (assuming a default configuration) given a package available in two different repositories with different version numbers, APT will elect to install the package with the higher version number. Because of this, you may wish to increment the version number in your custom packages' debian/changelog files to ensure that your modified version is installed over one in the official Debian repositories. This may also be achieved by altering the live system's APT pinning preferences - see APT pinning for more information. 8.4 CONFIGURING APT AT BUILD TIME ................................. You can configure APT through a number of options applied only at build time. (APT configuration used in the running live system may be configured in the normal way for live system contents, that is, by including the appropriate configurations through config/chroot_local_includes/.) For a complete list, look for options starting with apt in the lb_config man page. 8.4.1 CHOOSING APT OR APTITUDE .............................. You can elect to use either apt or aptitude when installing packages at build time. Which utility is used is governed by the --apt argument to lb config. Choose the method implementing the preferred behaviour for package installation, the notable difference being how missing packages are handled. * apt: With this method, if a missing package is specified, the package installation will fail. This is the default setting. * aptitude: With this method, if a missing package is specified, the package installation will succeed. 8.4.2 USING A PROXY WITH APT ............................ One commonly required APT configuration is to deal with building an image behind a proxy. You may specify your APT proxy with the --apt-ftp-proxy or --apt-http-proxy options as needed, e.g. $ lb config --apt-http-proxy http://proxy/ 8.4.3 TWEAKING APT TO SAVE SPACE ................................ You may find yourself needing to save some space on the image media, in which case one or the other or both of the following options may be of interest. If you don't want to include APT indices in the image, you can omit those with: $ lb config --binary-indices false This will not influence the entries in /etc/apt/sources.list, but merely whether /var/lib/apt contains the indices files or not. The tradeoff is that APT needs those indices in order to operate in the live system, so before performing apt-cache search or apt-get install, for instance, the user must apt-get update first to create those indices. If you find the installation of recommended packages bloats your image too much, you may disable that default option of APT with: $ lb config --apt-recommends false The tradeoff here is that if you don't install recommended packages for a given package, that is, "packages that would be found together with this one in all but unusual installations" (Debian Policy Manual, section 7.2), some packages that you actually need may be omitted. Therefore, we suggest you review the difference turning off recommends makes to your packages list (see the binary.packages file generated by lb build) and re-include in your list any missing packages that you still want installed. Alternatively, if you find you only want a small number of recommended packages left out, leave recommends enabled and set a negative APT pin priority on selected packages to prevent them from being installed, as explained in APT pinning. 8.4.4 PASSING OPTIONS TO APT OR APTITUDE ........................................ If there is not an lb config option to alter APT's behaviour in the way you need, use --apt-options or --aptitude-options to pass any options through to your configured APT tool. See the man pages for apt and aptitude for details. 8.4.5 APT PINNING ................. For background, please first read the apt_preferences(5) man page. APT pinning can be configured either for build time, or else for run time. For the former, create config/chroot_apt/preferences. For the latter, create config/chroot_local-includes/etc/apt/preferences. Let's say you are building a *Squeeze* live system but need all live-* packages to be installed from *Sid* at build time. You need to add *Sid* to your APT sources and pin it so that only the packages you want are installed from it at build time and all others are taken from the target system distribution, *Squeeze*. The following will accomplish this: $ echo "deb http://mirror/debian sid main" > config/chroot_sources/sid.chroot $ cat >>config/chroot_apt/preferences <se To get the locale files for German and Swiss German keyboard layout in X use: $ lb config --bootappend-live "locales=de_CH.UTF-8 keyboard-layouts=ch" A list of the valid values of the keyboards for the console can be figured with the following command: $ for i in $(find /usr/share/keymaps/ -iname "*kmap.gz"); \ do basename $i | head -c -9; echo; done | sort | less Alternatively, you can use the console-setup package, a tool to let you configure console layout using X (XKB) definitions; you can then set your keyboard layout more precisely with keyboard-layouts, keyboard-variant, keyboard-options and keyboard-model variables; /live-boot/ will use also these parameters for X configuration. For example, to set up a French system with a French-Dvorak layout (called Bepo) on a TypeMatrix keyboard, both in console and X11, use: $ lb config --bootappend-live \ "locales=fr_FR.UTF-8 keyboard-layouts=fr keyboard-variant=bepo keyboard-model=tm2030usb" 10.3 PERSISTENCE ................ A live cd paradigm is a pre-installed system which runs from read-only media, like a cdrom, where writes and modifications do not survive reboots of the host hardware which runs it. A Debian Live system is a generalization of this paradigm and thus supports other media in addition to CDs; but still, in its default behaviour, it should be considered read-only and all the run-time evolutions of the system are lost at shutdown. Persistence is a common name for different kinds of solutions for saving across reboots some, or all, of this run-time evolution of the system. To understand how it could work it could be handy to know that even if the system is booted and run from read-only media, modification to the files and directories are written on writable media, typically a ram disk (tmpfs) and ram disks' data do not survive reboots. The data stored on this ramdisk should be saved on a writable persistent medium like a Hard Disk, a USB key, a network share or even a session of a multisession (re)writable CD/DVD. All these media are supported in Debian Live in different ways, and all but the last one require a special boot parameter to be specified at boot time: persistent. 10.3.1 FULL PERSISTENCE ....................... By 'full persistence' it is meant that instead of using a tmpfs for storing modifications to the read-only media (with the copy-on-write, COW, system) a writable partition is used. In order to use this feature a partition with a clean writable supported filesystem on it labeled "live-rw" must be attached on the system at boot time and the system must be started with the boot parameter 'persistent'. This partition could be an ext2 partition on the hard disk or on a usb key created with, e.g.: # mkfs.ext2 -L live-rw /dev/sdb1 If you already have a partition on your device, you could just change the label with one of the following: # tune2fs -L live-rw /dev/sdb1 # for ext2,3,4 filesystems # dosfslabel /dev/sdb1 live-rw # for a fat filesystem But since live system users cannot always use a hard drive partition, and considering that most USB keys have poor write speeds, 'full' persistence could be also used with just image files, so you could create a file representing a partition and put this image file even on a NTFS partition of a foreign OS, with something like: $ dd if=/dev/null of=live-rw bs=1G seek=1 # for a 1GB sized image file $ /sbin/mkfs.ext2 -F live-rw Then copy the live-rw file to a writable partition and reboot with the boot parameter 'persistent'. 10.3.2 HOME AUTOMOUNTING ........................ If during the boot a partition (filesystem) image file or a partition labeled home-rw is discovered, this filesystem will be directly mounted as /home, thus permitting persistence of files that belong to e.g. the default user. It can be combined with full persistence. 10.3.3 SNAPSHOTS ................ Snapshots are collections of files and directories which are not mounted while running but which are copied from a persistent device to the system (tmpfs) at boot and which are resynced at reboot/shutdown of the system. The content of a snapshot could reside on a partition or an image file (like the above mentioned types) labeled live-sn, but it defaults to a simple cpio archive named live-sn.cpio.gz. As above, at boot time, the block devices connected to the system are traversed to see if a partition or a file named like that could be found. A power interruption during run time could lead to data loss, hence a tool invoked live-snapshot --refresh could be called to sync important changes. This type of persistence, since it does not write continuously to the persistent media, is the most flash-based device friendly and the fastest of all the persistence systems. A /home version of snapshot exists too and its label is home-sn.*; it works the same as the main snapshot but it is only applied to /home. Snapshots cannot currently handle file deletion but full persistence and home automounting can. 10.3.4 PERSISTENT SUBTEXT ......................... If a user would need multiple persistent storage of the same type for different locations or testing, such as live-rw-nonwork and live-rw-work, the boot parameter persistent-subtext used in conjuntion with the boot parameter persistent will allow for multiple but unique persistent media. An example would be if a user wanted to use a persistent partition labeled live-sn-subText they would use the boot parameters of: persistent persistent-subtext=subText. 10.3.5 PARTIAL REMASTERING .......................... The run-time modification of the tmpfs could be collected using live-snapshot in a squashfs and added to the cd by remastering the iso in the case of cd-r or adding a session to multisession cd/dvd(rw); /live-boot/ mounts all /live filesystem in order or with the module boot parameter. 11. CUSTOMIZING THE BINARY IMAGE -------------------------------- 11.1 BOOTLOADER ............... /live-build/ uses syslinux as bootloader by default, which is by default configured to pause indefinitely at its splash screen. To adjust this, you can pass --syslinux-timeout TIMEOUT to lb config. The value is specified in units of seconds. A timeout of 0 (zero) disables the timeout completely. For more information please see syslinux(1). 11.2 ISO METADATA ................. When creating an ISO9660 binary image, you can use the following options to add various textual metadata for your image. This can help you easily identify the version or configuration of an image without booting it. * LB_ISO_APPLICATION/--iso-application NAME: This should describe the application that will be on the image. The maximum length for this field is 128 characters. * LB_ISO_PREPARER/--iso-preparer NAME: This should describe the preparer of the image, usually with some contact details. The default for this option is the /live-build/ version you are using, which may help with debugging later. The maximum length for this field is 128 characters. * LB_ISO_PUBLISHER/--iso-publisher NAME: This should describe the publisher of the image, usually with some contact details. The maximum length for this field is 128 characters. * LB_ISO_VOLUME/--iso-volume NAME: This should specify the volume ID of the image. This is used as a user-visible label on some platforms such as Windows and Apple Mac OS. The maximum length for this field is 32 characters. 12. CUSTOMIZING DEBIAN INSTALLER -------------------------------- Debian Live system images can be integrated with Debian Installer. There are a number of different types of installation, varying in what is included and how the installer operates. Please note the careful use of capital letters when referring to the "Debian Installer" in this section - when used like this we refer explicitly to the official installer for the Debian system, not anything else. It is often seen abbreviated to "d-i". 12.1 TYPES OF DEBIAN INSTALLER .............................. The three main types of installer are: *"Regular" Debian Installer*: This is a normal Debian Live image with a seperate kernel and initrd which (when selected from the appropriate bootloader) launches into a standard Debian Installer instance, just as if you had downloaded a CD image of Debian and booted it. Images containing a live system and such an otherwise independent installer are often referred to as "combined images". On such images, Debian is installed by fetching and installing .deb packages using debootstrap or cdebootstrap, from the local media or some network-based network, resulting in a standard Debian system being installed to the hard disk. This whole process can be preseeded and customized in a number of ways; see the relevant pages in the Debian Installer manual for more information. Once you have a working preseeding file, /live-build/ can automatically put it in the image and enable it for you. *"Live" Debian Installer*: This is a Debian Live image with a separate kernel and initrd which (when selected from the appropriate bootloader) launches into an instance of the Debian Installer. Installation will proceed in an identical fashion to the "Regular" installation described above, but at the actual package installation stage, instead of using debootstrap to fetch and install packages, the live filesystem image is copied to the target. This is achieved with a special udeb called /live-installer/. After this stage, the Debian Installer continues as normal, installing and configuring items such as bootloaders and local users, etc. Note: to support both normal and live installer entries in the bootloader of the same live media, you must disable /live-installer/ by preseeding #{live-installer/enable=false}. *"Desktop" Debian Installer*: Regardless of the type of Debian Installer included, d-i can be launched from the Desktop by clicking on an icon. This is user friendlier in some situations. In order to make use of this, the /debian-installer-launcher/ package needs to be included. Note that by default, /live-build/ does not include Debian Installer images in the images, it needs to be specifically enabled with lb config. Also, please note that for the "Desktop" installer to work, the kernel of the live system must match the kernel d-i uses for the specified architecture. For example: $ lb config --architecture i386 --linux-flavours 486 \ --debian-installer live --packages debian-installer-launcher 12.2 CUSTOMIZING DEBIAN INSTALLER BY PRESEEDING ............................................... As described in the Debian Installer Manual, Appendix B at , "Preseeding provides a way to set answers to questions asked during the installation process, without having to manually enter the answers while the installation is running. This makes it possible to fully automate most types of installation and even offers some features not available during normal installations." This kind of customization is best accomplished with /live-build/ by placing the configuration in a preseed.cfg file included in config/binary_debian-installer/. For example, to preseed setting the locale to en_US: $ echo "d-i debian-installer/locale string en_US" \ >> config/binary_debian-installer/preseed.cfg 12.3 CUSTOMIZING DEBIAN INSTALLER CONTENT ......................................... For experimental or debugging purposes, you might want to include locally built d-i component udeb packages. Place these in config/binary_local-udebs/ to include them in the image. Additional or replacement files and directories may be included in the installer initrd as well, in a similar fashion to Live/chroot local includes, by placing the material in config/binary_debian-installer-includes/. PROJECT ======= 13. REPORTING BUGS ------------------ Debian Live is far from being perfect, but we want to make it as close as possible to perfect - with your help. Do not hesitate to report a bug: it is better to fill a report twice than never. However, this chapter includes recommendations how to file good bug reports. For the impatient: * Always check first the image status updates on our homepage at for known issues. * Always try to reproduce the bug with the *most recent versions* of /live-build/, /live-boot/, and /live-config/ before submitting a bug report. * Try to give *as specific information as possible* about the bug. This includes (at least) the version of /live-build/, /live-boot/, and /live-config/ used and the distribution of the live system you are building. 13.1 KNOWN ISSUES ................. Because Debian *testing* and Debian *unstable* distributions are a moving target, when you specify either as the target system distribution, a successful build may not always be possible. If this causes too much difficulty for you, do not build a system based on *testing* or *unstable*, but rather, use *stable*. /live-build/ does always default to the *stable* release. Currently known issues are listed under the section 'status' on our homepage at . It is out of the scope of this manual to train you to correctly identify and fix problems in packages of the development distributions, however, there are two things you can always try: If a build fails when the target distribution is *testing*, try *unstable*. If *unstable* does not work either, revert to *testing* and pin the newer version of the failing package from *unstable* (see APT pinning for details). 13.2 REBUILD FROM SCRATCH ......................... To ensure that a particular bug is not caused by an uncleanly built system, please always rebuild the whole live system from scratch to see if the bug is reproducible. 13.3 USE UP-TO-DATE PACKAGES ............................ Using outdated packages can cause significant problems when trying to reproduce (and ultimately fix) your problem. Make sure your build system is up-to-date and any packages included in your image are up-to-date as well. 13.4 COLLECT INFORMATION ........................ Please provide enough information with your report. At least include the exact version of /live-build/ version where the bug is encountered and steps to reproduce it. Please use common sense and include other relevant information if you think that it might help in solving the problem. To make the most out of your bug report, we require at least the following information: * Architecture of the host system * Version of /live-build/ on the host system * Version of /live-boot/ on the live system * Version of /live-config/ on the live system * Version of debootstrap and/or cdebootstrap on the host system * Architecture of the live system * Distribution of the live system * Version of the kernel on the live system You can generate a log of the build process by using the tee command. We recommend doing this automatically with an auto/build script; (see Managing a configuration for details). # lb build 2>&1 | tee build.log At boot time, /live-boot/ stores a log in /var/log/live.log (or /var/log/live-boot.log). Additionally, to rule out other errors, it is always a good idea to tar up your config/ directory and upload it somewhere (do *not* send it as an attachment to the mailing list), so that we can try to reproduce the errors you encountered. If this is difficult (e.g. due to size) you can use the output of lb config --dump which produces a summary of your config tree (i.e. lists files in subdirectories of config/ but does not include them). Remember to send in any logs that were produced with English locale settings, e.g. run your /live-build/ commands with a leading LC_ALL=C or LC_ALL=en_US. 13.5 ISOLATE THE FAILING CASE IF POSSIBLE ......................................... If possible, isolate the failing case to the smallest possible change that breaks. It is not always easy to do this, so if you can't manage it for your report, don't worry. However, if you plan your development cycle well, using small enough change sets per iteration, you may be able to isolate the problem by constructing a simpler 'base' configuration that closely matches your actual configuration plus just the broken change set added to it. If you have a hard time sorting out which of your changes broke, it may be that you are including too much in each change set and should develop in smaller increments. 13.6 USE THE CORRECT PACKAGE TO REPORT THE BUG AGAINST ...................................................... Where does the bug appear? 13.6.1 AT BUILD TIME WHILST BOOTSTRAPPING ......................................... /live-build/ first bootstraps a basic Debian system with debootstrap or cdebootstrap. Depending on the bootstrapping tool used and the Debian distribution it is bootstrapping, it may fail. If a bug appears here, check if the error is related to a specific Debian package (most likely), or if it is related to bootstrapping tool itself. In both cases, this is not a bug in Debian Live, but rather in Debian itself which we can not fix this directly. Please report such a bug against the bootstrapping tool or the failing package. 13.6.2 AT BUILD TIME WHILST INSTALLING PACKAGES ............................................... /live-build/ installs additional packages from the Debian archive and depending on the Debian distribution used and the daily archive state, it can fail. If a bug appears here, check if the error is also reproducible on a normal system. If this is the case, this is not a bug in Debian Live, but rather in Debian - please report it against the failing package. Running debootstrap separately from the Live system build or running lb bootstrap --debug will give you more information. Also, if you are using a local mirror and/or any of sort of proxy and you are experiencing a problem, please always reproduce it first by bootstrapping from an official mirror. 13.6.3 AT BOOT TIME ................... If your image does not boot, please report it to the mailing list together with the information requested in Collect information. Do not forget to mention, how/when the image failed, in Qemu, Virtualbox, VMWare or real hardware. If you are using a virtualization technology of any kind, please always run it on real hardware before reporting a bug. Providing a screenshot of the failure is also very helpful. 13.6.4 AT RUN TIME .................. If a package was successfully installed, but fails while actually running the Live system, this is probably a bug in Debian Live. However, 13.7 DO THE RESEARCH .................... Before filing the bug, please search the web for the particular error message or symptom you are getting. As it is highly unlikely that you are the only person experiencing a particular problem, there is always a chance that it has been discussed elsewhere, and a possible solution, patch, or workaround has been proposed. You should pay particular attention to the Debian Live mailing list, as well as the homepage, as these are likely to contain the most up-to-date information. If such information exists, always include the references to it in your bug report. In addition, you should check the current bug lists for /live-build/, /live-boot/, and /live-config/ to see whether something similar has been reported already. 13.8 WHERE TO REPORT BUGS ......................... The Debian Live project keeps track of all bugs in the Debian Bug Tracking System (BTS). For information on how to use the system, please see . You can also submit the bugs by using the reportbug command from the package with the same name. In general, you should report build time errors against the /live-build/ package, boot time errors against /live-boot/, and run time errors against /live-config/. If you are unsure of which package is appropriate or need more help before submitting a bug report, please send a message to the mailing list and we will help you to figure it out. Please note that bugs found in distributions derived from Debian (such as Ubuntu and others) should *not* be reported to the Debian BTS unless they can be also reproduced on a Debian system using official Debian packages. 14. CODING STYLE ---------------- This chapter documents the coding style used in /live-boot/ and others. 14.1 COMPATIBILITY .................. * Don't use syntax or semantics that are unique to the Bash shell. For example, the use of array constructs. * Only use the POSIX subset - for example, use $(foo) over `foo`. * You can check your scripts with 'sh -n' and 'checkbashisms'. 14.2 INDENTING .............. * Always use tabs over spaces. 14.3 WRAPPING ............. * Generally, lines are 80 chars at maximum. * Use the "Linux style" of line breaks: Bad: if foo; then bar fi Good: if foo then bar fi * The same holds for functions: Bad: foo () { bar } Good: foo () { bar } 14.4 VARIABLES .............. * Variables are always in capital letters. * Variables that used in lb config always start with LB_ prefix. * Internal temporary variables in /live-build/ should start with the _LB_ prefix. * Local variables start with /live-build/ __LB_ prefix. * Variables in connection to a boot parameter in /live-config/ start with LIVE_. * All other variables in /live-config/ start with _ prefix. * Use braces around variables; e.g. write ${FOO} instead of $FOO. * Always protect variables with quotes to respect potential whitespaces: write "${FOO}" not ${FOO}. * For consistency reasons, always use quotes when assigning values to variables: Bad: FOO=bar Good: FOO="bar" * If multiple variables are used, quote the full expression: Bad: if [ -f "${FOO}"/foo/"${BAR}"/bar ] then foobar fi Good: if [ -f "${FOO}/foo/${BAR}/bar" ] then foobar fi 14.5 MISCELLANEOUS .................. * Use "|" (without the surround quotes) as a seperator in calls to sed, e.g. "sed -e 's|foo|bar|'" (without ""). * Don't use the test command for comparisons or tests, use "[" "]" (without ""); e.g. "if [ -x /bin/foo ]; ..." and not "if test -x /bin/foo; ...". * Use case wherever possible over test, as it's easier to read and faster in execution. 15. PROCEDURES -------------- This chapter documents the procedures within the Debian Live project for various tasks that need cooperation with other teams in Debian. 15.1 UDEB UPLOADS ................. Before commiting releases of a udeb in d-i svn, one has to call: $ ../../scripts/l10n/output-l10n-changes . -d 15.2 MAJOR RELEASES ................... Releasing a new stable major version of Debian includes a lot of different teams working together to make it happen. At some point, the Live team comes in and builds live system images. The requirements to do this are: * A mirror containing the released versions for the debian, debian-security and debian-volatile archive which the debian-live buildd can access. * The names of the image need to be known (e.g. debian-live-VERSION-ARCH-FLAVOUR.iso). * The packagelists need to have been updated. * The data from debian-cd needs to be synced (udeb exclude lists). * The includes from debian-cd needs to be synced (README.*, doc/*, etc.). * Images are built and mirrored on cdimage.debian.org. 15.3 POINT RELEASES ................... * Again, we need updated mirror of debian, debian-security and debian-volatile. * Images are built and mirrored on cdimage.debian.org. * Send announcement mail. 15.3.1 POINT RELEASE ANNOUNCEMENT TEMPLATE .......................................... An annoucement mail for point releases can be generated using the template below and the following command: $ sed \ -e 's|%major%|5.0|g' \ -e 's|%minor%|5.0.2|g' \ -e 's|%codename%|lenny|g' \ -e 's|%release_mail%|2009/msg00007.html|g' Please check the mail carefully before sending and pass it to others for proof-reading. Debian Live images for Debian GNU/Linux %major% updated The Debian Live project is pleased to announce the availability of updated Live images for its stable distribution Debian GNU/Linux %major% (codename "%codename%"). The images are available for download at: This update incorporates the changes made in the %minor% point release, which adds corrections for security problems to the stable release along with a few adjustments for serious problems. A full list of the changes may be viewed at: It also includes the following Live-specific changes: * [INSERT LIVE-SPECIFIC CHANGE HERE] * [INSERT LIVE-SPECIFIC CHANGE HERE] * [LARGER ISSUES MAY DESERVE THEIR OWN SECTION] URLs ---- Download location of updated images: Debian Live Projekt Homepage: The current stable distribution: stable distribution information (release notes, errata etc.): Security announcements and information: About Debian ------------- The Debian Project is an association of Free Software developers who volunteer their time and effort in order to produce the completely free operating system Debian GNU/Linux. About Debian Live ----------------- Debian Live is an official sub-project of Debian which produces Debian systems that do not require a classical installer. Images are available for CD/DVD discs, USB sticks and PXE netbooting as well as a bare filesystem images for booting directly from the internet. Contact Information ------------------- For further information, please visit the Debian Live web pages at or alternatively send mail to . EXAMPLES ======== 16. EXAMPLES ------------ This chapter covers example builds for specific use cases with Debian Live. If you are new to building your own Debian Live images, we recommend you first look at the three tutorials in sequence, as each one teaches new techniques that will help you use and understand the remaining examples. 16.1 USING THE EXAMPLES ....................... To use these examples you need a system to build them on that meets the requirements listed in Requirements and has /live-build/ installed as described in Installing live-build. Note that, for the sake of brevity, in these examples we do not specify a local mirror to use for the build. You can speed up downloads considerably if you use a local mirror. You may specify the options when you use lb config, as described in Distribution mirrors used at build time, or for more convenience, set the default for your build system in /etc/live/build.conf. Simply create this file and in it, set the corresponding LB_MIRROR_* variables to your preferred mirror. For example: LB_MIRROR_BOOTSTRAP="http://mirror/debian" LB_MIRROR_CHROOT="http://mirror/debian" LB_MIRROR_CHROOT_SECURITY="http://mirror/debian-security" 16.2 TUTORIAL 1: A STANDARD IMAGE ................................. *Use case:* Create a simple first image, learning the basics of /live-build/. In this tutorial, we will build a default ISO hybrid Debian Live image containing only base packages (no Xorg) and some Debian Live support packages, as a first exercise in using /live-build/. You can't get much simpler than this: $ mkdir tutorial1 ; cd tutorial1 ; lb config Examine the contents of the config/ directory if you wish. You will see stored here a skeletal configuration, ready to customize or, in this case, use immediately to build a default image. Now, as superuser, build the image, saving a log as you build with tee. # lb build 2>&1 | tee binary.log Assuming all goes well, after a while, the current directory will contain binary-hybrid.iso. This ISO hybrid image can be booted directly in a virtual machine as described in Testing an ISO image with Qemu and Testing an ISO image with virtualbox-ose, or else imaged onto optical media or a USB flash device as described in Burning an ISO image to a physical medium and Copying USB/HDD image to a USB stick, respectively. 16.3 TUTORIAL 2: A WEB BROWSER UTILITY ...................................... *Use case:* Create a web browser utility image, learning how to apply customizations. In this tutorial, we will create an image suitable for use as a web browser utility, serving as an introduction to customizing Debian Live images. $ mkdir tutorial2 ; cd tutorial2 ; lb config -p lxde --packages iceweasel Our choice of LXDE for this example reflects our desire to provide a minimal desktop environment, since the focus of the image is the single use we have in mind, the web browser. We could go even further and provide a default configuration for the web browser in config/chroot_local-includes/etc/iceweasel/profile/, or additional support packages for viewing various kinds of web content, but we leave this as an exercise for the reader. Build the image, again as superuser, keeping a log as in Tutorial 1: # lb build 2>&1 | tee binary.log Again, verify the image is OK and test, as in Tutorial 1. 16.4 TUTORIAL 3: A PERSONALIZED IMAGE ..................................... *Use case:* Create a project to build a personalized image, containing your favourite software to take with you on a USB stick wherever you go, and evolving in successive revisions as your needs and preferences change. Since we will be changing our personalized image over a number of revisions, and we want to track those changes, trying things experimentally and possibly reverting them if things don't work out, we will keep our configuration in the popular git version control system. We will also use the best practice of autoconfiguration via auto scripts as described in Managing a configuration. 16.4.1 FIRST REVISION ..................... $ mkdir -p tutorial3/auto $ cp /usr/share/live/build/examples/auto/* tutorial3/auto/ $ cd tutorial3 Edit auto/config to read as follows: #!/bin/sh lb config noauto \ --architecture i386 \ --linux-flavours 686 \ --packages-lists lxde \ --packages "iceweasel xchat" \ "${@}" First, --architecture i386 ensures that on our amd64 build system, we build a 32-bit version suitable for use on most machines. Second, we use --linux-flavours 686 because we don't anticipate using this image on much older systems. Third, we've chosen the lxde package list to give us a minimal desktop. And finally, we have added two initial favourite packages: iceweasel and xchat. Now, build the image: # lb build Note that unlike in the first two tutorials, we no longer have to type 2>&1 | tee binary.log as that is now included in auto/build. Once you've tested the image (as in Tutorial 1) and are satisfied it works, it's time to initialize our git repository, adding only the auto scripts we just created, and then make the first commit: $ git init $ git add auto $ git commit -a -m "Initial import." 16.4.2 SECOND REVISION ...................... In this revision, we're going to clean up from the first build, add the vlc package to our configuration, rebuild, test and commit. The lb clean command will clean up all generated files from the previous build except for the cache, which saves having to re-download packages. This ensures that the subsequent lb build will re-run all stages to regenerate the files from our new configuration. # lb clean Now edit auto/config to add the vlc package: #!/bin/sh lb config noauto \ --architecture i386 \ --linux-flavours 686 \ --packages-lists lxde \ --packages "iceweasel xchat vlc" \ "${@}" Build again: # lb build Test, and when you're satisfied, commit the next revision: $ git commit -a -m "Adding vlc media player." Of course, more complicated changes to the configuration are possible, perhaps adding files in subdirectories of config/. When you commit new revisions, just take care not to hand edit or commit the top-level files in config containing LB_* variables, as these are build products, too, and are always cleaned up by lb clean and re-created with lb config via their respective auto scripts. We've come to the end of our tutorial series. While many more kinds of customization are possible, even just using the few features explored in these simple examples, an almost infinite variety of different images can be created. The remaining examples in this section cover several other use cases drawn from the collected experiences of users of Debian Live. 16.5 A VNC KIOSK CLIENT ....................... *Use case:* Create an image with /live-build/ to boot directly to a VNC server. Make a build directory and create a skeletal configuration in it built around the standard-x11 list, including gdm3, metacity and xtightvncviewer, disabling recommends to make a minimal system: $ mkdir vnc_kiosk_client $ cd vnc_kiosk_client $ lb config -a i386 -k 686 -p standard-x11 \ --packages "gdm3 metacity xvnc4viewer" \ --apt-recommends false Create the directory /etc/skel and put a custom .xsession in it for the default user that will launch metacity and start xvncviewer, connecting to port 5901 on a server at 192.168.1.2: $ mkdir -p config/chroot_local-includes/etc/skel $ cat >config/chroot_local-includes/etc/skel/.xsession <&1 | tee binary.log On the author's system at time of writing, the above configuration produced a 78Mbyte image. This compares favourably with the 166Mbyte image produced by the default configuration in Tutorial 1. The biggest space-saver here, compared to building a standard image on an i386 architecture system, is to select only the 486 kernel flavour instead of the default -k "486 686". Leaving off APT's indices with --binary-indices false also saves a fair amount of space, the tradeoff being that you need to apt-get update before using apt in the live system. Choosing the minimal package list leaves out the large locales package and associated utilities. Dropping recommended packages with --apt-recommends false saves some additional space, at the expense of omitting some packages you might otherwise expect to be there, such as firmware-linux-free which may be needed to support certain hardware. The remaining options shave off additional small amounts of space. It's up to you to decide if the functionality that is sacrificed with each optimization is worth the loss in functionality. 16.7 A LOCALIZED KDE DESKTOP AND INSTALLER .......................................... *Use case:* Create a KDE desktop image, localized for Brazilian Portuguese and including an installer. We want to make an iso-hybrid image for i386 architecture using our preferred desktop, in this case KDE, containing all of the same packages that would be installed by the standard Debian installer for KDE. Our initial problem is the discovery of the names of the appropriate tasks. Currently, /live-build/ cannot help with this. While we might get lucky and find this by trial-and-error, there is a tool, grep-dctrl, which can be used to dig it out of the task descriptions in tasksel-data, so to prepare, make sure you have both of those things: # apt-get install dctrl-tools tasksel-data Now we can search for the appropriate tasks, first with: $ grep-dctrl -FTest-lang pt_BR /usr/share/tasksel/debian-tasks.desc -sTask,Description Task: brazilian-portuguese Description: Brazilian Portuguese environment This task installs programs, data files, and documentation that make it easier for Brazilian Portuguese speakers to use Debian. By this command, we discover the task is called, plainly enough, brazilian-portuguese. Now to find the related tasks: $ grep-dctrl -FEnhances brazilian-portuguese /usr/share/tasksel/debian-tasks.desc -sTask,Description Task: brazilian-portuguese-desktop Description: Brazilian Portuguese desktop This task localises the desktop in Brasilian Portuguese. Task: brazilian-portuguese-kde-desktop Description: Brazilian Portuguese KDE desktop This task localises the KDE desktop in Brazilian Portuguese. We will use the experimental --language option, as /live-build/ happens to include syslinux templates for pt_BR (see Desktop and language tasks for details). And at boot time we will generate the pt_BR.UTF-8 locale and select the pt-latin1 keyboard layout. Now let's put the pieces together: $ mkdir live-pt_BR-kde $ cd live-pt_BR-kde $ lb config \ -a i386 \ -k 486 \ -p kde-desktop \ --language pt_BR \ --tasks "brazilian-portuguese brazilian-portuguese-desktop brazilian-portuguese-kde-desktop" \ --bootappend-live "locales=pt_BR.UTF-8 keyboard-layouts=pt-latin1" \ --debian-installer live \ --packages debian-installer-launcher Note that we have included the debian-installer-launcher package to launch the installer from the live desktop, and have also specified the 486 flavour kernel, as it is currently necessary to make the installer and live system kernels match for the launcher to work properly. ============================================================================== Title: Debian Live Handbuch Creator: Debian Live Project Rights: Copyright (C) 2006-2011 Debian Live Project; License: This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-3 file. Publisher: Debian Live Project Date: 2011-01-25 Sourcefile: live-manual.ssm.sst Filetype: SiSU text 2.0 Source digest: SHA256(live-manual.ssm.sst)= 79948f9a439b3b37d47d970ee2b4f8a8d4f912110e1d14db0eeb45e19ffdb267 Skin digest: SHA256(skin_debian-live.rb)= be92275c5ee3367edeed653901c34601c545c50acecc23ab65594d8e2f4df9af Generated by: Generated by: SiSU 2.7.9 of 2010w49/4 (2010-12-09) Ruby version: ruby 1.8.7 (2010-08-16 patchlevel 302) [i486-linux] Document (dal) last generated: Tue Jan 25 06:35:56 +0000 2011 ============================================================================== plaintext (plain text): http://live.debian.net/manual/de/live-manual/plain.txt Other versions of this document: manifest: http://live.debian.net/manual/de/live-manual/sisu_manifest.html at: http://live.debian.net/manual/de * Generated by: SiSU 2.7.9 of 2010w49/4 (2010-12-09) * Ruby version: ruby 1.8.7 (2010-08-16 patchlevel 302) [i486-linux] * Last Generated on: Tue Jan 25 06:36:14 +0000 2011 * SiSU http://www.sisudoc.org/