Solved

Linux chroot failed

Posted on 2014-04-25
4
828 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now