LinuxQuestions.org
Help answer threads with 0 replies.
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, 09: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, 10: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, 10: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, 05: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, 03: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, 04:00 AM   #6
pradeepmenon777
Member
 
Registered: Jan 2004
Location: India
Distribution: Android 9.0.6
Posts: 123

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 ..
 
Old 06-07-2018, 05:42 PM   #7
atanasova
LQ Newbie
 
Registered: Jun 2018
Posts: 3

Rep: Reputation: Disabled
I have the same problem; '/tools/bin/env' not found.
While logged in as a root I checked if the 'env' exists, but the directory is not there.
Before I continue doing anything I would like to hear some suggestions and a possible solution.

And the $PATH:

Quote:
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
 
Old 06-07-2018, 05:54 PM   #8
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Debian
Posts: 2,511
Blog Entries: 1

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
If tools/bin/env is not there, then something went wrong with "coreutils"

Did you restart pc for some reason if so was everything mounted, LFS partition ch6.2.2 6.2.3 and was LFS set for root

Last edited by spiky0011; 06-07-2018 at 05:56 PM.
 
Old 06-07-2018, 06:17 PM   #9
atanasova
LQ Newbie
 
Registered: Jun 2018
Posts: 3

Rep: Reputation: Disabled
I am building on a virtual machine, connected via putty. I closed the connection and continued after some time. The $LFS was not set so I exported it again but the partition is mounted.

When I enter mount I am getting this:
Quote:
/dev/vdc1 on /mnt/lfs type ext4 (rw, realtime,data=ordered)
Should I just redo 5.19. Coreutils-8.29 and continue from chapter 6 after?
 
Old 06-07-2018, 08:00 PM   #10
atanasova
LQ Newbie
 
Registered: Jun 2018
Posts: 3

Rep: Reputation: Disabled
I managed to fix this problem. Now the file exists but I am getting other issues which I think are not related to this question anymore.

About the solution, just repeat the 5.19 part - "Coreutils-8.29" and make sure that the 'env' exists. Then continue at chapter 6.

Thanks!

Last edited by atanasova; 06-07-2018 at 08:10 PM.
 
Old 06-09-2018, 03:15 PM   #11
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
I suspect you missed a part of section 4.2.

ln -sv $LFS/tools /

If so, you'd end up with /tools as a real directory in your host system rather than it being a symlink from your host /tools to -> $LFS/tools. Then, when you chroot there is no /tools inside the chroot. Or, you'd have both directories but the one on your host would be populated, but the chroot /tools would be empty.
 
  


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

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

All times are GMT -5. The time now is 04:24 AM.

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