Solved

Linux chroot failed

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ifconfig 4 91
PHP error function not working on AWS 10 123
block mails from a particular country in postfix 7 47
regular expression help for sed command 5 39
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

740 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