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.
I have got to the chroot section at the beginning of chapter 6, and am having problems...
When i chroot and specify /mnt/lfs and set my login by /static/bin/bash --login it works fine
obviously without setting the env settings it can not find the commands like ls, env and find etc
but when trying to set enviromental conditions on chroot, it says it can not find the file env, the full path to env is given (/static/bin)
and i can not see why i would not run.
If i logout, and then go to the /mnt/lfs/static/bin dir and run env it works fine.
In the chroot environment i can cd to /static/bin, and run ./ls and ./find but ./cat, ./env ./whoami etc fails to work, it says it can not find the files.
Please help. I believe it may have something to do with permissions and as chown works i have set permissions to root for /static.
unfortunetly if i try and access man pages in the man dir, it gives a permission denied. I realise i am not root, but i dont have an actual login do i?
anyone who has any vague idea what the hell is going on, please help.
I am root before i chroot, but after i have "chrooted" i dont appear to have root priviledges as i get a permission denied from opening a man file called man/man1/env.1 or something like that,
hope you can help
Richard
When following the directions, exactly, do you at least end up with a:
I have no name ?
If so, move onto the next step, chown -R 0:0 /static
When you chroot, yes you still are root, as that is the user you chrooted with, and the only user on you newly created LFS system until you actually add a new one.
I have chrooted, sucessfully, but i can not set the env settings, when trying to run the file it says it cannot find it,
i get the IHaveNoName? thing, and i have chown of static to root. but still i cannot access the env file, i cannot use the whoami or env but i can use locate and find, and a couple of others, all the files are in the same directory. If i bzip2 env it leaves me with env.bz2 and using bunzip2 i can turn it back to env, but i can not run the file, it says it can not find it (when in /static/bin i run ./env)
so again thanks for your help
appears you have a challenge,
thankyou for your time, hopefully we can sort this
Richard
I have suffered hard disk failure and my computer refuses to recognise my hard disk, as soon as i get a new hard disk and re-install lfs, then i can tell you
Thankyou for your help,
I'm sorry i have wasted your time, to a small extent, (real problem, probably still need solving!) will ask again as soon as i return to this point
Thankyou for your help MasterC,
I'll go play with my slackware box for now, i think i'll put lfs on the same hard drive, that way i can play straight away!!
ok, my problem is back, and i'm stuck again. This time the problem is more horrible than i like to discribe
as far as i can tell i have followed the instructions down to the last detail correctly and have not had any previous errors
ok - when i chroot now it says it can not find my env file or the bash file, so i can not chroot at all
but i can run the files successfully from the directory where they are placed.
i ran the ls -l thing anyway even though i can not chroot, and i get exactly the same as you, except where yours says root root
mine says lfs users (obviously date time is different) but this is most likely because it has not been used since installed by user lfs
so any ideas??
plase help if you can
Rito
When you chroot, you are logged in as user root, correct? If you have been building the LFS with a user 'lfs', then maybe you forgot to assign LFS=/mnt/lfs (or whatever dir your lfs partion is mounted on) for the root user's bash session. Try setting it, or just use the full pathname instead of the $LFS variable. ex:
I have chrooted as root
i did use the lfs user for install
the files are in the correct directory and using /mnt/LFS (that is the directory i am using) does not find the files bash or env in the static/bin dir
but they are there
anymore ideas anybody?
That sounds funky. Well, maybe we can figure out what's going on. First of all, what EXACTLY does it spit back at you when the chroot fails?
Try this:
chroot /mnt/LFS <enter> (lets hope at least this works
PATH=$PATH:/static/bin <enter>
cd /static/bin <enter>
./env -i <enter>
./bash --login <enter>
Can you get this far? If not, tell us at what step it got mad. If you do get to this point, you can now enter all of those environment variables (PATH, etc... PS1 if you want).
Another thing you can do to debug the situation a little more is to check the output of '/bin/env' (or /static/bin/env) during different stages of the above process.
Also, I noticed that you used 'static/bin' w/out the leading '/'.... if you are doing this when you enter the long chroot command, it MIGHT give you trouble, but I'm not too sure about that.
EDIT:
If you want to capture everything that goes on in your terminal while you are doing this (so that you can give us the error msg's, use the 'script' program before you do anything (type script, then do the work, then exit and your session will be saved in the file it tells you <man script>)
i get stuck at chroot /mnt/LFS, this is because it can not use /bin/bash
it is the only error
but using
chroot /mnt/LFS /static/bin/bash --login
returns the error
chroot: cannot execute /static/bin/bash: no such file or directory
i understand this error as that the file bash does not exist, but believe me it does
i can find it i can see it and i can run it fine
but i can not use it when chrooting, i have had similar problems with other files (mainly env) earlier on in my posts
hope this is enough information
Rito
Originally posted by Rito i get stuck at chroot /mnt/LFS, this is because it can not use /bin/bash
it is the only error
What is the only error?
If I remember correctly, it is possible to do the straight "chroot $LFS" with nothing else, then add /static/bin to your path and you'll be o.k.
Maybe I remember wrong though (I'm not at home to test it out at the moment). How about this?:
cp $LFS/static/bin/{bash,env} $LFS/bin/ <enter>
Now the executables (by the way, make sure that the binaries for bash & env ARE executable... maybe you have the wrong permissions?) should be in the $LFS/bin dir, so chrooting won't be a problem w/ your current $PATH (do "echo $PATH" to see what it is)
BTW: "chmod -R 755 $LFS/static/bin" to make those binaries executable, if they are not. (should look just like MasterC's)
i cannot go directly to the chroot environment as it says it can not find the bash file.
i have copied the executibles to the $LFS/bin directory and they are executible and i can execute them fine
echo $PATH does show :/bin as one of the paths
and i still cant chroot to the $LFS directory
and $LFS echos to /mnt/LFS which is correct and typing it in makes no difference so still stuck
thanks fr your time, any more ideas?
Rito
(Sorry i have not been around i have had exams and did not have a net connection for a while.)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.