This error means that there is no
/bin/bash directory inside chroot. Make sure you point it to where
bash (or other shell’s) executable is in
If you have
/mnt/somedir/usr/bin/bash then execute
chroot /mnt/somedir /usr/bin/bash.
Apart from the above, you also need to add
libc directory dependencies, as mentioned in the answer here.
/bin/bash inside chrooted directory, but I didn’t have
/lib64 inside it. The message from
chroot could be more descriptive. “no such file or directory” really means “I can’t run this…”.
/bin/bash depends of course on
libdl etc., you can use
ldd /bin/bash to see which libraries it requires.
- You can
mount -o bindthese directories under
- Or you can copy these libraries to
chroot, if you don’t trust the chrooted env to not corrupt them, like so:
cp -a /usr rootfs/ cp -a /lib rootfs/ cp -a /lib64 rootfs/
chroot tries to start the shell that is set in your
$SHELL environment variable by default, but it looks for it in your new root dir, which seems not to contain
/bin/bash, so it cannot start.
You can tell chroot to start another program inside the new root by simply adding it as a parameter:
chroot /your/new/root /bin/foo --options...
Note that the path of the command is interpreted inside your new root, so in this example the called program is in fact in