Gentoo + debootstrap failing when used with fakeroot and fakechroot
Asked Answered
A

1

9

I'm using a Gentoo box and I want to create Debian-based chroot environments without using the root account or sudo.

This seems to be possible using tools such as fakeroot and fakechroot, but so far I haven't had any success with them. Here is the command that I'm using for Precise:

fakeroot fakechroot /usr/sbin/debootstrap --variant=fakechroot precise ./precise http://archive.ubuntu.com/ubuntu/

It always fails with the same error:

I: Installing core packages...
W: Failure trying to run: chroot precise dpkg --force-depends --install /var/cache/apt/archives/base-passwd_3.5.24_amd64.deb
W: See precise/debootstrap/debootstrap.log for details

And the contents of debootstrap.log are:

dpkg: error while loading shared libraries: libselinux.so.1: cannot open shared object file: No such file or directory

I have no idea why SELinux is being pulled in and why it's not properly handling this dependency. Also, I've tried to build Wheezy and Jessie as well. Same error.

What's going on? Versions:

debootstrap-1.0.67

fakeroot-1.19

fakechroot-2.17.2

kernel-3.19.6

Agreeable answered 11/5, 2015 at 1:50 Comment(2)
I don't see how fakeroot helps you here. To be clear, where are you trying to install your chroot? And why do you want to do this without using root?Cureton
chroot won't launch without fakeroot (non-root account). I'm following some tutorials, but it doesn't work on my environment. And I'd like to setup custom build environments without having to give extra privileges to the user. Docker could be used, but it has the same problems (or more) when you try to use it as a normal user.Agreeable
C
1

fakeroot and fakechroot are not the problem here. It looks like libselinux.so.1 was used when dpkg was originally built. First, try the locate command:

locate libselinux

without the version. This should 1) confirm that it truly does not exist, or 2) that it does exist, but not in your $LD_LIBRARY_PATH or default library search path.

If locate turns up another version, use the ln -s command to create the symlink (libselinux.so.1) pointing to the existing version you do have.

To see the dependency, run:

ldd `which dpkg`
Charybdis answered 20/5, 2015 at 20:35 Comment(3)
It works as root, but not as a normal user with fakeroot and fakechroot. That's not the point of the question.Agreeable
OK. When it fails, the library is not found. I'm betting the search path is different for root, which succeeds, than the search path in use for fakeroot. Do you have strace to show you everything examined? It shows every path attempted, even when not in LD_LIBRARY_PATH.Charybdis
ERROR: ld.so: object 'libfakeroot.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. if point LD_LIBRARY_PATH to libselinux pathTimotheus

© 2022 - 2024 — McMap. All rights reserved.