LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This 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


Reply
  Search this Thread
Old 06-15-2023, 10:11 AM   #1
Michael Farthing
LQ Newbie
 
Registered: Jan 2016
Location: Morecambe England
Distribution: Fedora moving to LFS
Posts: 10

Rep: Reputation: Disabled
chroot failing in LFS 11.3 chp 7


I have the chroot command failing in chapter 7 of LFS 11.3 (with the message "
chroot: failed to run command /usr/bin/env: no such file or directory.

I have read the two relevant threads on this forum and understood what they are saying, leading me to expect a fault concerning the ld-linux-x86-64.so.2 shared library which, however, is correctly placed in $LFS/usr/lib and symlinked from $LFS/lib64 (both as ld-linux-x86-64.so.2
and ld-lsb-x86-64.so.3). A worrying feature is its size, which is stated as 1.2Mb whereas the host system equivalent (debian) is actually itself a further symlink to a file called ld-2.31.so and has a size of only 173kb.

I have tried the experiment of running chroot ldconfig as recommended in one of the threads to test whether a command not requiring dynamic linking would work and there was no error doing this. I have also run (as recommended) the full command with strace indicating that the chroot() function was successfully run but did then generate the missing file error after that point.

Any further suggestions of possible problems would gladly be received, as also would confirmation of whether the file size difference indicates a real problem or not - principally can anyone confirm that they have a similar sized file in a working system?

[I have been very careful to follow exact instructions and have scripted chapters 4, 5 and 6 while going along. I have already tried reverting to start and running the scripts (under the correct users), diverting std-error to a log file which has produced warnings but no errors].

Last edited by Michael Farthing; 06-15-2023 at 10:13 AM.
 
Old 06-15-2023, 10:57 AM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,157

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
is the LFS variable set properly, does $LFS/usr/bin/env actually exist?
 
Old 06-15-2023, 11:43 AM   #3
Michael Farthing
LQ Newbie
 
Registered: Jan 2016
Location: Morecambe England
Distribution: Fedora moving to LFS
Posts: 10

Original Poster
Rep: Reputation: Disabled
Yes, Keith to both questions. The chroot call in the strace clearly shows the target as /mnt/lfs and I had in any case particularly checked that was the value of $lfs in chp 7 given the move back to root execution. $lfs/usr/bin/env does exist (as does /usr/bin/env though the command is clearly being called after the root change has occurred), but this is almost certainly irrelevant as the error message is known to inaccurately diagnose the problem as it can arise from failure of internal calls to satisfactorily carry out the dynamic linking before actually starting, in this case, env. This is the reason for suspecting ld-linux-x86-64.so.2.

Can I ask the size of your own ld-linux-x86-64.so.2 if you have a recent lfs running, as this is the most suspicious thing I can find at the moment?
 
Old 06-15-2023, 03:19 PM   #4
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,157

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
Code:
LFS version 10.1:

File: /lib/ld-2.33.so
  Size: 194424    	Blocks: 392        IO Block: 4096   regular file
Device: 809h/2057d	Inode: 2474030     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-06-15 21:13:05.938145014 +0100
Modify: 2021-04-27 20:37:38.000000000 +0100
Change: 2021-04-27 20:37:38.000000000 +0100
 Birth: 1970-01-01 01:00:00.000000000 +0100

/lib/ld-2.33.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, stripped

ld-linux-x86-64.so.2 is a symlink to /lib/ld-2.33.so ( this is NOT part of the LFS book its for my own use )


LFS version 11.3:

File: /mnt/LFS/lib/ld-2.37.so
  Size: 206656    	Blocks: 416        IO Block: 4096   regular file
Device: 808h/2056d	Inode: 1744923     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-06-15 21:16:56.000000000 +0100
Modify: 2023-06-06 16:41:39.000000000 +0100
Change: 2023-06-06 16:41:44.000000000 +0100
 Birth: -

/mnt/LFS/lib/ld-2.37.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, stripped

Again ld-linux-x86-64.so.2 is a symlink to /lib/ld-2.33.so
Hope this helps

Last edited by Keith Hedger; 06-16-2023 at 05:18 AM. Reason: removed extraneous data
 
Old 06-16-2023, 08:43 AM   #5
Michael Farthing
LQ Newbie
 
Registered: Jan 2016
Location: Morecambe England
Distribution: Fedora moving to LFS
Posts: 10

Original Poster
Rep: Reputation: Disabled
Thanks very much for this Keith.

I am still mystified as to what is happening but it seems increasingly likely that this file is the problem. I have rerun from start to the end of chapter 5. My ld-linux-x86-64.so.2 in $LFS/usr/lib is not a symlink but a shared library of much greater size. The expected file of $LFS/usr/lib/ld-2.37.so is simply not present, nor indeed anything similar. glibc-2.37 compiled without problems except for some rather trivial warnings and I have repeatedly checked the .\configure call which exactly matches the book. It has also populated $LFS/usr/lib with plenty of other stuff so doesn't seem to be misplacing things.

Back to the drawing board :-(
 
Old 06-16-2023, 10:47 AM   #6
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,682
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
If you have got an error in something as fundamental as the ld linking loader, then I think that is probably irrecoverable. Remember glibc is about the third package that you build, way back in chapter 5.

I'd scrub it and start again from scratch, paying special attention to the boring bit about setting up the correct environment for your lfs user.
 
Old 06-16-2023, 01:14 PM   #7
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,157

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
what isthecontents of $LFS/etc/ld.so.conf ?
try symlinking $LFS/usr/lib/ld-linux-x86-64.so.2 to $LFS/lib/ld-linux-x86-64.so.2
 
Old 06-27-2023, 03:28 AM   #8
Michael Farthing
LQ Newbie
 
Registered: Jan 2016
Location: Morecambe England
Distribution: Fedora moving to LFS
Posts: 10

Original Poster
Rep: Reputation: Disabled
Lightbulb

Well after a lot of fruitless activity and head scratching I eventually establsihed my mistake: $LFS/bin -> $LFS/usr/bin symlink (and the two other similar ones) were absolute instead of relative. Everything worked fine until chroot chopped off their heads!

Thanks for all the contributions
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] LFS 7.6 Chp 5.51, GCC: configure: error: cannot compute suffix of object files... thinkrorbot Linux From Scratch 10 03-06-2015 05:44 AM
Error make glibc chp 6.9 LFS 6.3 on LFSLiveCD Jesper330 Linux From Scratch 1 02-03-2009 12:24 PM
LFS 6.2-3 chp. 5.4 GCC-4.0.3 compile error threekgtvr4 Linux From Scratch 1 12-29-2006 04:45 PM
Something terribly went wrong with install of lfs.. near chp.5 Zero-0-Effect Linux From Scratch 2 03-12-2004 06:45 AM
super chp in Mplayer subservant Linux - Software 8 02-20-2003 02:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 02:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration