Solved

Linux chroot failed

Posted on 2014-04-25
4
882 Views
Last Modified: 2014-04-27
Hello Experts,

[root@localhost mnt]# chroot lfs/
chroot: failed to run command `/bin/bash': No such file or directory
[root@localhost mnt]#


I building LFS from scrath when i issue the command. i'm getting this above error..

Please tell what's going on..

I feel something with shared library making some issue while i issue this command.

Thanks!
Pusp
0
Comment
Question by:Puspharaj Selvaraj
  • 2
4 Comments
 
LVL 25

Expert Comment

by:Zephyr ICT
ID: 40022741
Did you try with the full path "chroot /mnt/lfs"
0
 
LVL 2

Author Comment

by:Puspharaj Selvaraj
ID: 40022915
Yes i did. same error.
0
 
LVL 25

Expert Comment

by:Zephyr ICT
ID: 40022974
Are you trying to enter the Chroot environment?

If so, maybe you need to specify which program needs to be executed ... Like explained in chapter 6.4 (http://www.linuxfromscratch.org/lfs/view/stable/chapter06/chroot.html)

Like so:

chroot /mnt/lfs /tools/bin/env -i HOME=/root TERM="$TERM"  PS1='\u:\w\$ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h

Open in new window


You'll need to adjust for your setup/config ...
0
 
LVL 3

Accepted Solution

by:
egarciat earned 500 total points
ID: 40023178
You may need to have "/bin/bash" in /mnt/lfs/bin/bash and all libs that bash uses also in /mnt/ifs/lib

You can see which libraries bash uses with the command ldd, ldd /bin/bash

In my system bash uses the following libraries:

# ldd /bin/bash
      linux-gate.so.1 =>  (0xffffe000)
        libtermcap.so.2 => /lib/libtermcap.so.2 (0xb77fc000)
        libdl.so.2 => /lib/libdl.so.2 (0xb77f8000)
        libc.so.6 => /lib/libc.so.6 (0xb7698000)
        /lib/ld-linux.so.2 (0xb780e000)

So you may need to copy all of these libraries to the lib directory inside your new root which is /mnt/ifs/lib

Use "cp -a" and wildcard in order to copy even symlinks.

cp -a /lib/libtermcap* /mnt/ifs/lib

Some libraries may depend on other libraries, and you can inspect it with ldd also.

ldd /lib/libtermcap.so.2
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question