LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (http://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   chroot: cannot run command `/tools/bin/env': No such file or directory (http://www.linuxquestions.org/questions/linux-from-scratch-13/chroot-cannot-run-command-%60-tools-bin-env-no-such-file-or-directory-360369/)

Basel 09-05-2005 08:24 AM

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)


freakyg 09-05-2005 09:04 AM

hmm, did you set the $PATH????

Code:

export LFS=/path/to/lfs

Basel 09-05-2005 09:17 AM

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:~$


mr_demilord 09-17-2005 04:25 AM

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>

Linux von Scratchen 06-29-2006 02:56 AM

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.

pradeepmenon777 06-30-2006 03:00 AM

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 ..


All times are GMT -5. The time now is 11:40 PM.