chroot: cannot run command `/tools/bin/env': No such file or directory
Linux From ScratchThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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)
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>
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.
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.
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?
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.