Gentoo Archives: gentoo-amd64

From: Daiajo Tibdixious <daiajo@×××××.com>
To: gentoo-amd64@l.g.o
Subject: Re: [gentoo-amd64] chroot can't find /bin/bash
Date: Wed, 07 Feb 2007 10:56:43
Message-Id: a4a9bfcb0702070254p799956b3m2cd2d819beceb9f4@mail.gmail.com
In Reply to: Re: [gentoo-amd64] chroot can't find /bin/bash by "Boyd Stephen Smith Jr."
1 On 2/7/07, Boyd Stephen Smith Jr. <bss03@××××××××××.net> wrote:
2 > On Tuesday 06 February 2007 21:03, Daiajo Tibdixious wrote:
3 > > I then built a /mnt/debug chroot using roughly
4 > > http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=2
5 > > (32bit chroot guild for AMD64) with the following binds:
6 > > mount -o bind /bin /mnt/debug/bin
7 > > mount -o bind /etc /mnt/debug/etc
8 > > mount -o bind /dev /mnt/debug/dev
9 > > mount -o bind /proc /mnt/debug/proc
10 > > mount -o bind /sys /mnt/debug/sys
11 > > mount -o bind /tmp /mnt/debug/tmp
12 > > mount -o bind /home/daiajo /mnt/debug/home/daiajo
13 > > and moved the /var/tmp/portage/transcode-*/image dirs into /mnt/debug
14 > > (just usr in this case)
15 > > The problem comes when trying to chroot into it:
16 > > # ls /bin/bash
17 > > /bin/bash
18 > > # ls /mnt/debug/bin/bash
19 > > /mnt/debug/bin/bash
20 > > # chroot /mnt/debug /bin/bash
21 > > chroot: cannot run command `/bin/bash': No such file or directory
22 >
23
24 > The problem is that one of the libraries that /bin/bash dynamically links
25 > to
26 > cannot be found inside the chroot. I suggest that you add /lib, and
27 > possibly /usr/lib to your list of bind mounts. That, or copy the libraries
28 > into the chroot.
29
30 Okay, will do (/lib and /usr/lib wheren't enough, but I will
31 investigate further tomorrow (its getting late here).
32
33 > inherent
34 > suck of C and UNIX to a poor example of excellent design under resource
35 > constraints that no longer exist. A fairly detailed, but hopefully
36 > understandable, description of what is happening follows:
37
38 :)
39
40 > As library functions, they don't write out error messages and exit the
41 > program directly. (The program calling them might write the messages
42 > somewhere other than stderr or discard them entirely. Also, it may be able
43 > to recover.) Instead they either return an error *code* directly, or place
44 > it in a well-known location that the caller should check. These error
45 > codes
46 > can be mapped to generic messages, but may not completely specify the
47 > error;
48 > in this case, exec (actually, probably even deeper in the bowels of glibc)
49 > tried to open a library and couldn't find it [probably looked in 1/2 dozen
50 > places for it, too :(] and returned the generic "File Not Found" error
51 > code.
52 > The chroot binary knows how it was called ("chroot"), what it was trying to
53 > do (execute "/bin/bash"), and the error code. It crams these bits of
54 > information together to try and give a human-readable error, but computers
55 > are stupid and it comes up with the misleading, "chroot: cannot run command
56 > `/bin/bash': No such file or directory", despite the fact that clearly
57 > exists
58 > in the chroot.
59
60 Thanks for the explanation, that makes it very clear.
61
62 > > Is there a better way to run a debug transcode without messing with
63 > > the live system?
64 >
65 > Not really, although the splitdebug FEATURE can give you a lot of the
66 > advantages of a full debug build without the runtime memory overhead.
67
68 Okay, I'm sold on splitdebug, thanks.
69 --
70 gentoo-amd64@g.o mailing list