Re: chroot setup problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Fri, Apr 22, 2016 at 09:36:57AM -0400, Haines Brown wrote:
> On Fri, Apr 22, 2016 at 10:36:36AM +0100, Karl E. Jorgensen wrote:
>
> > > # LANG=C.UTF8 /usr/sbin/chroot /mnt/debinst /bin/bash
> > > /usr/sbin/chroot: failed to run command `/bin/bash': No such file or
> > > directory
> > >
> > > /usr/bin/chroot exists. So does /mnt/debinst. So does /bin/bash.
> >
> > /bin/bash is irrelevant in this context - the filename will be looked
> > up _inside_ the chroot, so you need to check that
> > /mnt/debinst/bin/bash exists (and the shared libraries it uses...)
> >
> > Hope this helps
> > Karl
>
> As for existence of /bin/bash in reference to new chroot:
>
> $ ls -la /mnt/debinst/bin | grep bash
> -rwxr-xr-x 1 root root 941252 Apr 22 06:22 bash
>
> As for libraries, bash needs these:
>
> $ ldd /bin/bash
> linux-gate.so.1 => (0xb773e000)
> libtinfo.so.5 => /lib/i386-linux-gnu/libtinfo.so.5 (0xb7702000)
> libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xb76fe000)
> libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb7599000)
> /lib/ld-linux.so.2 (0xb773f000)
>
> So I create directories and copy libraries to them. I didn't understand
> the first line and apparently there is no linux-gate.so.1 on my
> system. Other than it, I now have:
>
> $ ls /mnt/debinst/lib
> i386-linux-gnu ld-linux.so.2
>
> $ ls /mnt/debinst/lib/i386*
> i686 libtinfo.so.6
>
> $ ls -la /mnt/debinst/lib/i386*/i686/cmov
> ...
> -rwxr-xr-x 1 root root 1446056 Apr 22 08:47 libc.so.6
> -rw-r--r-- 1 root root 9844 Apr 22 08:49 libdl.so.2
>
> Now chroot command has better luck:
>
> # LANG=C.UTF-8 /usr/sbin/chroot /mnt/debinst/
> bash-4.2#
>
> I guess copying over the libraries was the answer. However, my chroot
> prompt used to appear as: root@hostname:/#, so I'm not sure I'm in
> chroot.
Easy: if you can't see the "rest of the world" (that is the things you
haven't copied over/bind-mounted etc.) then you most probably are :-)
regards
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAlcaLM8ACgkQBcgs9XrR2kYZUACdEOM/kFg9imCKinslqUQaw6lP
mHoAnilVMOCFGsBxNhEAja1AEYAIDhm7
=TLH8
-----END PGP SIGNATURE-----
Reply to: