Background

Multistrap is a tool that does essentially the same job as Debootstrap, using an entirely different method, and then extends the functionality to support automated creation of complete, bootable, root filesystems. It can merge packages from different repositories to make the rootfs. Extra packages are added to the rootfs simply by listing them - all dependencies are taken care of. Current development in multistrap is to support user-specified scripts being added as hooks during the unpacking phase to add customised startup scripts and configure things like device nodes. (For this support, check the package in Debian experimental.)

It was designed primarily for making root filesystems for foreign architecture embedded systems, but in fact can be used for many tasks where one might also use debootstrap.

Its main limitation compared to debootstrap is that it uses apt and dpkg directly so can only work on a debian system - deboostrap depends on nothing but shell, wget, binutils and thus can run pretty-much anywhere.

The main advantage with multistrap is the flexibility to mix packages from different repositories and different suites and manage customised variants with configuration files.

See also DeviceTableScripting

Use

Multistrap is available in squeeze or later. It is written in Perl and uses apt to chose a requested set of packages and their dependencies, then unpack (but not configure) those packages. This leaves a rootfs which just needs to be mounted (or chrooted) and configured with dpkg --configure -a.

Because it uses apt, the mixing of multiple repositories is automatic and apt features such as the use of proxies are all available.

For embedded use some modification to the generated rootfs are aften needed in order to make it bootable enough to be configured. An example is given below of a script to do this. See Customising Rootfs below. Development is ongoing to incorporate such support into hooks which can be called during the multistrap operation.

Manpage

?MultistrapManPage

Options

You can choose to keep a copy of all the debs downloaded during the process (by setting the retainsources option to be the path in which they should be stored. This is the binary packages downloaded, not the corresponding sources. But does mean you have a cache of the stuff you made your rootfs with.

Syntax

Basic syntax is:

multistrap [-a arch] -d [dir] -f config_file

nearly all the config is done in the config_file

Configuration

You need a config file which contains at least one repository stanza, like:

[Grip]
packages=ntpdate udev lrzsz netcat telnetd
source=http://www.emdebian.org/grip
keyring=emdebian-archive-keyring
suite=lenny

And you need to list that stanza title ('Grip') in the 'aptsources' line. And specify one repository in the debootstrap line, which is used as the 'main' repository, from which the list of 'priority: Required' packages is taken.

A directory in which to prepare the rootfs, and an arch to use are the last two items (which can be specified on the command line).

Here is a minimal example, which just does makes a normal Debian rootfs. use a command like: sudo multistrap -a armel -d /multistrap-debian-lenny -f simple-config

simple-config

[General]
unpack=true
debootstrap=Grip
aptsources=Debian

[Debian]
packages=
source=http://ftp.uk.debian.org/debian
keyring=debian-archive-keyring
suite=lenny

Grip/Debian example

Here is an example for an arm embedded system (balloonboard), where the rootfs is an emdebian Grip base, augmented by security updates, some extra packages from debian proper and some local packages from an internal repository.

Use it with a command like sudo multistrap -f grip-config

[General]
# arch and directory can be specified on the command line.
arch=armel
directory=/opt/multistrap/
# same as --tidy-up option if set to true
cleanup=true
# retain the sources outside the rootfs for distribution
# specify a directory to which all the .debs can be moved.
# or override with the --source-dir option.
retainsources=
# same as --no-auth option if set to true
# keyring packages listed in each debootstrap will
# still be installed.
noauth=true
# retries not needed.
#retries=5
# extract all downloaded archives
unpack=true
# the order of sections is no longer important.
# debootstrap determines which repository is used to
# calculate the list of Priority: required packages
debootstrap=Grip Updates
# the order of sections is no longer important.
# aptsources is a list of sections to be listed
# in the /etc/apt/sources.list.d/multistrap.sources.list
# of the target.
aptsources=Grip Updates Debian

[Grip]
packages=ntpdate udev lrzsz netcat telnetd
source=http://www.emdebian.org/grip
keyring=emdebian-archive-keyring
suite=lenny

[Updates]
packages=apt
source=http://www.emdebian.org/grip
keyring=emdebian-archive-keyring
suite=lenny-proposed-updates

# fallback
[Debian]
packages=
source=http://ftp.uk.debian.org/debian
keyring=debian-archive-keyring
suite=lenny

Customisation

Multistrap/CustomisingRootfs

Debconf and pre-seeding

Multistrap is not a DebianInstaller environment, it does not run udebs and debconf pre-seeding using d-i prefixes cannot work. It may be possible to pre-seed debconf with values for xserver-xorg or tzdata but this is not fully tested at the moment.

To set the root password, create a stub for /etc/shadow containing the line for root from an existing Debian system with the required root password already set. e.g.

root:$1$JgJYkyR/$NmCUELffabBFGwim6kjNn0:14795:0:99999:7:::                      

Steps for Squeeze and later

Inside the chroot (using qemu-static or after booting and using chroot, as appropriate):

/var/lib/dpkg/info/dash.preinst install

Environment

Multistrap/Environment

Native handling

Multistrap/NativeHandling

Cross chroot preparation

Multistrap in Debian experimental is being extended to allow the creation of a cross-building chroot which is compatible with [pbuilder]. The principle is to add toolchain packages from the Emdebian repositories and then add hooks to pbuilder which can set up the cross-dependencies.

Partial Mirrors

Multistrap/PartialMirrors

Cascading configuration

To support multiple variants of a basic (common) configuration, multistrap is also being extended to allow configuration files to include other (more general) configuration files. i.e. the most detailed / specific configuration file is specified on the command line and that file includes another file which is shared by other configurations.

Base file:

/usr/share/multistrap/crosschroot.conf

Variations:

/usr/share/multistrap/armel.conf

Specifying just the armel.conf file will get the rest of the settings from crosschroot.conf so that common changes only need to be made in a single file.

For discussion about these features, ask on the debian-embedded mailing list.


CategoryEmdebian