Differences between revisions 18 and 19
Revision 18 as of 2008-07-10 14:41:35
Size: 13967
Editor: NeilWilliams
Comment:
Revision 19 as of 2008-07-10 15:05:21
Size: 14342
Editor: NeilWilliams
Comment:
Deletions are marked like this. Additions are marked like this.
Line 17: Line 17:
The solution is a rather odd command to retrieve the size of the pointer:
{{{
grep "^ac_cv_sizeof_void_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_void_p itself comes from dpkg-cross: /etc/dpkg-cross/cross-config.arm

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.

  • Emdebian and lintian - see EmdebianPolicy. The lintian checks in [wiki:emdebian-tools emdebian-tools] 0.9.4 are aimed at establishing the basic rules and pitfalls in crossbuilding for Emdebian.

  • ?BusyBoxIssues - The use of busybox to replace various parts of a debian system introduces a pile of thorny issues around allowing such replaceability and the tradoffs between busybox smallness/lack-of-perl and debian compatibilty.

  • SQLite sqliteBtreeOpen - hidden in the sqlite source is this warning:

 # 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_void_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_void_p itself comes from dpkg-cross: /etc/dpkg-cross/cross-config.arm

  • busybox and mktemp - although mktemp is installed (and supports 'mktemp -p'), busybox gets in the way and complains that the busybox version of mktemp does not support '-p'. No symlink exists for busybox - it seems to have some intrinsic hangup about handling mktemp. Passing the full path to the real mktemp is a workaround:

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
  • startx - from the xinit package. A few problems here: startx is a bash script but this appears to be unnecessary, it could easily be /bin/sh. However, the script is generated within the xinit package (which itself is compiled). It also requires /usr/bin/mcookie which comes from util-linux which brings in tzdata (which has not been split yet so is v.large). A dependency on xauth is also needed but that should be manageable. Finally, startx is just a convenience - it should be possible to do without it. (The script itself comments: Site administrators are STRONGLY urged to write nicer versions.)

  • xserver-xorg-core - provides /usr/bin/Xorg but is not installable - need more packages built. The dependency on xserver-xorg has been removed - it is a pseudo-package that depends on all the xserver protocols and dependencies. Ensure each installation has a customised set of packages that meet the actual dependencies of the X server on that machine.

  • debconf and cdebconf : reminder. To install packages using cdebconf instead of debconf, copy one environment variable from the emsandbox implementation:

        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.

  • calculators - GPE has gpe-calculator which we could use but Debian does seem to have a lot of calculators already. there should be one that will fit. gcalctool depends on gconf2 which is currently uninstallable because liborbit does not cross build.

  • dpkg --unpack - It is important for Emdebian that the most of the normal debootstrap second stage operations can be done on the build machine so that actual installation time on the embedded device is kept to a minimum. The aim is to create a foreign filesystem image that simply needs to be copied onto the flash and configured. dpkg --unpack would seem to be the obvious choice but it has a problem - it expects to unpack into the root directory. In a normal debootstrap second stage, that is not a problem because dpkg --unpack is simply called via chroot. Once we have a --foreign debootstrap, we cannot chroot into it on the build machine, only the host. This would mean that dpkg --unpack would overwrite binaries on the build machine with binaries of the host architecture which is not good.

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.