LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   bash: chroot: command not found (https://www.linuxquestions.org/questions/linux-from-scratch-13/bash-chroot-command-not-found-345379/)

satimis 07-21-2005 10:08 AM

bash: chroot: command not found
 
Hi folks,

LFS6.1

Continued on
6.2. Mounting Virtual Kernel File Systems
http://www.linuxfromscratch.org/lfs/...06/kernfs.html

lfs:/mnt/lfs/sources$ exit
exit
[root@localhost satimis]# mkdir -p $LFS/{proc,sys}
[root@localhost satimis]# mount -t proc proc $LFS/proc
[root@localhost satimis]# mount -t sysfs sysfs $LFS/sys
[root@localhost satimis]# mount -f -t tmpfs tmpfs $LFS/dev
[root@localhost satimis]# mount -f -t tmpfs tmpfs $LFS/dev/shm
[root@localhost satimis]# mount -f -t devpts -o gid=4,mode=620 devpts $LFS/dev/pts

All went through without complaint.

Contiued on
6.3. Entering the Chroot Environment
http://www.linuxfromscratch.org/lfs/...06/chroot.html

[root@localhost satimis]# echo $LFS
/mnt/lfs
[root@localhost satimis]# chroot "$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
Code:

bash: chroot: command not found
Re-tried
[root@localhost satimis]# chroot "$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
Code:

bash: chroot: command not found
[root@localhost satimis]# /usr/sbin/chroot "$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
Code:

/tools/bin/env: /tools/bin/bash: No such file or directory
[root@localhost satimis]# ls -al /usr/sbin/ | grep chroot
Code:

-rwxr-xr-x  1 root root    15648 Oct  5  2004 chroot
What is the cause of the problem? TIA

B.R.
satimis

satimis 07-21-2005 10:53 AM

Hi folks,

re: /tools/bin/env: /tools/bin/bash: No such file or directory

I made following test;

[root@localhost satimis]# ldd /tools/bin/env
Code:

        linux-gate.so.1 =>  (0x00c0e000)
        libc.so.6 => /tools/lib/libc.so.6 (0x00d27000)
        /tools/lib/ld-linux.so.2 (0x00c24000)

[root@localhost satimis]# ldd /mnt/lfs/tools/bin/env
Code:

        linux-gate.so.1 =>  (0x008e4000)
        libc.so.6 => /tools/lib/libc.so.6 (0x0039a000)
        /tools/lib/ld-linux.so.2 (0x007b6000)

[root@localhost satimis]# ldd /tools/bin/bash
Code:

ldd: /tools/bin/bash: No such file or directory
[root@localhost satimis]# ldd /mnt/lfs/tools/bin/bash
Code:

ldd: /mnt/lfs/tools/bin/bash: No such file or directory
[root@localhost satimis]# ls -al /mnt/lfs/tools/bin/ | grep bash
Code:

lrwxrwxrwx  1 lfs lfs        4 Jul 21 17:55 sh -> bash
B.R.
satimis

freegianghu 07-21-2005 10:15 PM

Did you miss to run make install when you were installing bash?

satimis 07-21-2005 10:34 PM

Hi freegianghu.

Quote:

Did you miss to run make install when you were installing bash?
No.

Hereinunder are the steps taken down on my notes;
Code:

5.27. Bash-3.0
http://www.linuxfromscratch.org/lfs/...er05/bash.html

lfs:/mnt/lfs/sources/texinfo-4.8$ cd ../
lfs:/mnt/lfs/sources$ tar xjf bash-3.0.tar.bz2
lfs:/mnt/lfs/sources$ cd bash-3.0
lfs:/mnt/lfs/sources/bash-3.0$ patch -Np1 -i ../bash-3.0-avoid_WCONTINUED-1.patch
patching file jobs.c
Hunk #1 succeeded at 2471 (offset -5 lines).
lfs:/mnt/lfs/sources/bash-3.0$ ./configure --prefix=/tools �Vwithout-bash-malloc
lfs:/mnt/lfs/sources/bash-3.0$ make
lfs:/mnt/lfs/sources/bash-3.0$ make install
lfs:/mnt/lfs/sources/bash-3.0$ ln -s bash /tools/bin/sh

All went through without complaint. I can remove it and do it again.

Hereinunder are steps performed with "re-start" the FC3

[satimis@localhost ~]$ su
Password:
[root@localhost satimis]# export LFS=/mnt/lfs
[root@localhost satimis]# mount /dev/hda6 $LFS
[root@localhost satimis]# mkdir -p $LFS
[root@localhost satimis]# echo $LFS
/mnt/lfs

Continued
[root@localhost satimis]# mkdir -p $LFS/{proc,sys}
[root@localhost satimis]# mount -t proc proc $LFS/proc
Code:

mount: proc already mounted or /mnt/lfs/proc busy
mount: according to mtab, proc is already mounted on /mnt/lfs/proc

[root@localhost satimis]# mount -t sysfs sysfs $LFS/sys
Code:

mount: sysfs already mounted or /mnt/lfs/sys busy
mount: according to mtab, sysfs is already mounted on /mnt/lfs/sys

[root@localhost satimis]# mount -f -t tmpfs tmpfs $LFS/dev
[root@localhost satimis]# mount -f -t tmpfs tmpfs $LFS/dev/shm
[root@localhost satimis]# mount -f -t devpts -o gid=4,mode=620 devpts $LFS/dev/pts
[root@localhost satimis]# chroot "$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
Code:

bash: chroot: command not found
[root@localhost satimis]# /usr/sbin/chroot "$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
Code:

/tools/bin/env: /tools/bin/bash: No such file or directory
[root@localhost satimis]# ldd /mnt/lfs/tools/bin/bash
Code:

ldd: /mnt/lfs/tools/bin/bash: No such file or directory
[root@localhost satimis]# ldd /mnt/lfs/tools/bin/env
Code:

        linux-gate.so.1 =>  (0x003ee000)
        libc.so.6 => /tools/lib/libc.so.6 (0x00b73000)
        /tools/lib/ld-linux.so.2 (0x00f9d000)

I can't under why I got through "chrooting" on LFS 6.0 but failed on LFS 6.1

B.R.
satimis

freegianghu 07-21-2005 11:43 PM

You may have two problems:

1. bash: chroot: command not found. Could you find chroot command on your host system (which chroot)?
2. ldd: /mnt/lfs/tools/bin/bash: No such file or directory. You must make sure there is a bash program in /mnt/lfs/tools/bin/ in order to continue :D

Cheers,
GH

satimis 07-22-2005 12:33 AM

Hi freegianghu,

Quote:

1. bash: chroot: command not found. Could you find chroot command on your host system (which chroot)?
Yes

[satimis@localhost ~]$ su -
Password:
[root@localhost ~]# which chroot
/usr/sbin/chroot
[root@localhost ~]# ls -al /usr/sbin/chroot
-rwxr-xr-x 1 root root 15648 Oct 5 2004 /usr/sbin/chroot

I must run it with full path on LFS 6.1. On LFS 6.0 no full path was required. I don't know its reason. But both on the same host FC3

Quote:

2. ldd: /mnt/lfs/tools/bin/bash: No such file or directory. You must make sure there is a bash program in /mnt/lfs/tools/bin/ in order to continue [/B]
[root@localhost ~]# ls -al /mnt/lfs/tools/bin/ | grep bash
lrwxrwxrwx 1 lfs lfs 4 Jul 21 17:55 sh -> bash

I got through this 'chroot' step on LFS 60.

The installation steps on LFS 6.0 as follows (taken down on Notes)
5.29. Bash-3.0
http://www.sg.linuxfromscratch.org/l...er05/bash.html
(removed)
Code:

lfs:/mnt/lfs/sources/texinfo-4.7$ cd ../
lfs:/mnt/lfs/sources$ tar jxvf bash-3.0.tar.bz2 
lfs:/mnt/lfs/sources$ cd bash-3.0
lfs:/mnt/lfs/sources/bash-3.0$ ./configure --prefix=/tools --without-bash-malloc
lfs:/mnt/lfs/sources/bash-3.0$ make 
lfs:/mnt/lfs/sources/bash-3.0$ make install
lfs:/mnt/lfs/sources/bash-3.0$ ln -s bash /tools/bin/sh

On LFS 6.1 (taken down on Notes)
5.27. Bash-3.0
http://www.linuxfromscratch.org/lfs/...er05/bash.html

Steps taken down on Notes
Code:

lfs:/mnt/lfs/sources/texinfo-4.8$ cd ../
lfs:/mnt/lfs/sources$ tar xjf bash-3.0.tar.bz2
lfs:/mnt/lfs/sources$ cd bash-3.0
lfs:/mnt/lfs/sources/bash-3.0$ patch -Np1 -i ../bash-3.0-avoid_WCONTINUED-1.patch
patching file jobs.c
Hunk #1 succeeded at 2471 (offset -5 lines).
lfs:/mnt/lfs/sources/bash-3.0$ ./configure --prefix=/tools –without-bash-malloc
lfs:/mnt/lfs/sources/bash-3.0$ make
lfs:/mnt/lfs/sources/bash-3.0$ make install
lfs:/mnt/lfs/sources/bash-3.0$ ln -s bash /tools/bin/sh

The only difference is applying the patch file on the latter.

I'll delete Bash-30 and re-install it. If still haveing problme then I'll delete it again and re-install it without applying the patch.

B.R.
satimis

satimis 07-24-2005 11:39 AM

Hi freegianghu,

Please see my last posting on following thread;
http://www.linuxquestions.org/questi...79#post1762879

Tks

B.R.
satimis

rajanicinesoft 03-15-2010 05:24 AM

Hi...i also have a similar problem with chroot.It says as below:

chroot "$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

/tools/bin/env is present..i checked on that .I ran specs for gcc once again but still the same result.

One more thing.I have done all steps correctly as given in LFS book(version SVN-20100301) and i dont see any folder in /mnt/lfs/tools location.Is that the problem?
I copied the files from /tools/bin/ to /mnt/tools/ and again ran chroot but same result again.

Please help me. I am new to linux

konsolebox 03-15-2010 05:49 AM

You might have not setup the PATH variable yet. What does
Code:

echo "$PATH"
says? Try . /etc/profile or just include the full path to chroot like /tools/bin/chroot instead of just chroot.

Code:

/tools/bin/chroot "$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

I wonder if you should have created your own thread instead?..

crts 03-15-2010 08:38 AM

Quote:

/tools/bin/env is present..
What is the output of
Code:

ls -l /
mount

Maybe /tools is not a symlink. Maybe you did not mount the partition properly.
Quote:

I copied the files from /tools/bin/ to /mnt/tools/
This makes no sense since it should be /mnt/lfs/tools. You must have missed something in a previous step.
BTW, always post your host system and the LFS-book version you are using.


All times are GMT -5. The time now is 04:42 PM.