Operating principle

Prerequisites

The following packages are required:

Quick start

The following commands build a live system from the running one:

build-live-system.sh --init / /tmp/live
    #builds the live system initRD & copies the kernel
build-live-system.sh --module / /tmp/live 0-main.sfs
    #creates a squashfs module of the system (and mounted medias...)
build-live-system.sh --iso /tmp/live /tmp/live-system.iso
    #generates an ISO of the live CD (if needed)
build-live-system.sh --usb /tmp/live /dev/sdx
    #copies the live system to USB (if needed)

Preparing a clean Slackware system from a running one

It is recommended to build the live system from a clean offline one; first step is to prepare the system (Slackware here):

#install required packages (whole series without KDE here):
for s in a ap d l n x xap xfce; do
   installpkg -root /mnt/system /mnt/cdrom/slackware/$s/*.t?z
done

#enable graphical login and set default X session (XFCE here) :
sed 's/id:3:initdefault:/id:4:initdefault:/ -i /mnt/system/etc/inittab
ln -sf xinitrc.xfce /mnt/system/etc/X11/xinit/xinitrc

#enable services:
chmod +x /mnt/system/etc/rc.d/rc.cups
chmod +x /mnt/system/etc/rc.d/rc.networkmanager

#add a user:
chroot /mnt/system useradd -m -g users liveuser
chroot /mnt/system usermod -G cdrom,netdev,plugdev,scanner,audio,video,power liveuser
chroot /mnt/system passwd liveuser

Next (and last) step is to build the live system (see below).

Preparing a clean Arch system from a running one

Now the same for Arch Linux:

#install required packages (LXDE desktop here):
mkdir -p /mnt/system/var/{cache/pacman/pkg,lib/pacman}
mkdir -p /mnt/system/{dev,proc,sys,run,tmp,etc,boot,root}
chmod 0750 /mnt/system/root
chmod 1777 /mnt/system/tmp
chmod 0555 /mnt/system/proc /mnt/system/sys
for d in dev proc sys; mount --bind /$d /mnt/system/$d; done
pacman --root /mnt/system -Sy base xorg lxde midori \
   net-tools wireless_tools wpa_supplicant rfkill \
   ipw2100-fw ipw2200-fw b43-fwcutter iw \
   network-manager-applet networkmanager #...
for d in dev proc sys; umount /mnt/system/$d; done

#enable locales:
sed -e 's/^#\(fr_FR.UTF-8\)/\1/' -i /mnt/system/etc/locale.gen
chroot /mnt/system locale-gen

#enable graphical login and services:
chroot /mnt/system systemctl enable lxdm
chroot /mnt/system systemctl enable NetworkManager
chroot /mnt/system systemctl enable org.cups.cupsd

#add a user:
chroot /mnt/system useradd -m -g users liveuser
chroot /mnt/system passwd liveuser

Build a live system from a clean install

Live system build instructions are the same for Arch Linux and Slackware:

build-live-system.sh --sysprep /mnt/system
build-live-system.sh --init /mnt/system /tmp/live
build-live-system.sh --module /mnt/system /tmp/live 0-main.sfs -xz
build-live-system.sh --iso /tmp/live /tmp/live-system.iso

Live system build commands

Live media detection relies on filesystem label ("LiveSystem" by default), hard-coded in "init" and "build-live-system.sh" scripts.

Sysprep

Running "sysprep" is required before building the live system; it runs commands like "ldconfig" and "depmod", "mkfontdir", "fc-cache", "update-desktop-database" (...), merges "/etc/passwd" and "/etc/group" system files (if the system is divided into multiple directories).

Setup kernel and initrd

Create a SquashFS module for the system

Using multiple modules

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

Copy live system on USB device

Warning: if the destination is a whole disk or key ("/dev/sdb" for example), it is automaticaly repartitionned (see below) (and all data on it are wiped). When copying on a partition, formatting can occur (if mounting fails).

USB device partition scheme

For USB booting (live or installed system), the recommended partition scheme is an hybrid GPT / MBR with the following partitions (use "r" then "h" gdisk commands to add partitions 1, 2 and 3 to MBR):

NumberStart (sector)End (sector)SizeCodeFilesystemContent
1 2048 at least 16 MiB ef00 FAT EFI System & misc files
2 at least 1 GiB 8300 Ext4 Live system
3 at least 500 MiB 8300 Ext4 (without journal) Persistent data (optional)
any 34 2047 1007.0 KiB ef02 GRUB / CSM

Create a live CD/DVD ISO from live system

Boot parameters

System language and keymap layout

Misc

Live system installation

The live system can be installed into a hard disk partition; the result is the same as a clean installation.

Install live system

Warning: the install device will be formatted (and all data on it wiped).

Install GRUB

If not done during install or for repairing.

GRUB can be installed on a MBR (for legacy BIOS firmware) or GPT disklabel; for the later one, it supports both UEFI and legacy BIOS booting; as said before:

Setup /home, user login and password

After installation, it is recommended to add a "normal" user and use a separate partition for the user data (/home).

Warning: the home device will be formatted if mounting fails.