System Installation with installer.py

This script handles the copying of the live system to the destination partition(s). Various installation scenarios can be handled by setting a series of options, including optional (automatic) partitioning, formatting, mounting and unmounting of the partition(s), but the core of the process is the transfer of the system to its new location and the conversion to a non-live system.

Various configuration options are supplied in the file '/etc/larchin.conf'. Others (or overrides) are passed on the command line as options.

The actual installation

A little bit more than just copying the live system is necessary, because certain elements within this system are only relevant in the live context, and a few tweaks are needed after the copying is completed in order to adapt the system to its new, non-live context. These are listed below:

The '-i' option causes the installation partition(s) to be mounted (to a path specified in the configuration file), the copying and tweaking as described above to be performed, and then the partition(s) to be unmounted.

The '-I installation_path' option suppresses the mounting and unmounting, using the given path as the destination. Otherwise it acts like '-i'.

Two further - possibly useful - options are available: '-g' causes only the generation of the initramfs, '-t' causes only generation of '/etc/fstab'. Mounting and unmounting will be performed as necessary, but it is also possible to specify the '-I' option.

Automatic partitioning

A fairly simple autopartitioning scheme is supported, only on the primary disk drive ('/dev/sda'). In the free space at the end of the drive - and also assuming that the partition ordering follows the location of the partitions on the drive - an optional swap partition, the system partition and an optional users ('/home') partition can be created. If the drive has some weird partition structure, the autopartitioning probably won't work and may make a further mess of something. In such a situation use a manual partitioning tool (e.g. gparted) to create the partitions.

The default names and sizes of the partitions are set, where relevant, in the configuration file. The default swap partition size is equal to that of the installed memory (I guess this is appropriate for suspend-to-disk?). By default the '/home' partition will occupy all the remaining space on the disk, unless that would be smaller than the system ('/') partition, in which case the available space is shared equally between them. If less than a certain (estimated) minimum space is available for '/' and '/home', no separate '/home' partition will be created, and if the space seems really tight, a warning will be issued and it will be necessary to specify sizes explicitly. The specification of explicit sizes overrides any automatic mechanism.

Note that if partitions already exist with the corresponding labels (even on other disk drives!) these will be 're-used', even if their size or some other parameter is inappropriate. In such a case a warning will be issued and the choice of continuing or interrupting the operation will be offered. If there is already a swap partition on the main drive - regardless of its label - one can choose between using the existing one or creating a new one. If using an already existing swap partition, it will never be formatted, and if it has no label, its UUID will be used to identify it.

The auto-partitioning stage is invoked by the '-a' option. If both '-a' and '-i' options are specified, also '-f' will be implied.

Related options

Partition formatting

In order to keep things simple no choice of file-system is offered at present. As a compromise, the formatting commands for '/' and '/home' are specified in the configuration file - the default is 'ext4'. As larchin works primarily with partition labels and not with device paths, the formatting of newly created partitions must be done immediately, so the '-f' option is irrelevant when '-a' is specified. The '-f' option will cause reformatting of already existing, labelled partitions, except swap, which is assumed not to need formatting. If neither '-a' nor '-f' is specified for an installation, suitably formatted and labelled partitions must exist already.

The bootloader

larchin uses the extlinux bootloader, the same as larch. Others are not directly supported - out of a desire to keep things simple. A possible disadvantage is that not all file-systems are supported (only 'extN' and 'btrfs' at present), but anyone who consciously decides for another file-system than the default should hopefully know how to install another bootloader. The '-B' option suppresses installation of the extlinux bootloader, the '-b' option causes only the installation of the extlinux bootloader to be carried out (partitioning, formatting, system copying, etc. are suppressed). The '-r' option causes the installation partition to be marked as bootable and installs a simple bootloader to the drive's Master Boot Record (this may also be used in conjunction with '-b').

Progress reporting

Two options are available to determine how the copying process is progressing. '-p' causes a message to be produced for every percent point (number of files copied), '-P mb' results in a message after every mb MB increment.

A complete installation

The individual steps are:

To perform a complete default installation with notification in percent of the copy progress and installation of a Master Boot Record, a suitable command would be:

    larchin -airp

Device recognition via LABEL or UUID

Because of the way block devices are detected in Linux it is possible under certain circumstances for a partition to get assigned a different name (e.g. /dev/sda can become /dev/sdb) from one boot to the next. For this reason it is often sensible to address these devices in a more stable way in the bootloader and /etc/fstab, either via volume label or UUID. larchin uses volume labels because they are much more readable than UUIDs and can bear some relation to the contents/purpose of the partition.