[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Linux chroot failed

Posted on 2014-04-25
4
Medium Priority
?
987 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 1500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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…
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…
Suggested Courses
Course of the Month12 days, 19 hours left to enroll

650 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