LiveCD boot scripts

This page is in help of those that are interested in changin the evironment of LSD GNU/Linux LiveCDs before booting into it, whether to troubleshoot something or to just because you are not happy with the defaults.

Tools of the trade
The scripts used to boot the LiveCD ISO images are lsd-live, or LSDL. Its sources are located at https://bitbucket.org/smil3y/lsd-live. These scripts include initramfs hook and initscripts functions to make use of the SquashFS compressed image and AUFSKernel module and create read-write filesystem so that the changes are stored in the RAM. They provide easy conifugration of the Live environment by passing Kernel arguments, repair facility to rescue a broken installation and probably more in the near future.

Functions
The initramfs hook is split into functions which could be very helpful:
 * mods: loads (modprobe) modules that are necessary for mounting at later stage
 * boot: mounts the boot device (CD/DVD/USB) to access the files on it
 * tmpfs: mounts tmpfs as read-write branch
 * sfs: mounts the SquashFS image of the root filesystem as read-only branch
 * c2r: copies the content of the SquashFS image into RAM so the boot device can be ejected
 * aufs: merges the read-only and read-write branches into an ultimate aufs read-write filesystem (if copy2ram was not asigned)
 * move: move-mounts the boot device, read-only branch and read-write branch to the new root filesystem for access to their files
 * shell: launches an interactive shell for repairs, useful in case of debugging

Variables

 * LIVE_FUNC: array of all functions that should be executed at boot
 * LIVE_MODPROBE: an array of modules that should be loaded (mordprobed)
 * LIVE_WAIT: time in seconds to wait before probing for boot device
 * LIVE_BOOT_DEV: device to be probed first when looking for boot device
 * LIVE_SFS_IMG: path to the SquashFS image on the boot device
 * LIVE_TMPFS_SIZE: size for tmpfs, accepts % (i.e. 50%) or MB (i.e. 100M)
 * LIVE_HOSTNAME: hostname for the live environment
 * LIVE_ROOT_PASS: password for the root user
 * LIVE_HARDWARECLOCK: type of clock to be setuped
 * LIVE_TIMEZONE: timezone for the live environment
 * LIVE_KEYMAP: keymap for the live environment
 * LIVE_CONSOLEFONT: font for tty-console
 * LIVE_CONSOLEMAP: console map for tty-console
 * LIVE_LANG: locales for the live environment
 * LIVE_MODULES: modules to be loaded on boot
 * LIVE_USECOLOR: wheater or not to use colors for boot messages
 * LIVE_USESWAP: wheater or not to enable support for Swap
 * LIVE_USEDMRAID: wheater or not to enable support for RAID
 * LIVE_USEBTRFS: wheater or not to enable support for BTRFS
 * LIVE_USELVM: wheater or not to enable support for LVM
 * LIVE_USER: the name of the live (regular) user to be added
 * LIVE_USER_PASS: password for the live user
 * LIVE_USER_GROUPS: groups which the live user should be member of
 * LIVE_USER_UID: UID of the live user
 * LIVE_USER_SHELL: default shell for the live user
 * LIVE_DAEMONS: daemons to be initiated at boot
 * LIVE_CONFIG: wheater or not to configure the live environment at boot
 * LIVE_REPAIR: wheater or not to provide repair facility at boot
 * LIVE_COPY2RAM: wheater or not to copy the SquashFS into RAM
 * LIVE_EJECT: wheater or not to eject the boot media at shutdown/reboot
 * LIVE_STARTX: set to 1 to start X at boot (via ~/.bash_profile)
 * LIVE_AUTO_LOGIN: user to auto login, set to 0 to disable it

Sane values

 * LIVE_FUNC="mods,boot,tmpfs,sfs,c2r,aufs,move"
 * LIVE_MODPROBE="cdrom,isofs,usb_storage,sd_mod,sr_mod,squashfs,aufs"
 * LIVE_WAIT="0"
 * LIVE_BOOT_DEV="/dev/sr0"
 * LIVE_ROOT_SFS="live/root.sfs"
 * LIVE_TMPFS_SIZE="100%"
 * LIVE_CONFIG="1"
 * LIVE_REPAIR="0"
 * LIVE_COPY2RAM="0"
 * LIVE_EJECT="1"
 * LIVE_STARTX="1"
 * LIVE_AUTO_LOGIN="${LIVE_USER}"
 * LIVE_HOSTNAME="lsd"
 * LIVE_ROOT_PASS="toor"
 * LIVE_HARDWARECLOCK="null"
 * LIVE_TIMEZONE="null"
 * LIVE_KEYMAP="null"
 * LIVE_CONSOLEFONT="null"
 * LIVE_CONSOLEMAP="null"
 * LIVE_LANG="null"
 * LIVE_MODULES="null"
 * LIVE_USECOLOR="null"
 * LIVE_USESWAP="null"
 * LIVE_USEDMRAID="null"
 * LIVE_USEBTRFS="null"
 * LIVE_USELVM="null"
 * LIVE_USER="live"
 * LIVE_USER_PASS="${LIVE_USER}"
 * LIVE_USER_UID="1000"
 * LIVE_USER_SHELL="/bin/bash"
 * LIVE_USER_GROUPS="tty,tape,wheel,disk,lp,audio,video,usb,cdrom,network,power"
 * LIVE_DAEMONS="null"

Getting your hands dirty
If you are not satisfied by the defaults then you have the option to change their value. Every major variable in the hook can be override by passing a lower case alternative of it to the kernel. For an example, if you want to change the locales then when booting the ISO you can press [TAB] and edit/add/remove kernel command line arguments like this: /live/vmlinuz initrd=/live/linux.img live_locale=

and they will be setuped. The same goes for the other variables. Isn't that nice? However quotes and spaces can not be used in the Kernel arguments, instead commas should be used. Here is an example with LIVE_DAEMONS: /live/vmlinuz initrd=/live/linux.img live_daemons= ,

If you want certain feature not to be configured leaving the system in a clean state you can asign 'null' as value for the apropariate varible. An example if you don't want regular (live) user to be added: /live/vmlinuz initrd=/live/linux.img live_user=null

Usefull links
https://www.kernel.org/doc/Documentation/kernel-parameters.txt