debconf

To configure the unpacked packages, certain environment variables are needed. In native mode, multistrap does this for you but in cross mode, your setup script will need to set the correct environment for the maintainer scripts to run properly:

Debconf needs to be told to accept that user interaction is not desired:

DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true

perl

Perl needs to be told to accept that no locales are available yet and not to complain:

LC_ALL=C LANGUAGE=C LANG=C

It can also be useful to set a reasonably recent date before running dpkg --configure -a to avoid complaints from tar and gnupg about time-warps which may otherwise obscure more informative warnings or messages.

Then, dpkg can configure the packages.

chroot

chroot method (PATH = top directory of chroot):

DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
 LC_ALL=C LANGUAGE=C LANG=C chroot /PATH/ dpkg --configure -a

at a login shell:

# export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
# export LC_ALL=C LANGUAGE=C LANG=C 
# dpkg --configure -a

(Note: dpkg needs /proc and /sysfs mounted first. /dev/pts is also recommended. See Customising Rootfs)

Some devices may be able to boot to the point where the packages can be configured (possibly with a first-boot type script in /etc/init.d/) but this method needs to be tested. (Add feedback here if it works or if it fails.)

Other devices will need a temporary or secondary boot environment (possibly a rescue environment) that can provide a login shell and chroot capability on the device itself, at which point the environment variables can be set, /proc and /sysfs mounted inside the chroot and dpkg --configure -a started.

Other methods may involve mounting the multistrap filesystem over a network connection but only if it can be mounted from a device of the same architecture - this method also needs to be tested. (Add feedback here if it works or if it fails.)

The need to configure the packages on the device is an inevitable result of preparing a cross multistrap environment because the maintainer scripts in /PATH/var/lib/dpkg/info/ must be allowed to run binary executables within the multistrap filesystem and also obtain accurate meta data from the system itself (like real values in /proc etc.)

fakeroot

Fakeroot can be used with Multistrap but note that apt refuses to allow fakeroot to access the main system data which needs to be used for multistrap to download keyring packages to use Secure Apt in the multistrap environment. Therefore, if multistrap detects that fakeroot is in use, multistrap 2.1.13 or later turns off the Secure Apt handling (equivalent to setting noauth=true in the configuration file).

Apt will still give a warning about a lack of a keyring - this can only be avoided by not using fakeroot to call multistrap.

W: GPG error: http://www.emdebian.org squeeze Release: No keyring installed in /path/to/rootfs/etc/apt/trusted.gpg.d/.