-   Linux From Scratch (
-   -   lib link error?can't chroot!! (

jimmerlin 11-07-2008 10:19 PM

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.

linuxfromscratch-newbie 11-25-2008 11:11 AM

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

anwerreyaz 11-26-2008 03:40 AM

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!

All times are GMT -5. The time now is 09:27 AM.