LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-06-2019, 03:43 PM   #1
pyjong
LQ Newbie
 
Registered: Mar 2019
Posts: 8

Rep: Reputation: Disabled
Question Can ld find shared libs on rootfs?


Hello, I'm just messing around for learning purposes.

Basically what I tried is:
- remove initrd boot option
- add rootfstype=ext4

This seems to work. Kernel runs my /sbin/init file in statically linked busybox, the script mounts sysfs devtmpfs and proc and give user console.

My problem is whenever I try to run something dependent on glibc. I get "file not found" error, which as I found out in fact means "cannot find your shared libs".

Then I tried mounting /dev/hda1 (that's the device from which I boot, so I'm mounting the disk that's already mounted at /) to /mnt/a
Set LD_LIBRARY_PATH=/mnt/a and voila ldd runs.

So I conclude this has something to do with me running from rootfs. Apparently shared libs cannot be found on rootfs
And that's my question, why not? What is the difference between rootfs and an actual extfs in respect to dynamic loader?
If you think there is some code I need to see to understand, feel free to reference it, I'm proficient in C, but I haven't read much of the post Linux boot code yet.
 
Old 04-06-2019, 08:48 PM   #2
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Quote:
Originally Posted by pyjong View Post
Apparently shared libs cannot be found on rootfs And that's my question, why not?
So...
What you're saying is that when you "Set LD_LIBRARY_PATH=/", that don't work?
 
Old 04-07-2019, 04:08 AM   #3
pyjong
LQ Newbie
 
Registered: Mar 2019
Posts: 8

Original Poster
Rep: Reputation: Disabled
Yes
 
Old 04-07-2019, 05:01 AM   #4
pyjong
LQ Newbie
 
Registered: Mar 2019
Posts: 8

Original Poster
Rep: Reputation: Disabled
Hmmm it says here https://www.kernel.org/doc/Documenta...-initramfs.txt

"Most systems just mount another filesystem over rootfs and ignore it."

Which expectedly for me prints device busy. Also it doesn't behave as tmpfs because the changes persist across restarts. Alright, I think I know what to do..
 
Old 04-07-2019, 11:51 AM   #5
pyjong
LQ Newbie
 
Registered: Mar 2019
Posts: 8

Original Poster
Rep: Reputation: Disabled
Ahhhh... I think I know what the problem is.. I probably messed up some options when I compiled glibc and now it's looking for SYSTEM_DIRS in the directory of my prefix as it was on the build machine. setting LD_LIBRARY_PATH=/lib also works. well that sucks glibc builds forever. Well valuable lesson though, I won't forget this again I bet.
 
  


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
How to force 32 bit PaleMoon to use 32 bit libs instead of 64 bit libs? Ook Slackware 23 08-26-2016 03:00 PM
Old libs, New libs bomelia Linux - Software 7 09-29-2010 09:59 AM
link-time libs need to be run0time libs says curl's make install UniquelyAm Linux - Software 0 06-09-2007 01:40 AM
Qt Libs Static or Shared magicm Slackware 2 10-15-2003 05:05 AM
shared libs hanzerik Linux From Scratch 2 03-14-2002 01:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:58 PM.

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