LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 07-21-2005, 10:08 AM   #1
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Rep: Reputation: 56
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

Last edited by satimis; 07-21-2005 at 10:12 AM.
 
Old 07-21-2005, 10:53 AM   #2
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
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

Last edited by satimis; 07-21-2005 at 10:59 AM.
 
Old 07-21-2005, 10:15 PM   #3
freegianghu
Member
 
Registered: Oct 2004
Location: somewhere in the street
Distribution: Window$
Posts: 192

Rep: Reputation: 30
Did you miss to run make install when you were installing bash?
 
Old 07-21-2005, 10:34 PM   #4
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
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
 
Old 07-21-2005, 11:43 PM   #5
freegianghu
Member
 
Registered: Oct 2004
Location: somewhere in the street
Distribution: Window$
Posts: 192

Rep: Reputation: 30
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

Cheers,
GH
 
Old 07-22-2005, 12:33 AM   #6
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
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
 
Old 07-24-2005, 11:39 AM   #7
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi freegianghu,

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

Tks

B.R.
satimis
 
Old 03-15-2010, 05:24 AM   #8
rajanicinesoft
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Rep: Reputation: 0
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
 
Old 03-15-2010, 05:49 AM   #9
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
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?..
 
Old 03-15-2010, 08:38 AM   #10
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash -command not found- ALInux Linux - Newbie 3 12-30-2006 12:41 PM
bash: command not found intels_ss Linux - Newbie 5 07-20-2005 07:41 PM
-bash: ls: command not found jchun Linux - General 3 11-02-2004 10:11 AM
bash -command not found- K3V Linux - Newbie 7 09-30-2004 03:57 PM
bash: ll: command not found x2000koh Linux - Newbie 3 08-08-2003 05:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 06:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration