Live-System - Documentation

Installatation

Prerequisites

Live-System requires the following utilities (and their dependencies) to operate:

  • dosfstools,
  • gdisk,
  • grub,
  • squashfs-tools,
  • mkinitrd (Slackware) / mkinitcpio (Arch) / mkinitramfs (Debian) - for installation,
  • xorriso - for live-CD/DVD.

Download and install from source

  1. Download Live-System source
  2. Extract the files from the archive.
  3. Run the command: make install
    or: make install PREFIX=/usr DESTDIR=/absolute/path/to/destination.

Linux distribution maintainers

Packages recipes are provided for Arch Linux (make archpack), Debian (make debpack) or Slackware (make slackpack).

Quick start

Prepare a system

  • Bootstrap an Arch Linux system:
mkdir system
pacstrap system base linux sudo xorg xfce4 lightdm-gtk-greeter network-manager-applet chromium #...
chroot system pacman -Scc
chroot system systemctl enable lightdm
chroot system systemctl enable NetworkManager
chroot system useradd -m -g users -G wheel linomad
echo -e "root:root
linomad:linomad" | chroot system chpasswd
sed 's/# \(%wheel ALL=(ALL)\)/\1/' -i system/etc/sudoers
  • Or, a Slackware one :
mkdir system
mount -o loop path/to/slackware64-current.iso /mnt
installpkg --terse --root system /mnt/slackware64/{a,ap,d,l,n,x,xap,xfce}/*.t?z
umount /mnt
ln -sf xinitrc.xfce system/etc/X11/xinit/xinitrc
sed 's/^id:3:initdefault:$/id:4:initdefault:/' -i system/etc/inittab
chmod +x system/etc/rc.d/rc.networkmanager
chroot system useradd -m -g users -G wheel,audio,video,plugdev linomad
echo -e "root:root
linomad:linomad" | chroot system chpasswd
sed 's/# \(%wheel ALL=(ALL:ALL)\)/\1/' -i system/etc/sudoers
  • Or, an Ubuntu one :
mkdir system
debootstrap --include ubuntu-minimal focal system http://archive.ubuntu.com/ubuntu
cp -a /etc/apt/* system/etc/apt/
for d in sys proc dev dev/pts; do sudo mount --bind /$d system/$d; done
chroot system apt update
chroot system apt upgrade
apt-mark showmanual > packages.lst
chroot system apt install $(cat packages.lst)
chroot system locale-gen
chroot system useradd -g users -G adm,cdrom,sudo,plugdev,lpadmin -m -s /bin/bash linomad
echo "linomad:linomad" | chroot chpasswd
chroot system systemctl disable apparmor.service
for d in dev/pts dev proc sys; do sudo umount system/$d; done

Make it live

  • Setup kernel, initRamFs, GRUB EFI image and configuration file:
build-live-system.sh --init system live
  • Create a SquashFS module of the system:
build-live-system.sh --module system live 0-base-xfce
  • According to your needs, generate an ISO 9960 of the live DVD (and possibly test it with Qemu):
build-live-system.sh --iso live live-system.iso
qemu-system-x86_64 -enable-kvm -m 2048 -cdrom live-system.iso
  • Or copy the live system to an USB stick - Warning, destroys USB device data:
build-live-system.sh --usb live /dev/sdx

Build script usage - live-system generation

Variables influencing the script behavior

There are three environment variables that can customize live-system generation:

  • LIVELABEL (LiveSystem by default): the live-system filesystem label,
  • LIVEDIR (linomad by default): the live-system directory name,
  • and HOMELABEL (LiveData by default): the persistent data filesystem label.

They should be set before running any of the --init, --module, --usb or --iso action:

HOMELABEL="home-rw"
LIVELABEL="system-ro"
build-live-system.sh --init system live
#...

Setup kernel, initRamFs, GRUB EFI image and configuration file

Usage:

build-live-system.sh --init root_dir live_dir [additional:modules]

Generates: live_dir/efi/boot/{bootx64.efi,grub.cfg} and live_dir/linomad/{vmlinuz,initrd.gz}.
Included kernel modules (unless builtin and with their dependencies) are:

  • keyboard support (Busybox console): atkbd, i8042
  • P/S-ATA & CD-ROM support: atapiix, srmod
  • USB support: xhci-pci, ehci-pci, usb-storage
  • live filesystems: nlsiso8859-1, isofs, nlscp437, vfat, ext4, loop, overlay, squashfs

Usually additional modules are NFS and ethernet drivers needed to boot over NFS.

Examples:

build-live-system.sh --init system live
build-live-system.sh --init system live nfsv3:e1000e:8139too:atl1c:alx

Create a SquashFS module for the system

Usage:

build-live-system.sh --module root_dir live_dir module_file [-gzip|-lza|-lzma|-lzo|-xz|-zstd]

All root_dir subdirectories but /sys, /proc, /dev and /tmp are included.
Generates: live_dir/linomad/modules/module_file.

The compression option has an impact on media size and speed; zstd is the default.

The system can be divided into multiple modules (example: “1-core”, “2-gui”, …) that are loaded in alphabetical order; if a file is present in several modules, the one taken from the last loaded module is used.

Example:

build-live-system.sh --module system live 0-main

Copy live system on USB device

Warning: this operation can destroy all USB device data.

Usage:

build-live-system.sh --usb live_dir device [systemsize]

This action triggers two different behaviors:

  • if systemsize is not specified and if the device already contains a live-system (ie $LIVELABEL is found on device), an update is performed:
    • fsck is run on system and data partitions,
    • extra storage and persistent data are kept,
    • existing efi and $LIVEDIR are removed and live-system files are copied.
  • in the other cases, an installation is made destroying USB device data:
    • device is partitionned using GPT (GUID Partition Table - see table below),
    • live-system and persistent data partition are formatted,
    • live-system files are copied.
TypeFileSystemSizeLabelContent
10x0700vfatsystemsize$LIVELABELlive-system + extra storage
20x8300ext4remaining$HOMELABELpersistent data
  • when partitioning, if systemsize is not specified, by default it will be half the size of the USB device (eg. 64 MiB for a 128 MB device).
  • Extra storage is accessible from Microsoft Windows.

Examples:

build-live-system.sh --usb live /dev/sdx 8192   #install (systemsize is specified)
build-live-system.sh --usb live /dev/sdx        #update (`$LIVELABEL` found) or install

Enable BIOS boot on USB device

By default, USB device can only boot on UEFI (Unified Extensible Firmware Interface) firmware. For old devices, hybrid boot UEFI + BIOS (Basic Input Output System) also named CSM (Compatibility Support Module) can be enabled.

Usage:

build-live-system.sh --bios device

Example:

build-live-system.sh --bios /dev/sdx

Manual setup for live USB system

Warning: this operation destroys all USB device data.

To manually setup a bootable USB device (without using previous --usb action), it must be GPT partitionned and have a Fat-32 formatted partition containing the efi folder and the live-system files. Installing the live system is just a regular copy.

The optional data partition must be ext4 formatted.

  • The following example partitions and formats the USB device, with 8GiB space for the live-system (and extra storage), and a persistent data partition:
LIVELABEL="LiveSystem"
LIVEDIR="linomad"
HOMELABEL="LiveData"
sgdisk -Z /dev/sdx
sgdisk -o -n 1::+8G -t 1:0700  -n 2:: /dev/sdx
mkfs.vfat -n $LIVELABEL /dev/sdx1
mkfs.ext4 -F -L $HOMELABEL -O ^has_journal /dev/sdx2
  • If the live system files resides in an ISO image, mount it:
mkdir live; mount -o loop live.iso live/
  • The following commands copy the files on the USB device:
mkdir usb; mount /dev/sdx1 usb/
cp -r live/{efi,$LIVEDIR} usb/
umount usb; rmdir usb
  • Optionally, to enable BIOS / legacy boot, an additional BIOS boot partition (EF02) and an hybrid GPT + MBR (Master Boot Record) are required before installing GRUB:
sgdisk -n 128:34:2047 -t 128:ef02 -h 2 /dev/sdx
mkdir usb; mount /dev/sdx1 usb/
grub-install --target i386-pc --boot-directory usb/bios $installdevice
echo "configfile /efi/boot/grub.cfg" > usb/bios/grub/grub.cfg
umount usb; rmdir usb

Create a live CD/DVD ISO from live system

Usage:

build-live-system.sh --iso live_dir iso_file_name

Example:

build-live-system.sh --iso live live.iso`

Flash ISO on USB device:

Warning: this operation destroys USB device data.

Although not recommended as it does not allow data persistence, the ISO can be flashed on an USB device using standard dd command.

dd status=progress if=live.iso of=/dev/sdx

Boot parameters

System language and keymap layout

  • locale: system language; example: locale=fr_FR.UTF-8
  • keymap: keymap layout; example: keymap=fr; the first two caracters are used for Xorg keymap layout
  • tz: timezone; example: tz=Europe/Paris (value must be a valid path from /usr/share/zoneinfo)
  • hwc: hardware clock: UTC or localtime

Misc

  • home=label, home=UUID or home=IP:path (NFS): specify persistent home location (defaults to LiveData);
  • sys=label:path, sys=UUID:path or sys=IP:path (NFS): specify live system location (defaults to LiveSystem:linomad)
  • exclude=module1:module2: to prevent loading of specified modules
  • mode=busybox: to boot into a Busybox console (instead of the live system)

Live system installation

The live system can be installed into a hard disk partition; the result should be the same as a clean installation following the distribution regular install procedure. Both BIOS and UEFI firmwares are supported.

Install system and GRUB boot loader

Warning: this operation destroys all data on the install partition.

Usage:

build-live-system.sh --install root_dir partition

Example:

From a running live-system:

build-live-system.sh --install /live/system /dev/sdx2

Setup /home, user login and password

After installation, it is recommended to add a “normal” (non “root”) user and use a separate partition to store users files (/home).

Usage:

build-live-system.sh --home install_part home_part login password

Example:

build-live-system.sh --home /dev/sdx2 /dev/sdx4 linomad P@ssw0rd

GRUB installation and configuration

To boot the installed system, a boot loader (eg. GRUB) must be installed and configured.

Usage:

build-live-system.sh --grub partition

Example:

build-live-system.sh --grub /dev/sdx2