Solved

Linux chroot failed

Posted on 2014-04-25
4
907 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.
Suggested Courses

738 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