LFS 7.1 in Ubuntu 10.04 chroot: failed to run command `/tools/bin/env': No such file or directory

3.4k Views Asked by At

I create LFS 7.1 in Ubuntu 12.04 but with the problem happened in chapter 6.4:Entering the Chroot Environment. I execute the command: chroot "$LFS" /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 I didn't create the symbol link /tools but just use /mnt/lfs/tools for every command. After I ldd the bash, I found its output is:

root@ubuntu:/mnt/lfs/tools# ldd ./bin/env
linux-gate.so.1 =>  (0xb7703000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb754c000)
/mnt/lfs/tools/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0xb7704000)

Can anyone help me to solve this problem?

1

There are 1 best solutions below

0
On

I don't think the book contains the hint that this symlink was optional...

You need to use that symbolic link when creating the first tool chain. Only in this way you can have the same (read: textually identical) path in the host system and in the chrooted system. This is needed as during the compilation of the tools the path used to find other tools and libraries ("/tools") will be embedded into the executables just created. (Not using the symlink results in embedding the path "/mnt/lfs/tools" in the executables, a path that does no longer exist after the chroot).

If you don't want to go back to Chapter 4.2, you can try this: Create the path /mnt/lfs/tools inside your lfs system to point to the location where the tools are located within the chrooted system. In other words create another symlink, like this (in the host system):

ln -s /tools /mnt/lfs/mnt/lfs/tools

(Yes, the second argument reads /mnt/lfs/mnt/lfs/tools, it contains /mnt/lfs twice). Then continue with 6.4 Entering the Chroot...

But a better (cleaner) option would be to remove the results of chapter 5 and go back to 4.2. and this time create the symlink.