LFS Book Chapter 6 - 1st step (chroot to /mnt/lfs) doens't work
Linux From ScratchThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
LFS Book Chapter 6 - 1st step (chroot to /mnt/lfs) doens't work
6 months or so back I installed LFS 3.1. Everything was cool until I reached the point where I couldn't get networking to work.
Here I am 6 months later ... and I figured I'd just start again from 'scratch'. I downloaded the cvs packages and got started. I've tried a couple iterations and am bombing at the same spot,at least diverging from the instructions in the book.
The basic problem is the first step I take in chapter 6: 'chroot'
to /mnt/lfs doens't appear to work. I'm not that experienced with the chroot command, but I figure after performing the command, your shell will interpret your new root as the NEWROOT specified in your command. In other works, after doing a 'chroot /mnt/lfs ..', if you 'cd' to '/' you should actually be where '/mnt/lfs' was before you chrooted.
The problem I'm having is that after performing the chroot, my '/' is still where it originally was. Thus, all the subsequent commands in the instructions don't work because the '/' given in the command is with respect to the chrooted environment (i.e. old '/mnt/lfs') ... and it appears I haven't successfully chrooted, so the instructions as posted no longer work.
I considered modifying the commands subsequent to the chroot command to treat /mnt/lfs as my '/', but I figured I should find out why this happened instead.
Any pointers, advice would be appreciated.
I looked for some other posts regarding chroot problems and ran the ldd command as suggested in another post. The response was "not a dynamic executable" which was not surprising because I pretty much followed the LFS book instructions to a 'T'.
Thanks
p.s. I'm really eager to get an LFS system up and running, so I'm hoping for some help here ... otherwise I'll be forced to abandon once again.
p.p.s. I'm running from RH7.2. All linux partitions are ext3 except /mnt/lfs which was created with the mke2fs command as detailed in the instructions. Don't see why this would affect chroot, but felt it was some configuration info I should include in the post.
The tricky thing about C&Ping this command was the following:
1) First of all, 'chroot' is not found unless I explicitly give it the path '/usr/sbin/chroot' so I couldn't cut&paste.
Hmmm, I guess that was the main reason. The last command in that chunk didn't work either '/static/bin/bash --login' ... but that's because it's looking at my RedHat root instead of $LFS.
A few ideas:
make sure you use host distro chroot, not LFS chroot
make sure you are in a directory above $LFS when you chroot
stop using $LFS variable after chrooting
make sure you are logged in as root when chrooting
one thing I know fershur:
"I considered modifying the commands subsequent to the chroot command to treat /mnt/lfs as my '/', but I figured I should find out why this happened instead."
This will not work because all the packages you install after will be linked to your host libraries etc. . .And your LFS will never work independantly.
Is chroot giving you an error message, or just failing silently?
If you are taking some of the stuff out of the chroot command that the book specify's, then you might run into problems. the "/static/bin/env -i" part clears all of your current environment variables, and then the command goes on to give you new ones. If you don't clear the environment, it might cause your /static/bin/bash search to stay in your base distro's filesystem.
because I couldn't cut & paste directly from the book, I entered the command manually not taking into account the fact that the '\' was a continuation character. So my chroot ended at the first line.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.