LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 09-05-2005, 08:24 AM   #1
Basel
Member
 
Registered: Feb 2004
Location: United States
Distribution: Ubuntu 10.10
Posts: 319

Rep: Reputation: 30
chroot: cannot run command `/tools/bin/env': No such file or directory


Hello,

Does anyone know why chroot is not able to run /tools/bin/env?
Code:
root@slackware:/# chroot /mnt/lfs_x86_64/ /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
chroot: cannot run command `/tools/bin/env': No such file or directory
Code:
root@slackware:/# ls -l /tools/bin/en*
-rwxr-xr-x  1 lfs lfs 74828 2005-09-05 14:32 /tools/bin/env
-rwxr-xr-x  1 lfs lfs 37763 2005-09-05 14:59 /tools/bin/envsubst
root@slackware:/# ls -l /mnt/lfs_x86_64/tools/bin/en*
-rwxr-xr-x  1 lfs lfs 74828 2005-09-05 14:32 /mnt/lfs_x86_64/tools/bin/env
-rwxr-xr-x  1 lfs lfs 37763 2005-09-05 14:59 /mnt/lfs_x86_64/tools/bin/envsubst
Code:
root@slackware:/# ls -l /
total 16
drwxr-xr-x   2 root bin  2512 2005-08-14 19:58 bin/
drwxr-xr-x   3 root root  568 2005-09-04 17:09 boot/
lrwxrwxrwx   1 root root   22 2005-09-04 17:56 cross-tools -> /home/lfs/cross-tools//
drwxr-xr-x  16 root root    0 2005-09-05 10:30 dev/
drwxr-xr-x  40 root root 4312 2005-09-05 15:30 etc/
drwxr-xr-x   5 root root  120 2005-09-04 17:50 home/
drwxr-xr-x   4 root root 3008 2005-01-23 00:11 lib/
drwxr-xr-x   8 root root  200 2005-09-04 17:46 mnt/
drwxr-xr-x   3 root root   72 2004-09-03 23:00 opt/
dr-xr-xr-x  80 root root    0 2005-09-05 13:30 proc/
drwx--x---   6 root root  384 2005-09-04 16:59 root/
drwxr-xr-x   2 root bin  5416 2004-06-07 10:22 sbin/
drwxr-xr-x  10 root root    0 2005-09-05 13:30 sys/
drwxrwxrwt  12 root root  648 2005-09-05 15:25 tmp/
lrwxrwxrwx   1 root root   22 2005-09-04 17:49 tools -> /mnt/lfs_x86_64/tools//
drwxr-xr-x  18 root root  544 2004-09-03 23:00 usr/
drwxr-xr-x  15 root root  472 2005-08-15 17:08 var/
Code:
root@slackware:/# mount
/dev/sda3 on / type reiserfs (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
/dev/sda1 on /mnt/data type reiserfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda2 on /mnt/lfs_x86_64 type reiserfs (rw)
proc on /mnt/lfs_x86_64/proc type proc (rw)
sysfs on /mnt/lfs_x86_64/sys type sysfs (rw)
tmpfs on /mnt/lfs_x86_64/dev type tmpfs (rw)
tmpfs on /mnt/lfs_x86_64/dev/shm type tmpfs (rw)
devpts on /mnt/lfs_x86_64/dev/pts type devpts (rw,gid=4,mode=620)
 
Old 09-05-2005, 09:04 AM   #2
freakyg
Member
 
Registered: Apr 2005
Distribution: LFS 5.0 and 6.1
Posts: 705

Rep: Reputation: 30
hmm, did you set the $PATH????

Code:
export LFS=/path/to/lfs
 
Old 09-05-2005, 09:17 AM   #3
Basel
Member
 
Registered: Feb 2004
Location: United States
Distribution: Ubuntu 10.10
Posts: 319

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by freakyg
hmm, did you set the $PATH????

Code:
export LFS=/path/to/lfs
I do not think there is a need to set the LFS for this command since I am using the complete path /mnt/lfs_x86_64
Code:
root@slackware:/home/basel# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin
root@slackware:/home/basel# su - lfs
/dev/pts/2: Operation not permitted
lfs:~$ echo $PATH
/cross-tools/bin:/bin:/usr/bin
lfs:~$
 
Old 09-17-2005, 04:25 AM   #4
mr_demilord
Member
 
Registered: Sep 2005
Posts: 244

Rep: Reputation: 30
Quote:
Originally posted by Basel
I do not think there is a need to set the LFS for this command since I am using the complete path /mnt/lfs_x86_64
Code:
root@slackware:/home/basel# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin
root@slackware:/home/basel# su - lfs
/dev/pts/2: Operation not permitted
lfs:~$ echo $PATH
/cross-tools/bin:/bin:/usr/bin
lfs:~$
Check your fstab, type mount and Ensure that this new partition is not mounted with permissions that are too restrictive
(such as the nosuid, nodev, or noatime options).
and/or noatime are set, the partition will need to be remounted.
Run the mount command without any parameters to see what options are set for the mounted LFS partition. If nosuid, nodev,

If so change the mount options for the LFS partition to <user,exec,dev,suid>
 
Old 06-29-2006, 02:56 AM   #5
Linux von Scratchen
LQ Newbie
 
Registered: Jun 2006
Location: orbiting around Saturn
Distribution: LFS, knoppix
Posts: 16

Rep: Reputation: 0
Lightbulb Check: good access to /tools?

i had the same problem, found several threads on LQ and elsewhere about it - there seem to be too many ways to go wrong at this step. Though you may have solved your particular problem many months ago, an unending stream of head-scratching chroot wannabees will be discovering this and the other threads, so i'll describe my situation here.

I verified that /tools/bin/env did exist, ran it directly, and tried the same things others did. The problem turned out to be that in my LFS partition, mounted as /LFS, had a symbolic link where i had built my initial toolchain, /home/lfs/tools. I did this (not following the fine LFS book) so that i could play with other distros on the one partition, but keep my toolchain safe on another. Since a symbolic link was made in /, i figured the same would be okay in /LFS for access once i've chrooted. Not so! it just doesn't work. Solution: unmount the partition from /home, and remount it in /LFS/home (use mkdir /LFS/home if necessary) Then make a link: cd /LFS ; ln -s /home/lfs/tools tools - this link should work while chrooted to /LFS, but not earlier. (If you like, you could create another link in the host environment's /home, but then you should already have a /tools link for convenient access before the chrooting) Bottom line: Any symbolic links in /LFS to anything outside /LFS won't be any good while chrooted. Also, any partition mount points not in /LFS will become invisible after chroot.
 
Old 06-30-2006, 03:00 AM   #6
pradeepmenon777
Member
 
Registered: Jan 2004
Location: India
Distribution: Ubuntu 8.04
Posts: 122

Rep: Reputation: 16
I have the same problem as posted in the first one of this thread. What I found out was that the $PATH of root does not contain /tools/bin on echo

Quote:
# echo $PATH
/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin
So , i am getting the error of /tools/bin/env --> file not found.. Whereas it actually exists. Please tell me a solution ..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
sudo /usr/bin/chroot /home/chroot /bin/su - xxx| /bin/su: user xxx does not exist saavik Linux - General 3 07-04-2007 10:30 AM
/tools/bin/env: /tools/bin/bash: No such file or directory DaZjorz Linux From Scratch 21 07-27-2005 07:11 AM
Cannot Enter chroot /usr/bin/env directory not found Zero-0-Effect Linux From Scratch 2 03-13-2004 12:41 PM
chroot problem (thinks 'env' is a directory) d33pdream Linux - General 1 02-23-2003 02:11 PM
linux command error message bash: /usr/bin/find: No such file or directory sundaram123 Linux - General 8 04-02-2002 07:18 AM


All times are GMT -5. The time now is 12:33 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration