Introduction

Warning

Before we get started I should point out that most of the larch scripts must be run as root in order to do their work, and that much of this work consists of deleting and overwriting files and even complete directories. If just one of these is wrong it might make quite a mess of your system. That is quite normal for an installer, but you will be using it on a system that is already configured and this is somewhat risky - if you set up your configuration wrong (or if you or I made some other mistake ...), you might find you have destroyed some important data and/or your system doesn't work any more. But that's life - Share and Enjoy!

Below is the general introductory blurb, but for those who want to jump straight in and try it out I would suggest the following pages as possible starting points:

What is a live system?

larch is a collection of scripts designed around the creation and use of custom live CD/DVD/USB-stick versions of Arch Linux. A live operating system is one which can reside on a removable medium and boot on (ideally) any computer (of compatible architecture) into which it is inserted. This can be useful in quite a variety of situations, for example for testing purposes, for rescue purposes on machines whose installed operating system is broken, or as an installation medium (many linux distributions use live systems as installers). But there are also situations where a permanently installed live system can offer advantages over a normal installation, perhaps because of the compression or because a live system is quite robust - it is in essence read-only, and can be quite insensitive to hardware changes.

The main features of the larch system are listed on the Features page, among the most significant might be the use of 'profiles' to define the characteristics of the system to be built, the ability to write to various media with a choice of bootloaders and the session saving possibilities, allowing changes made during a live 'session' to be saved back to the boot device (as long as it is writable!).

Build system requirements

larch has been designed to work without extensive demands on the build system. Although it has been developed under Arch Linux, larch should run on other GNU/Linux systems. By means of a sort of bootstrapping, the required software has been kept to a minimum - many of the build functions are carried out on the newly installed Arch system using chroot. For example, you do not need support for squashfs or aufs on the build system. But basic utilities which are normally available on any GNU/Linux system, such as bash, mkfs.vfat, mkfs.ext2, blkid and sfdisk - and of course chroot - are assumed to be present (on Arch that is packages 'bash', 'dosfstools', 'e2fsprogs', 'util-linux-ng' and 'coreutils').

The larch scripts are written mainly in python, but snippets of bash crop up here and there. In addition to python you must also have the pexpect module available (in Arch the 'python-pexpect' package). The (optional) GUI requires pyqt. I'm not sure what the oldest supported versions are, development was done using python-2.6 and pyqt-4.7. I think python-2.5 should be alright, and I have heard that pyqt-4.4 probably doesn't work.

Command line vs. GUI

The basic functionality of larch is provided by command-line scripts, but a graphical user interface is available, to make it easier to see what options are available and to avoid the need to remember and not mistype obscure command line parameters. In addition to providing a front-end to the main scripts the GUI also provides help with organising the configuration files.

Overview

One design aim was easy customization, so that even relatively inexperienced users could build personalized live CDs (etc.), containing whatever packages they wanted and with their own personal configurations. The resulting medium should also be usable for installation purposes, so that one has a customized Arch Linux installation/rescue medium. As the content can be chosen freely, a comfortable working environment is possible - in contrast to the rather Spartan standard Arch installation CD. However, note that it is also possible, using the officially supported archiso, to produce a customized Arch Linux installation/rescue medium (see the corresponding Arch wiki page). The approach taken by the two projects is somewhat different so do have a look at both. Note that at the latest since version 7, larch makes no pretence of a 'KISS' approach. The code is, I'm afraid, rather complicated. The resulting live system should, however, be very close to a normal non-live Arch Linux system (as far as the squashfs + aufs basis allows).

larch offers a flexible approach to building your live media. You can use 'profiles' to determine what gets installed, and how it is configured. The advantage of this method is that all your specifications are kept together in a folder which can be used to rebuild the same or a similar system at a later date. Alternatively you can do a normal Arch Linux installation (if there is such a thing!) and then make a live medium from this. You can even 'livify' your existing installation (though it might be worth tidying it up a bit first ...).

The use of squashfs in the resulting system means that the space occupied will be significantly less than in the 'raw' state, normally about a third of the original. As a result of this design, it is not possible to write directly to the system - which would seem to be quite a drawback, though in some situations it can even be an advantage. The use of aufs (a 'unification' file-system, originally based on unionfs) allows the resulting system to appear writable in spite of its actual read-only nature, by using a writable 'overlay' in tmpfs (a memory-based file-system).

Normally any changes made to the system while running would be lost on shutdown, but by saving the overlay to the boot medium (which is of course only possible on devices which are actually writable, such as USB sticks), data persistence can be achieved even though the basic system is actually not writable. In spite of the different file-system structure of the live system, it should behave almost identically to a normal Arch installation in most respects. You can, for example, perform package management as usual, but the changes are saved in the overlay, rather than in the underlying system. Of course as the number of changes grows, so does the size of the overlay, and at some point this will become problematical. How larch manages this is explained in the session saving section.

Hardware detection is provided by the same udev approach as is used in a standard Arch Linux system.

The larch project comprises several components. The scripts for building a larch live medium are in the larch package, which need not itself be installed in the live system, though it may be useful (and is indeed installed by default). Scripts and data for the live environment are provided in the larch-live package, which must be installed in the live system. There is also an optional installer (larchin) which can install the live system to hard disk, providing a convenient way to install a ready-configured Arch Linux system.

As with Arch Linux in general larch is not really designed for beginners - you should know your way around a GNU/Linux system (preferably Arch!), and be aware of the dangers of running such programs, such as corrupting your whole system. In any case, I hope that the documentation will be clear enough to help anyone who wants to exploit larch to the full (feedback is welcome!).

Space Requirements: You need quite a lot of space to create a live Arch Linux system. Bear in mind that a complete Arch Linux system is installed, then, additionally, a compressed ('squashed') version is made, and then perhaps even a CD image (iso). Building for a USB-stick requires slightly less space, as the iso-image is not built. If building a live version of the currently running Arch Linux system, much less space is required as no new system must be installed - but there are additional problems with this approach which make it generally not the best way (see the section dealing with this).

Installation of the larch build system

The recommended way of installing larch is by means of the setup script, see here for details. This installs all the necessary packages to a working directory, and it should also work on non-Arch linux systems.

The larch package may, however, be installed in the normal Arch Linux way using pacman. This method will only work on an Arch system, of course. The larch repository is at berlios.

The larch command line scripts need to be started as root, and each has a usage message (run with the '-h' option). The gui should be started as a normal user (it uses sudo to get administrator permissions when needed).

Profiles

A larch 'profile' is a directory containing the information needed to build a particular 'flavour' of Arch Linux as a live system - which packages to install, and how it should be set up. For details see Profiles.

The stages of the build process

The starting point is an Arch Linux installation. This can be an already existing one from which you want to make a live version, or - the recommended approach - you can use the 'Installation' stage of the larch system (using the larch-archin script) to prepare this. This script downloads all the desired packages (if they are not already in the host's package cache) and installs them to a directory on the host (the default is '/home/larchbuild'). See this page for details.

Once we have the Arch Linux installation this can be processed to build the basis components for the live medium. The installation is compressed into a squashfs archive, and a second squashfs archive is built, which will function as a sort of 'patch' file for the basic installation, containing a few necessary adjustments for running as a live system and also the customizations specified in the profile. The other important component is the initramfs, which also needs to be adapted to boot the live system. This processing is performed by the larch-larchify script, see this page for details.

When the 'larchification' has been completed, the components can be packed together onto a boot medium together with a bootloader. The larch-live_iso script creates an iso file, which can then be written to a CD or DVD, the larch-live_part script sets up a bootable partition on a disk(-like) device, such as a USB stick. See this page for details.