Differences between revisions 36 and 37
Revision 36 as of 2011-06-17 11:43:43
Size: 11019
Editor: NeilWilliams
Comment:
Revision 37 as of 2011-08-13 11:46:07
Size: 11429
Editor: NeilWilliams
Comment: Add multiarch details.
Deletions are marked like this. Additions are marked like this.
Line 166: Line 166:
= MultiArch support =

Multistrap checks your version of [[DebPkg:dpkg]] to see if multiple architectures can be supported in {{{/etc/dpkg/dpkg.cfg.d/}}} and disables the relevant support if not found. You can check your own system with the same test:

{{{
dpkg --print-foreign-architecture ; echo $?
}}}

Zero on success, non-zero on error.

[[Multistrap/MultiArch|Details of MultiArch support]]

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.

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

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

[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

Comparison with debootstrap

debootstrap, by default, selects all packages with Priority: required and Priority: important from the Debian mirror. multistrap will use Priority: required by default (this can be turned off with the omitrequired option in the config file).

grep-available  -FPriority 'required' -sPackage

Creating device nodes from a device table file

DeviceTableScripting allows multistrap to create device nodes from a simple device table text file.

Components support

See ?Multistrap/ComponentSupport for more information on how to mix development, java, documentation or debug packages with an Emdebian Grip base package set.

Also: http://www.linux.codehelp.co.uk/serendipity/index.php?/archives/218-Documenting-Emdebian-components-and-filters.html

Customisation

Multistrap/CustomisingRootfs

Debugging package selection failures

Multistrap can report failure messages when apt is unable to resolve the entire dependency chain. It is not a bug in multistrap when this happens - the problem lies in the selection of packages and the mix of suites involved. There are various methods to debug such situations:

  1. Mimic the call to apt - in the multistrap output, above the failure message, is a long line of commands to apt-get. Copy that entire line into an editor. Re-run the multistrap command with cleanup set to false to preserve the apt sources list and apt data, then run the entire apt-get command manually. This is now a normal apt debugging problem and relies on picking out which packages are actually causing the problem rather than those which are being ruled out by apt as a result of the problem. Somewhere in the dependency chain, you will find a package or a couple of packages which cannot be installed using the apt sources you have specified in your bootstrap instruction. Once you know which packages causing the problem, try to explicitly install only those packages using the same apt-get command. Use Ctrl-C to halt apt if you pick the wrong ones. You can continue to debug the problem by editing the long command to be a call to apt-cache options policy package to see why apt is preferring a particular version of a package.

  2. Switch to the native architecture - trim down your package selection to the base package set (i.e. with only apt listed in the packages field for any included section) and create a temporary chroot on your desktop / laptop machine. In the adapted configuration, ensure that your aptsources line matches your bootstrap line even if your final installation would differ. Also change cleanup to false. [chroot] into the new directory and then use apt to see what the problems are with your package selection by individually trying to install each one using the apt sources which you are expecting apt to use in the bootstrap phase of your original config.

  3. Use components - if you have an Emdebian base package set and then try to add build tools and/or development packages from Debian, you will need to take account of ?Multistrap/ComponentSupport and how Emdebian divides up the archive for development, debug, java and documentation packages.

Flat file archives

To use multistrap with flat file archives (e.g. those created by mini-dinstall or some Ubuntu PPA repositories), see Multistrap/FlatFileArchives

MultiArch support

Multistrap checks your version of dpkg to see if multiple architectures can be supported in /etc/dpkg/dpkg.cfg.d/ and disables the relevant support if not found. You can check your own system with the same test:

dpkg --print-foreign-architecture ; echo $?

Zero on success, non-zero on error.

Details of MultiArch support

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.

See also http://www.emdebian.org/multistrap/cascades.html

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


CategoryEmdebian