Building the live system

Once we have an Arch Linux installation and have specified our customizations in the profile, we can combine all this information into two squashfs archives and an initramfs (to allow the live system to boot). Let's call this step 'larchification' (from the verb 'larchify'). The lowest layer in the aufs mount is the raw installation, which is compressed into a squashfs archive, 'system.sqf'. All the modifications specified in the profile, as well, as some common to all larch systems are in the archive 'mods.sqf', which 'overlays' the basic installation.

For details of the structure of the live system which is built by this stage see this page. The bulk of the code in the larchify script is concerned with building the 'mods.sqf' overlay, and a description of the main possibilities for customizing the build process are covered in the profiles documentation.

mkinitcpio and the initramfs

In order to build a suitable initramfs for a larch system, a customized version of 'mkinitcpio.conf' is required. How larch handles this is quite complicated because it aims to retain the normal files so that the live system can later be installed as a normal Arch Linux system, whilst at the same time offering the capability of updating (with 'pacman -Syu') the live system, including the kernel (thus requiring regeneration of the initramfs for the system). The consequence of this ambition is that modifications are made within '/etc/mkinitcpio.d' (which are reversible when the live system is installed as normal Arch Linux system) and a special mkinitcpio' configuration file, '/etc/mkinitcpio.conf.larch' is generated automatically (and thus should not be touched by human hands!) from '/etc/mkinitcpio.conf.larch0'. If you need to know more see the method 'Builder.gen_initramfs' in 'cli/larchify.py'.

Rebuilding using an existing 'system.sqf'

In order to aid experimentation with profile tweaks which do not affect the underlying installation, it is possible to repeat the 'larchify' step without rebuilding the 'system.sqf' archive, which saves quite a bit of time (this is achieved by passing the '-o' option to 'larch-larchify' when running from the command line).

Making a live system from an existing Arch installation

By setting the installation path (with the '-i' option if using the command line) to an existing Arch installation, a live medium can be made from it. The installation must already be mounted, including any sub-mounts (e.g. /home on another partition). The main mount must be with options 'exec,dev', because most of the building is done via a chroot to the installation. This approach to live system generation is probably not a good idea if the installation contains a lot of data - consider how big the result will be ...

Also the currently running (Arch only!) system can be larchified, by setting the installation path to '/'. This is, however, not recommended. Building from a running system can easily result in data corruption because the file-system might well change during the build process.

Note that some things in '/var' will not be included in the 'live' system. Firstly, the standard pacman package cache ('/var/cache/pacman/pkg') will be excluded. Also the log files (in '/var/log') and '/var/tmp' (temporary files, like '/tmp') are not saved. As some files in '/var/log' are required for certain aspects of logging to function, these are recreated in the initramfs.