Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example fails #24

Open
pirj opened this issue Jan 5, 2015 · 7 comments
Open

Example fails #24

pirj opened this issue Jan 5, 2015 · 7 comments

Comments

@pirj
Copy link

pirj commented Jan 5, 2015

Host system: Arch Linux with 3.14 kernel

$ mkdir /tmp/fake1
$ id
uid=1000(pirj) gid=100(users) groups=100(users)
$ fakechroot fakeroot debootstrap sid /tmp/fake1
I: Keyring file not available at /usr/share/keyrings/debian-archive-keyring.gpg; switching to https mirror https://mirrors.kernel.org/debian
I: Retrieving Release
...
I: Installing core packages...
W: Failure trying to run: chroot /tmp/fake1 dpkg --force-depends --install /var/cache/apt/archives/base-passwd_3.5.37_i386.deb
W: See /tmp/fake1/debootstrap/debootstrap.log for details (possibly the package base-passwd is at fault)

In log file:

dpkg: warning: parsing file '/var/lib/dpkg/status' near line 5 package 'dpkg':
 missing description
dpkg: warning: parsing file '/var/lib/dpkg/status' near line 5 package 'dpkg':
 missing architecture
dpkg-deb: /usr/lib/liblzma.so.5: no version information available (required by dpkg-deb)
Selecting previously unselected package base-passwd.
(Reading database ... 0 files and directories currently installed.)
Preparing to unpack .../base-passwd_3.5.37_i386.deb ...
Unpacking base-passwd (3.5.37) ...
dpkg-deb: /usr/lib/liblzma.so.5: no version information available (required by dpkg-deb)
dpkg: base-passwd: dependency problems, but configuring anyway as you requested:
 base-passwd depends on libc6 (>= 2.8); however:
  Package libc6 is not installed.
 base-passwd depends on libdebconfclient0 (>= 0.145); however:
  Package libdebconfclient0 is not installed.

Setting up base-passwd (3.5.37) ...
update-passwd: error while loading shared libraries: libdebconfclient.so.0: cannot open shared object file: No such file or directory
update-passwd: error while loading shared libraries: libdebconfclient.so.0: cannot open shared object file: No such file or directory
dpkg: error processing package base-passwd (--install):
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 base-passwd

Same debootstrap sid /tmp/fakeX is working fine under root.

$ fakechroot fakeroot debootstrap --include=libc6,libdebconfclient0 sid /tmp/fake2 doesn't make much difference:

dpkg: warning: parsing file '/var/lib/dpkg/status' near line 5 package 'dpkg':
 missing description
dpkg: warning: parsing file '/var/lib/dpkg/status' near line 5 package 'dpkg':
 missing architecture
dpkg-deb: /usr/lib/liblzma.so.5: no version information available (required by dpkg-deb)
Selecting previously unselected package base-passwd.
(Reading database ... 0 files and directories currently installed.)
Preparing to unpack .../base-passwd_3.5.37_i386.deb ...
Unpacking base-passwd (3.5.37) ...
dpkg-deb: /usr/lib/liblzma.so.5: no version information available (required by dpkg-deb)
dpkg: base-passwd: dependency problems, but configuring anyway as you requested:
 base-passwd depends on libc6 (>= 2.8); however:
  Package libc6 is not installed.
 base-passwd depends on libdebconfclient0 (>= 0.145); however:
  Package libdebconfclient0 is not installed.

Setting up base-passwd (3.5.37) ...
update-passwd: error while loading shared libraries: libdebconfclient.so.0: cannot open shared object file: No such file or directory
update-passwd: error while loading shared libraries: libdebconfclient.so.0: cannot open shared object file: No such file or directory
dpkg: error processing package base-passwd (--install):
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 base-passwd
@pirj
Copy link
Author

pirj commented Jan 5, 2015

I can see the files though:

/tmp/fake2/usr/lib/i386-linux-gnu/libdebconfclient.so.0
/tmp/fake2/usr/lib/i386-linux-gnu/libdebconfclient.so.0.0.0

@pirj
Copy link
Author

pirj commented Jan 5, 2015

There is such a file though:

/tmp/fake2/usr/lib/i386-linux-gnu/libdebconfclient.so.0
/tmp/fake2/usr/lib/i386-linux-gnu/libdebconfclient.so.0.0.0

And:

$ fakechroot fakeroot chroot /tmp/fake2
/usr/bin/chroot.fakechroot: line 93: 20239 Segmentation fault      (core dumped) env -u FAKECHROOT_BASE_ORIG FAKECHROOT_CMD_ORIG= LD_LIBRARY_PATH="$fakechroot_chroot_paths" FAKECHROOT_BASE="$fake
chroot_chroot_base" "$fakechroot_chroot_chroot" "${@:1:$(($fakechroot_chroot_n - 1))}" "${fakechroot_chroot_newroot#$FAKECHROOT_BASE_ORIG}" "${@:$(($fakechroot_chroot_n + 1))}"

Is anything I can to to help debugging this?

@thecsapprentice
Copy link

I would also like to confirm this issue on Redhat 6 host system. Running the example worked fine up until the command:

$ fakechroot fakeroot chroot /scratch.1/DEBIAN_ROOT apt-get install -q hello
/scratch/SOFTWARE/sbin/chroot.fakechroot: line 93: 11588 Segmentation fault      (core dumped) env -u FAKECHROOT_BASE_ORIG FAKECHROOT_CMD_ORIG= LD_LIBRARY_PATH="$fakechroot_chroot_paths" FAKECHROOT_BASE="$fakechroot_chroot_base" "$fakechroot_chroot_chroot" "${@:1:$(($fakechroot_chroot_n - 1))}" "${fakechroot_chroot_newroot#$FAKECHROOT_BASE_ORIG}" "${@:$(($fakechroot_chroot_n + 1))}"

Running the chroot command without the path argument gives me this:

$ fakechroot fakeroot chroot
ERROR: ld.so: object 'libfakeroot.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object 'libfakechroot.so' from LD_PRELOAD cannot be preloaded: ignored.
/usr/sbin/chroot: missing operand
Try `/usr/sbin/chroot --help' for more information.

My system information:

$ uname -a
Linux neumann.cs.wisc.edu 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Dec 13 06:58:20 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

I would also be interested in helping debugging this issue. Being able to run a debian distribution from a non-root directory and without root access would be really useful to me.

@sbach
Copy link

sbach commented Dec 30, 2015

Hoping to help solve such an old open issue, here is my experience about this issue.

As @pirj, on a Debian Stretch machine:

$ fakechroot fakeroot -i fakeroot.env -s fakeroot.env \
    chroot <directory> /bin/bash
/usr/sbin/chroot.fakechroot: line 93:  6323 Segmentation fault
env -u FAKECHROOT_BASE_ORIG FAKECHROOT_CMD_ORIG= LD_LIBRARY_PATH="$fakechroot_chroot_paths" FAKECHROOT_BASE="$fakechroot_chroot_base" "$fakechroot_chroot_chroot" "${@:1:$(($fakechroot_chroot_n - 1))}" "${fakechroot_chroot_newroot#$FAKECHROOT_BASE_ORIG}" "${@:$(($fakechroot_chroot_n + 1))}"

Looking for shell environment issues, I tried to put the chroot command into an executable shell script file and let fakeroot execute it. It seems that when wrapping the chroot command in a bash shell, the segault is gone:

$ cat test.sh
#!/bin/bash
chroot <directory> /bin/bash

$ fakechroot fakeroot -i fakeroot.env -s fakeroot.env \
    ./test.sh
#
[or/and] 
$ fakechroot fakeroot -i fakeroot.env -s fakeroot.env \
    /bin/bash -c "chroot <directory> /bin/bash
#

Note: When is a deboostrap generated filesystem the segfault is here for the "jessie" suite but not "sid".

@vbkaisetsu
Copy link

Maybe, "--use-system-libs" should support multiarch.

Currently, this option just adds "/lib" and "/usr/lib" to LD_LIBRARY_PATH, but libc.so is installed in /lib/x86_64-linux-gnu in the latest Debian 64bit.

When you run the chroot on a shell script, it doesn't read /etc/ld.so.conf, so many directories are missing from LD_LIBRARY_PATH. The error message is gone, but many programs (e.g. apt-get) don't work.

$ echo $LD_LIBRARY_PATH
(BASE)/usr/lib:(BASE)/lib

I tried the following command. It works good.

$ export LD_LIBRARY_PATH=/lib:/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:/lib:${BASE}/usr/lib/x86_64-linux-gnu/libfakeroot:${BASE}/usr/local/lib:${BASE}/lib/x86_64-linux-gnu:${BASE}/usr/lib/x86_64-linux-gnu:${BASE}/usr/lib:${BASE}/lib
$ fakechroot /bin/bash -c "chroot ${BASE}"

@Hi-Angel
Copy link

Maybe, "--use-system-libs" should support multiarch.

Doesn't help for me:

 λ fakeroot fakechroot --use-system-libs /usr/sbin/chroot . /bin/bash
/bin/bash: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

@Hi-Angel
Copy link

So, I found there is a workaround. If you add to LD_LIBRARY_PATH the full path to libraries inside your chroot, including part of the path through your host system, it will help.

Unfortunately there is another error, something from ld, however this seems a separate problem.

So, example:

 λ LD_LIBRARY_PATH="$(pwd)/lib/x86_64-linux-gnu" fakeroot fakechroot -s /usr/sbin/chroot . /bin/bash
Inconsistency detected by ld.so: dl-call-libc-early-init.c: 37: _dl_call_libc_early_init: Assertion `sym != NULL' failed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants