Showing posts with label chroot bash "No such file or directory". Show all posts
Showing posts with label chroot bash "No such file or directory". Show all posts

Friday, October 8, 2010

chroot: failed to run command `/bin/bash': No such file or directory

MAY BE you put the library into wrong place(/lib or /lib64). 

test environment: I test this in a linux box which run gentoo x86_64, and wanna to chroot into a directory that contain files which copy from my running system.
for short: chroot in to a x86_64 system from a x86_64 system. 
sys-apps/coreutils-8.5

commad that i used is "chroot /tmp/newroot/ /bin/bash", i'm sure i had copied the bash program and library into /tmp/newroot, why this hapen?

# tree ./
├── bin
├── lib
│   ├── ld-linux-x86-64.so.2
│   ├── libc.so.6
│   ├── libdl.so.2
│   └── libncurses.so.5
├── lib64.tar
└── lib.tar
chroot into this dir will make error as: chroot: failed to run command `/bin/bash': No such file or directory

and put all library in /lib64 will be crooect, tree ./ show this: 
├── bin
├── lib64
│   ├── ld-linux-x86-64.so.2
│   ├── libc.so.6
│   ├── libdl.so.2
│   └── libncurses.so.5
├── lib64.tar
└── lib.tar

let's test it now:
# chroot ./ /bin/bash
I have no name!@localhost /$