LFS 11.2 on Ubuntu Server 22.04: chroot: failed to run command ‘/usr/bin/env’: No such file or directory
I have been following the LFS 11.2 guide and it has gone smoothly up until the chroot part. Although the symlinks have created properly i.e. relative to the LFS directory, the error is still persistent.
Code:
necro-test@necro-server:/mnt/lfs$ ls -la lib64/ Code:
necro-test@necro-server:/mnt/lfs$ findmnt | grep /mnt Code:
necro-test@necro-server:/mnt/lfs$ echo $PATH && echo $LFS Previous posts had the problem of symlinks being to absolute paths like here. All my compilations were successful and all the directories have been setup properly. This is the command where it's failing Code:
root@necro-server:/home/necro-test/partitioning# chroot "$LFS" /usr/bin/env -i \ Code:
root@necro-server:/mnt/lfs# chroot $LFS /lib64/ld-linux-x86-64.so.2 --help |
Is $LFS correctly set in this session? It's always worth checking.
Does the directory $LFS/usr/bin contain the env program? |
Quote:
Code:
necro-test@necro-server:/mnt/lfs$ ls -la lib64/ |
Quote:
My guess is that you did not have $LFS properly set when you were building glibc. If I were you, I would wipe the LFS partition and start again. |
Quote:
Code:
export LFS=/mnt/lfs Code:
case $(uname -m) in Which libraries are supposed to exist inside $LFS/lib other than glibc? |
Fixed it by locating ld-linux-x86-64.so.2. It was in $LFS/usr/lib instead on $LFS/lib so i changed the symlink to
Code:
case $(uname -m) in |
That's not a solution, it's a sticking plaster. If you have installed something in the wrong place, you will keep on getting grief from it, more and more so as you go on. It's like building a wall: each row of bricks rests on the previous one. If a row is badly constructed, all the following rows will be affected, not just the next row up.
LFS is a good learning experience but it does require a certain degree of discipline to make it work. You have to be prepared to scrub everything and start again if something as basic as this is wrong. |
Quote:
|
I don't do calls; I have a low-cost internet connection with limited bandwidth. If you are in the UK, we could perhaps talk over the telephone but I doubt if that would do much good as I wouldn't be able to see your system.
I suspect that when you talk about "restarting the whole process", you mean starting the builds again. But what has gone wrong in your case is probably more basic than that, such as a wrongly defined environment for your LFS user. LFS newbies are always tempted to rush over the initial chapters in which the build environment is set up because that's boring and they want to get on and actually build their system. I can understand that, but LFS only works if you follow all the instructions systematically and exactly. Checking your host software against the approved list is another job that newbies tend to skip over. For example, your host is a Debian derivative, so your system shell will be dash, not bash (bash is the default user shell but it won't be used in build scripts). And your awk program will be mawk and not gawk. Those things make a difference and have to be corrected before you start. If I were in your position, I would clear the new partition completely except for the source packages. The tools directory goes too. Then start again from the very beginning, reading and following each paragraph in turn and not leaving anything out. |
Quote:
Code:
cd "$LFS" Quote:
Quote:
Now i can mark this issue as truly resolved. Let this post be a lesson to all future LFS newbies. Thanks for all your help hazel :) |
All times are GMT -5. The time now is 06:37 PM. |