-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, Apr 22, 2016 at 06:57:17AM -0400, Haines Brown wrote:
> On Fri, Apr 22, 2016 at 12:04:41AM +0000, Mark Fletcher wrote:
> > 
> > On Fri, 22 Apr 2016 at 08:18, Haines Brown <hai...@histomat.net> wrote:
> > 
> >     I attempt to chroot from /dev/sdb on /dev/sda.
> > 
> >       # mount /dev/sda1 /mnt/debinst
> > 
> >     I verify it is mounted and then do:
> > 
> >       # LANG=C.UTF8 /usr/sbin/chroot /mnt/debinst /bin/bash
> >       /usr/sbin/chroot: failed to run command `/bin/bash': No such file or
> >         directory
>  
> > Does /mnt/debinst/bin/bash exist?
> > 
> > It's looking for /bin/bash in the chrooted environment and not finding it.
> 
> I fixed this and:
> 
>   $ ls -la /mnt/debinst/bin
>   ...
>   -rwxr-xr-x  1 root   root   941252 Apr 22 06:22 bash
> 
> but still:
> 
>   # LANG=C.UTF8 chroot /mnt/debinst /mnt/debinst/bin/bash
>   chroot: failed to run command `/mnt/debinst/bin/bash':
>     No such file or directory

Once chrooted, the system "sees" /mnt/debinst/bin/bash as /bin/bash.

So in the chroot environment you have to invoke /bin/bash.

Don't forget the libraries. On my system, bash needs:

  tomas@rasputin:~$ ldd /bin/bash
          linux-vdso.so.1 (0x00007ffe1ed62000)
          libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 
(0x00007fe653e81000)
          libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe653c7d000)
          libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe6538d8000)
          /lib64/ld-linux-x86-64.so.2 (0x000055a841653000)

Bash has to "see" them on the same paths, so you'd need to make them
available (copy, bind-mount, whatever) on /mnt/debinst/lib/...

regards
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlcaBNMACgkQBcgs9XrR2kYEkwCfQFX6Jom+VS/Cl2p46wRiH6tw
ZsQAn3zQyxbsnPsmdtNvz0AQnHJgxLQl
=8nnp
-----END PGP SIGNATURE-----

Reply via email to