Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
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.


  Search this Thread
Old 11-07-2008, 10:19 PM   #1
LQ Newbie
Registered: Oct 2008
Posts: 8

Rep: Reputation: 0
lib link error?can't chroot!!

i am trying to install LFS on slackware,using the lfs6.3 version,i followed all the instructions but not the instruction,don't do it in root,do it as a usr.
i haven't solve a problem,when i do the work as a usr,i don't have enough permission,so i changed back to root,of course,this will cause problems,everything compiled ok so far(after endless wait,google,patch and curses),until i hit the wall in chroot!

at first,i think the problem is chroot,so i begin a goose chase trying to solve the problem,after long research,i found that the problem is not in chroot,but in the links,maybe my program links are pointing to the root libs instead of /tools/lib

1.i do command:
ldd /tools/bin/env,and get this result:
instead of
does it mean the links are all wrong?
2.i google something and reinstall bash with this:enable-static-link

after reinstall bash,if i do : ldd /tools/bin/bash
it says:not a dynamic executable
then,i do this:chroot /mnt/lfs/ /tools/bin/bash --login +h
i will get:
i have no name!darkstar$:

it means i chrooted to /mnt/lfs,but i can't do any command,can't ls,cd or install.

does it mean that bash is running,but can't found anything?does it mean the program in /bin are wrongly linked to the root lib instead of /tools/bin/lib? i have to start all over again to set the links right?

i heared that if you use a usr as the official book demanded,you compile programs under path:/tools/bin:/bin:/usr/bin,so the program compiled with gcc in the /tools path instead of / path,do i have to compile with gcc in /tools path to make everything work?

4.i tried the test:
echo 'main(){}' > dummy.c
cc dummy.c
readelf -l a.out | grep ': /tools'

and i really at the required result:
[Requesting program interpreter: /tools/lib/]
according to the book,it means my programs sucessfully linked to /tools/lib!!

so why i still have a bunch of programs wrongly linked somewhere else?? question,should i install bash statically linked or not.i chrooted ok with static link,but i think that it's not the answer to chroot and install>>

thanks for reading,and thanks for anyone to shine some light on the matter.
Old 11-25-2008, 11:11 AM   #2
LQ Newbie
Registered: Nov 2008
Posts: 1

Rep: Reputation: 0
Thumbs up

solution :
2nd time come to compile gcc
mine was gcc-4.3.2

remove old gcc directory completely
> rm -rf gcc-4.3.2
ensures clean fresh start and no chance to go wrong.

unpack tar ball
>tar -xvf gcc-4.3.2.tar.gz

go into gcc source tree e.g
>cd gcc-4.3.2

then find 2 files , that DOT after find means FROM this directory downwards
DASH name means find by filename
>find . -name 'linux.h'
>find . -name 'linux64.h'

i found mine
gcc-4.3.2 / gcc / config / <YOUR-PROCESSOR-TYPE > / linux.h
gcc-4.3.2 / gcc / config / <YOUR-PROCESSOR-TYPE > / linux64.h

my processor type was i386

open up those files and wherever you see /lib ..... type as SLASH lib
put /tools/lib ..... type as SLASH tools SLASH lib
then compile and continues with rest of chapter
soon after done this , have a working
ldd {binary}
=> /tools/lib .....

hope hellps
Old 11-26-2008, 03:40 AM   #3
LQ Newbie
Registered: May 2006
Posts: 18

Rep: Reputation: 0
I had the same problem. I did the same mistake of doing it as a root.
The book instructs to create a folder $LFS/sources and gives full permission for the new user to that dir.But when u try to create a folder outside this sources folder u would get the error permission denied!
So copy all your sources(tar balls) to sources and work from there!
If the book instructs to use a separate dir for build create it
But do them all within the sources directory.

Do pay attention to this command:

ln -sv $LFS/tools / (chapter 4.2)
Here a sym link is created to /

I started it fresh now am in the journey!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Berkeley DB (Which Lib to link?) lucky6969b Programming 19 05-19-2009 09:15 AM
chroot error while loading libraries alkaff Linux From Scratch 3 05-05-2008 03:53 PM
chroot: error while loading shared libraries: /lib/ file too short ilyaz121 Debian 5 06-30-2006 03:06 PM
sftp chroot jail, not able to find lib files drolic Linux - Security 3 11-23-2005 11:57 AM
How to link a lib? theonebeyond Programming 3 09-11-2004 03:10 AM > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 03:04 PM.

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