For some background, everything related to LFS has worked so far. After make-installing glibc, I ran these commands to sanity check:

echo 'int main(){}' | $LFS_TGT-gcc -xc -
readelf -l a.out | grep ld-linux

After doing the first one, I got this error:

/mnt/lfs/tools/lib/gcc/x86_64-lfs-linux-gnu/13.2.0/../../../../x86_64-lfs-linux-gnu/bin/ld: cannot find /lib64/ld-linux-x86-64.so.2 inside /mnt/lfs collect2: error: ld returned 1 exit status

It shouldn't output this. I checked lib64 and ld-linux-x86-64.so.2 is a symbolic link to /lib/ld-linux-x86-64.so.2. In the /lib/ directory, ld-linux-x86-64.so.2 doesn't exist.

So basically, ld-linux doesn't exist for some reason. I am the LFS user and I'm running each command correctly. The $LFS variable is set. What could be going on here?

1 Answer 1


Solved! The problem was: almost the entirety of $LFS was owned by root, not the lfs user. Trying to run make install as the lfs user, I was attempting to write to directories that weren't mine. I fixed this by running

sudo chown -R lfs $LFS

as root.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .