[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: polystrap

Hi Larry,

(CC-ed to debian-embedded@l.d.o with permissiod of Larry)

Quoting Larry Doolittle (2015-01-14 08:50:35)
> Josh -

it's josch ;)

> I've been struggling with fakeroot+fakechroot+debootstrap etc. for days now
> (in my spare time, which is necessarily limited).
> I finally ran across polystrap, which looks perfect!  But I haven't
> made it work yet.  My development machine is jessie amd64.
> The README is at least out of date,

correct, I last looked at polystrap around 2012. Because of shortcomings of
fakeroot/fakechroot/qemu at the time it never became more than a proof of
concept. And even now, the shortcomings of fakeroot/fakechroot do not make it
more than a nice toy in my eyes.

> in the FAKEROOT/FAKECHROOT section it should probably look something like
> wget http://ftp.debian.org/debian/pool/main/f/fakeroot/libfakeroot_1.20.2-1_armel.deb
> dpkg -X libfakeroot_1.20.2-1_armel.deb
> wget http://ftp.debian.org/debian/pool/main/f/fakechroot/libfakechroot_2.17.2-1_armel.deb
> dpkg -X libfakechroot_2.17.2-1_armel.deb /

this should be unnecessary as libfakeroot and libfakechroot are now multiarch
capable. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=636192

> But I can't be sure, because I think my polystrap runs trip up the first time
> fakeroot/fakechroot get exercised.  When trying kirkwood, with a couple net
> packages turned off and config SUITE="jessie", the ending is
> I: convert symlink: /lib/systemd/system/fuse.service -> /dev/null
> I: convert symlink: /lib/systemd/system/rmnologin.service -> /dev/null
> I: convert symlink: /bin/systemd -> /lib/systemd/systemd
> I: convert symlink: /bin/pidof -> /sbin/killall5
> I: copy initial directory root tree kirkwood/root/ to /home/larry/git/polystrap/debian-jessie-armel-2015-01-13/
> I: preseed debconf
> ERROR: ld.so: object 'libfakechroot.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
> ERROR: ld.so: object 'libfakeroot-sysv.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
> debconf: DbDriver "passwords" warning: could not open /var/cache/debconf/passwords.dat: Permission denied
> debconf: DbDriver "config": could not write /var/cache/debconf/config.dat-new: Permission denied
> Any hints?

this is because qemu does not have access to the libfakechroot library of
correct architecture. By default qemu will look in /etc/qemu-binfmt/$arch/
(where $arch is the qemu architecture) for the shared libraries but since my
qemu patch to pass a different elf interpreter prefix using the QEMU_LD_PREFIX
environment variable (instead of just the -L option which is useless when using
qemu user mode) has been integrated upstream you can set that variable instead
and point it to your chroot environment.

> I can take this to a mailing list if you'd rather, and/or include
> the full 652-line log file.

I don't think there is somebody who's using polystrap right now. Even I have
pretty much given up on it.

Though you might want to have a look at brickstrap:


they forked polystrap for the purpose of building foreign architecture armel
root file systems for the LEGO ev3 platform. Since this project is very active,
their code should be working fine.

> I do wish for a quick way to test the interaction of fakeroot, fakechroot,
> chroot, and qemu-user-static.

Unfortunately my time is also limited.

I would like if there was a way to use chroot without superuser privileges (see
my rant at
) but by now I'm not sure whether fakeroot and fakechroot are a good way to do
this as their usefulness is limited to those use cases which do not need
LD_PRELOAD functionality themselves.

By now I'd say that you should either have a look at proot (http://proot.me/)
which doesn't use LD_PRELOAD but the ptrace system call. It also works well
together with qemu. At https://github.com/josch/polystrap you will find another
either fork or continuation of the original (whatever you want to call it) of
polystrap which uses proot instead of fakeroot/fakechroot because of the
shortcomings of the latter.

Though of course proot has its own shortcomings which make it not-quite a
drop-in replacement for a real chroot. If this is important to you, then have a
look at the linux-specific unshare system call, or LXC as a higher level tool.

If you you don't want to be linux-specific, I guess your only other option is
qemu full system emulation (qemu is currently only unavailable for the HURD).
The adt-virt-qemu scripts shows how to control a qemu instance via serial, as
if one would work in a chroot:

> Every time I try a new configuration, debootstrap/multistrap first has to
> download ~100 KiB of .deb files.

You might want to install apt-cacher or apt-cacher-ng and then use the mirror
url instead.

cheers, josch

Attachment: signature.asc
Description: signature

Reply to: