This page is just somewhere to record issues with Emdebian packages, things that we come across during installation that we don't have time to fix there and then. e.g. calls in postinst to binaries that we don't install, calls with options that the busybox version doesn't support etc.

 # The config.h file will contain a single #define that tells us how
 # many bytes are in a pointer.  This only works if a pointer is the
 # same size on the host as it is on the target.  If you are cross-compiling
 # to a target with a different pointer size, you'll need to manually
 # configure the config.h file.

Without changing this value, cross-compiling sqlite on amd64 for ARM produces this warning at runtime:  ./src/btree.c:702: sqliteBtreeOpen: Assertion `sizeof(ptr)==sizeof(char*)' failed. The solution is a rather odd command to retrieve the size of the pointer:

grep "^ac_cv_sizeof_char_p" config.log | cut -d'=' -f2 | sed -e 's/.*/#define SQLITE_PTR_SZ &/'

This is deployed as a patch against main.mk and Makefile.in in the SQLite Emdebian patch files. The value for ac_cv_sizeof_char_p itself comes from dpkg-cross: /etc/dpkg-cross/cross-config.arm

genesis:/# /bin/mktemp -p /tmp one.XXXXXX
/tmp/one.ql3991
genesis:/# mktemp -p /tmp one.XXXXXX
mktemp: invalid option -- p
BusyBox v1.1.3 (Debian 1:1.1.3-5em3) multi-call binary

Usage: mktemp [-dq] TEMPLATE

Creates a temporary file with its name based on TEMPLATE.
TEMPLATE is any name with six `Xs' (i.e., /tmp/temp.XXXXXX).

Options:
        -d              Make a directory instead of a file
        -q              Fail silently if an error occurs

        DEBCONF_USE_CDEBCONF=true
        export DEBCONF_USE_CDEBCONF

(emsandbox sets this value via emsecondstage which calls the debootstrap suite script. Other debconf environment variables are also specified in the suite script. See /usr/lib/emdebian-tools/emdebian.crossd, /usr/lib/emdebian-tools/emdebian.gpe and /usr/lib/emdebian-tools/emdebian.gtk.

Next in consideration is dpkg -x $deb directory/ - fine that puts the binaries into a suitable top level directory, creating all the subdirectories needed as it goes. Except it only deals with the package binaries and not the package control data so the all-important DEBIAN stuff like postinst gets left behind so dpkg --configure -a has nothing to do. Adding in dpkg -e $deb $dpkg-dir/ is my current method. Hopefully, putting the files into directory/var/lib/dpkg/info will be sufficient for dpkg --configure -a to be able to reconstruct it's own data caches. The only question is where to put the control files and whether it is safe to append them to /var/lib/dpkg/available without dpkg doing it itself. Possible script:

#  Copyright (C) 2008  Neil Williams <codehelp@debian.org>
#
#  This package is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.

mkdir -p output/var/lib/dpkg/info
rm -f output/var/lib/dpkg/status
touch output/var/lib/dpkg/status
rm -f output/var/lib/dpkg/available
touch output/var/lib/dpkg/available
mkdir -p output/var/lib/dpkg/updates/
touch output/var/lib/dpkg/status

for deb in `ls var/cache/apt/archives/*.deb`; do
        ver=`dpkg -f $deb Version`
        pkg=`dpkg -f $deb Package`
        echo "Unpacking $pkg ($ver) ...."
        dpkg -x $deb output/
        rm -rf output/tmp/*
        dpkg -e $deb output/tmp/
        for maint in `ls output/tmp/`; do
                mv output/tmp/$maint output/var/lib/dpkg/info/$pkg.$maint
                if [ $maint = "control" ]; then
                        cat output/var/lib/dpkg/info/$pkg.$maint >> output/var/lib/dpkg/available
                        echo "" >> output/var/lib/dpkg/available
                        rm output/var/lib/dpkg/info/$pkg.$maint
                fi
        done
        # need to change the Status: to what dpkg actually expects. (unpacked?)
        echo \
"Package: $pkg
Version: $ver
Status: install ok installed" >> "output/var/lib/dpkg/status"
        if [ -f output/var/lib/dpkg/info/$pkg.conffiles ]; then
                echo \
"Conffiles:" >> "output/var/lib/dpkg/status"
                echo "Processing $pkg.conffiles"
                for line in `cat output/var/lib/dpkg/info/$pkg.conffiles`; do
                        md5=`md5sum output/$line | cut -d" " -f1`
                        echo \
"  $line $md5" >> "output/var/lib/dpkg/status"
done
        echo "" >> "output/var/lib/dpkg/status"
        fi
        touch "output/var/lib/dpkg/info/${pkg}.list"
done

emsandbox installation

One or two issues remain with using cdebconf and busybox in place of debconf and coreutils respectively.

cdebconf is not initialising correctly

Setting up esound-common (0.2.36-3em1) ...
Setting up login (1:4.0.18.1-7em1) ...
chown: unknown group name: root
dpkg: error processing login (--configure):
 subprocess post-installation script returned error exit status 1
Setting up apt (0.7.11em2) ...
Setting up rxvt (1:2.6.4-12em1) ...
Setting up netbase (4.30em1) ...
Setting up libpam-modules (0.79-4em1) ...
Setting up ifupdown (0.6.8em2) ...
/var/lib/dpkg/info/ifupdown.postinst: exec: 19: /usr/share/debconf/frontend: not found
dpkg: error processing ifupdown (--configure):
 subprocess post-installation script returned error exit status 2
Setting up ttf-bitstream-vera (1.10-7em2) ...
Setting up dbus (1.1.2-1em1) ...
Setting up libgtk2.0-0 (2.12.3-2em1) ...
Removing generated module files coming from the previous Gtk binary version...
Setting up zlib1g (1:1.2.3.3.dfsg-8em1) ...
Setting up gpe-edit (0.25-1.1em1) ...
Setting up base-files (4.0.2em1) ...
chown: unknown group name: root
dpkg: error processing base-files (--configure):
 subprocess post-installation script returned error exit status 1
Setting up matchbox-desktop (0.9.1-4em1) ...
Setting up xinit (1.0.7-1em1) ...
Setting up balloon3-config (0.3) ...
chpasswd: can't open password file
dpkg: error processing balloon3-config (--configure):
 subprocess post-installation script returned error exit status 1
Setting up x11-common (1:7.3+6em1) ...
/var/lib/dpkg/info/x11-common.postinst: exec: 19: /usr/share/debconf/frontend: not found
dpkg: error processing x11-common (--configure):
 subprocess post-installation script returned error exit status 2
Setting up passwd (1:4.0.18.1-7em1) ...
/var/lib/dpkg/info/passwd.postinst: exec: 19: /usr/share/debconf/frontend: not found
dpkg: error processing passwd (--configure):
 subprocess post-installation script returned error exit status 2
Setting up libpam-runtime (0.79-4em1) ...
Setting up dpkg (1.14.7em1) ...
/var/lib/dpkg/info/dpkg.postinst: cd: 177: can't cd to /etc/rc0.d
dpkg: error processing dpkg (--configure):
 subprocess post-installation script returned error exit status 2
Setting up matchbox-window-manager (1.2-1em1) ...
Setting up fontconfig-config (2.4.91-1em3) ...
/var/lib/dpkg/info/fontconfig-config.postinst: exec: 19: /usr/share/debconf/frontend: not found
dpkg: error processing fontconfig-config (--configure):
 subprocess post-installation script returned error exit status 2
Setting up cdebconf (0.125em2) ...
Setting up ntpdate (1:4.2.4p4+dfsg-2em1) ...
Setting up libc6 (2.7-4em1) ...
/var/lib/dpkg/info/libc6.postinst: exec: 19: /usr/share/debconf/frontend: not found
dpkg: error processing libc6 (--configure):
 subprocess post-installation script returned error exit status 2
Setting up udev (0.114-2em1) ...
/sys/class/net/ is not available, persistent interface names not saved.
/var/lib/dpkg/info/udev.postinst: /var/lib/dpkg/info/udev.postinst: 236: stat: not found
udev requires a mounted sysfs, not started.
Errors were encountered while processing:
 login
 ifupdown
 base-files
 balloon3-config
 x11-common
 passwd
 dpkg
 fontconfig-config
 libc6

This is probably due to the relevant environment variables not being set:

DEBIAN_FRONTEND=noninteractive
DEBCONF_NONINTERACTIVE_SEEN=true
DEBCONF_USE_CDEBCONF=true
export DEBCONF_USE_CDEBCONF
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN

With these set, cdebconf can be initialized:

chroot . /usr/lib/cdebconf/debconf-loadtemplate /usr/share/debconf/demo /usr/share/debconf/demo.templates

Then the dpkg configure run tried again:

chroot . /usr/bin/dpkg --configure -a
Setting up ifupdown (0.6.8em2) ...
Setting up base-files (4.0.2em1) ...
chown: unknown group name: root
dpkg: error processing base-files (--configure):
 subprocess post-installation script returned error exit status 1
Setting up balloon3-config (0.3) ...
chpasswd: can't open password file
dpkg: error processing balloon3-config (--configure):
 subprocess post-installation script returned error exit status 1
Setting up x11-common (1:7.3+6em1) ...
fgrep: invalid option -- x
BusyBox v1.1.3 (Debian 1:1.1.3-5em3) multi-call binary

No help available.

/var/lib/dpkg/info/x11-common.postinst: /var/lib/dpkg/info/x11-common.postinst: 924: cannot create /var/lib/x11/Xwrapper.config.roster: Directt
Setting up passwd (1:4.0.18.1-7em1) ...
groupadd: unable to open group file
Group ID 42 has been allocated for the shadow group.  You have either
used 42 yourself or created a shadow group with a different ID.
Please correct this problem and reconfigure with dpkg --configure passwd''.

Note that both user and group IDs in the range 0-99 are globally
allocated by the Debian project and must be the same on every Debian
system.
/sbin/shadowconfig: /sbin/shadowconfig: 55: bash: not found
Please correct the error and rerun `/sbin/shadowconfig on'
Setting up dpkg (1.14.7em1) ...
/var/lib/dpkg/info/dpkg.postinst: cd: 177: can't cd to /etc/rc0.d
dpkg: error processing dpkg (--configure):
 subprocess post-installation script returned error exit status 2
Setting up fontconfig-config (2.4.91-1em3) ...
Setting up libc6 (2.7-4em1) ...
/var/lib/dpkg/info/libc6.postinst: /var/lib/dpkg/info/libc6.postinst: 387: stat: not found
BusyBox v1.1.3 (Debian 1:1.1.3-5em3) multi-call binary

Usage: init

Init is the parent of all processes.

Errors were encountered while processing:
 base-files
 balloon3-config
 dpkg

So there remain problems with replacing certain components in coreutils with busybox with regard to the postinst scripts.

/sbin/shadowconfig: /sbin/shadowconfig: 55: bash: not found

That needs an extra check in emdebuild

/var/lib/dpkg/info/libc6.postinst: /var/lib/dpkg/info/libc6.postinst: 387: stat: not found

Not sure on that one, maybe a busybox option missing.

Setting up x11-common (1:7.3+6em1) ...
fgrep: invalid option -- x

Needs a revised patch for the x11-common postinst.

dpkg-divert is perl

Various packages look for dpkg-divert in the maintainer scripts. Crush 1.0 used a fatal lintian check to prevent the inclusion of these sections of the maintainer scripts and therefore required patches to remove those sections. Crush 2.0 could include an empty shell script to replace dpkg-divert but this would mean that no diversions would be implemented and trying to install a package that would divert another package in Debian would cause a failed installation in Crush. Re-implementing dpkg-divert in shell is probably not practical.