Getting in and out and in again in the CHROOT environment?
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.
Getting in and out and in again in the CHROOT environment?
Hello,
I only have time to do my LFS during the evenings. I shut my computer down during the day when I am at work. Is there a proper way to go in and out of the CHROOT environment to continue building LFS?
Any suggestions appreciated. A step-by-step procedure would gladly be better. Thanks.
Fine. So it's really as simple as mounting my workspace and CHROOT'ing into it. If that's all there is to it then it's all fine. What I was worried about was all that crap you had to type in the first time you CHROOT into it i.e.:
"CHROOT & LFS /static/bin/env -i ...yadiyadiyada.. and all the geekf*** whooya"
If I don't have to do that everytime I go in, then all is well I guess...
Well it depends on what stage of the book you are in. You will probably need the chroot command with all the extra's in it until you've finished building bash in the chroot environment. And you will probably also need to mount the proc filesystem everytime.
After you've built bash you could probably enter the chroot with an easier command. That is if you've set everything up already so your environment gets set up properly especially things like your PATH. It doesn't hurt to still chroot into it in the same way though so it might be the easiest if you create a simple scripts which might include things like:
mounting lfs partitions
setting $LFS
chroot into lfs
You will still need to mount the proc filesystem after that.
Thanks Mik for a more detailed suggestion. I'm just curious about mounting the proc(?) filesystem or whatever, cause I am about almost done completing the static environment. I believe I have gone in and out about 3 to 4 times now with just mounting the lfs, exporting LFS=/mnt/lfs, then chrooting into it. But I never mount the proc filesystem as you suggest. I haven't had any problems so far! Just wondering what problems I may encounter ahead just because I forgot to do this? Could I have just wasted 10 hours of my life for nothing...
Well I'm not sure exactly which programs need it. It's just it says in the LFS book "You have to make sure all the commands in the rest of this chapter and in the following chapters are run from within the chroot environment. If you ever leave this environment for any reason (rebooting for example), you must remember to again enter chroot and mount proc (discussed later) before continuing with the installations."
It doesn't mention in the book which programs need it. All it says it's needed for some programs to function properly.
Oh I just read your post again and you mentioned almost done with the static part. You only need the proc filesystem mounted in the chroot after the static part is completed (beginning of chapter 6). I guess I got confused because you where mentioning doing a chroot to the lfs partition which is only done after the static part is done.
Well, you know I may have made a mistake in saying I was still in the static environment cause I think I am done with that. I am already at the point where you CHROOT into the static env. and almost 3/4th of the way through. Sorry if I had a brain fart. So far no major problems and I followed your suggestion of mounting /proc at the half-way point. I'll let you know if it will have an adverse effect when I am done with it (i.e. not mounting proc the first 3 or 4 times). At any rate you have been a big help and I appreciate all your suggestions. Thanks much!
I believe we can close this thread now. I have completed the base LFS4 without any problems so far. I am currently on the first parts of the BLFS book (firewall). No problems so far with my system. Thanks to Mik and all the others who gave suggestions in this thread. Chow, all !
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.