LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This 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


Reply
  Search this Thread
Old 01-09-2003, 03:17 AM   #1
Rito
LQ Newbie
 
Registered: Jan 2003
Location: UK
Posts: 17

Rep: Reputation: 0
Unhappy Cant chroot sucessfully


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.

Richard
 
Old 01-09-2003, 01:58 PM   #2
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
From your last sentence I think you are saying you aren't root when you chroot. You have to be root. From this page:
http://www.linuxfromscratch.org/view...06/chroot.html

Right above the gray area with the commands, it says:
become root...

If you are root, please let us know so we can look further into what's going on

Cool
 
Old 01-09-2003, 05:00 PM   #3
Rito
LQ Newbie
 
Registered: Jan 2003
Location: UK
Posts: 17

Original Poster
Rep: Reputation: 0
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
 
Old 01-10-2003, 12:58 AM   #4
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
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.

Cool
 
Old 01-10-2003, 04:27 AM   #5
Rito
LQ Newbie
 
Registered: Jan 2003
Location: UK
Posts: 17

Original Poster
Rep: Reputation: 0
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
 
Old 01-10-2003, 11:02 AM   #6
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
What does:
ls -l /static/bin/env
show?

Here's what mine looks like:
Code:
masterc@masterc:~$ ls -l /mnt/lfs/static/bin/env 
-rwxr-xr-x    1 root     root       403456 Oct 16 15:32 /mnt/lfs/static/bin/env*
Cool
 
Old 01-10-2003, 02:14 PM   #7
Rito
LQ Newbie
 
Registered: Jan 2003
Location: UK
Posts: 17

Original Poster
Rep: Reputation: 0
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!!
 
Old 01-11-2003, 12:08 AM   #8
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
No problem, and no one wastes my time on this board, I enjoy helping, and learn something just about every time

Cool
 
Old 01-15-2003, 09:24 AM   #9
Rito
LQ Newbie
 
Registered: Jan 2003
Location: UK
Posts: 17

Original Poster
Rep: Reputation: 0
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
 
Old 01-15-2003, 09:42 PM   #10
PTBmilo
Member
 
Registered: Jan 2003
Posts: 167

Rep: Reputation: 30
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:

cd /mnt/lfs

chroot /mnt/lfs /static/bin/env -i \
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/static/bin \
HOME=/root \
PS1='[LFS][\w]> ' \
TERM=$TERM \
/static/bin/bash --login
 
Old 01-16-2003, 02:45 AM   #11
Rito
LQ Newbie
 
Registered: Jan 2003
Location: UK
Posts: 17

Original Poster
Rep: Reputation: 0
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?
 
Old 01-16-2003, 01:50 PM   #12
PTBmilo
Member
 
Registered: Jan 2003
Posts: 167

Rep: Reputation: 30
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>)

Last edited by PTBmilo; 01-16-2003 at 02:12 PM.
 
Old 01-16-2003, 03:34 PM   #13
Rito
LQ Newbie
 
Registered: Jan 2003
Location: UK
Posts: 17

Original Poster
Rep: Reputation: 0
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
 
Old 01-16-2003, 05:02 PM   #14
PTBmilo
Member
 
Registered: Jan 2003
Posts: 167

Rep: Reputation: 30
Quote:
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)
 
Old 01-20-2003, 04:44 AM   #15
Rito
LQ Newbie
 
Registered: Jan 2003
Location: UK
Posts: 17

Original Poster
Rep: Reputation: 0
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.)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sudo /usr/bin/chroot /home/chroot /bin/su - xxx| /bin/su: user xxx does not exist saavik Linux - General 3 07-04-2007 10:30 AM
Almost sucessfully update Mandriva LE 2005 Lucas10 Linux - Software 1 08-16-2005 02:14 AM
hang at boot up after sucessfully install fglrx zhyjanet Debian 5 04-03-2005 11:56 PM
Has anyone sucessfully installed Knoda? Baldrick65 Linux - Software 0 08-22-2004 06:09 AM
Anyone sucessfully install cdbakeoven? solspin Linux - Software 0 07-05-2003 12:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 02:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration