LFS changing into chroot environment renders passwords useless
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 changing into chroot environment renders passwords useless
This has happened twice now (made a back up before the second time).
Everything goes well for LFS right up to after changing ownership of /tools to root. Then at some point After 6.1 (My guess is when entering the chroot environment), it corrupts passwords of all the users. (http://www.linuxfromscratch.org/lfs/...06/chroot.html)
I realized this because during the installation, I locked my main computer, resulting in Ubuntu also getting locked out. Prior to this point it wasn't an issue as I was able to log back in and continue. However after entering the chroot environment, none of the passwords for root, myusername, or LFS work. When trying to switch accounts, the ubuntu VM screen goes black and keeps flipping screen size (all the time showing black). Rebooting also does not fix the issue as it still does not accept passwords for any of the accounts.
has anyone else faced this issue?
Edit: Password recovery
When performing a password recovery for Ubnutu, I am able to change the password of root, however when trying to change the password of any of the other user accounts, I get the message User does not exist (even though I can see the user folder in /home
Last edited by LFS_Tester; 07-19-2017 at 02:38 PM.
Reason: Added recovery attempt
However, in general a "chroot" environment is one in which you've set everything relative to another directory OUTSIDE the chroot environment. That is to say if you have put your "chroot" in say "/opt/chroot" then a user logging into chroot environment doesn't see /opt/chroot - they see "/" (root) directory and everything they need must be beneath that relative directory.
So if you have a server (non-chroot) with say /etc, /usr, /home and /opt/ subdirectories and your chroot'ed user is setup under /opt/chroot you'd need to create /opt/chroot/etc, /opt/chroot/usr, /opt/chroot/opt and so on so that when the chroot'ed user logs in he sees those as /etc, /usr, /opt and so on.
You must then copy in the files the user miight need (e.g. /usr/lib and /usr/lib64 libraries, /etc/passwd and /etc/group into those relative paths (/opt/chroot/usr/lib, /opt/chroot/usr/lib64, /opt/chroot/etc/password, /opt/chroot/etc/group and so on.
The point in a chroot directory is to make it appear to the user that he is in the main system even though he is actually in a subdirectory.
@MensaWater In LFS you chroot to a mounted partition on which you have previously created all the static directories you will need. The dynamic ones are created by binding to the corresponding ones on your build host. The essential programs and libraries are in a special /tools directory on the new root, and /tools/bin is in your path. So you should have everything you need without having to copy anything.
I think the problem here may be due to changing the ownership of /tools to root. You're supposed to do that right at the end, after completing your build, not at the beginning of chapter 6.
When is the soonest you notice the issue? The passwd file is created in Section 6.6... if your chroot environment is borked so you're unintentionally altering your host passwd file instead of your chroot passwd file, that would definitely cause issues similar to what you're experiencing.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.