/tools/bin/env: /tools/bin/bash: No such file or directory
Hello,
I am making my own Linux distro LMC and I've got some problems. Untill now i had a few problems and errors, but they all got fixed by searching on the internet and on fora etc... but this problem is a little more hard. I made a file; this is the content: Code:
mount proc $LFS/proc -t proc Code:
Proc and Devpts mounted. Now going into the Chroot Environment....... When I go to /tools/bin then "find *bash* then the program bash exists. When I try to run it i get this prompt: Code:
bash-2.05b# Code:
linux-dazjorz:/tools/bin # My host distro is SuSE. Can you help me? This is the first time I use LFS, so i'm kinda a :newbie: ... Thanks a lot! DaZjorz Edit: I am using the LFS book and i'm on chapter 6 at the chroot page. |
By the way, once its working i will try to remember that i have to post the solution on the form. i'll be trying some IRC channels too...
Could you please, please, please answer if you know the solution? Thanks DaZjorz |
whats the output of "find / -name bash". (in chroot env)
Probably bash is in /bin. |
Well, I can't really get in chroot. I have never been in chroot before. If I do it with the "/tools/bin/bash --login +h", then it gives the error and / is still exactly the same:
Code:
linux-dazjorz:/ # dir By the way, is CHROOT a package? cuz that may be the reason, i'm not sure if i have it. But then it would say that it didnt had any command 'chroot' and it doesn't. Output of "find / -name bash": it's still working but untill now it gave these: Code:
/usr/share/doc/packages/bash But "bash" is not really in /bin because if i go to /tools/bin then do "find bash" then it does say that bash exists: Code:
linux-dazjorz:/tools/bin # find *bash* EDIT: Code:
linux-dazjorz:/bin # find *bash* I'll try to search tha web for a package named CHROOT to see if it's working then. |
Hi,
chroot is a command that comes from coreutils. You can find the website at http://www.gnu.org/software/coreutil...ls.html#SEC144 Futher the manpages explain: (man chroot) For example, if you create a statically linked `ls' executable, and put it in /tmp/empty, you can run this command as root: $ chroot /tmp/empty /ls -Rl / Then you'll see output like this: /: total 1023 -rwxr-xr-x 1 0 0 1041745 Aug 16 11:17 ls So if you do: chroot /drives/lmc-linux /tools/bin/bash it should work... If you can't tackle the problem, try it without a script. Try to do the problem given in the manual (man chroot). - Tom |
Thanks a lot for your reply!
You inspired me to test some thingies with the chroot command. I made a new file, testchroot, it has this contents: Code:
mount proc $LFS/proc -t proc Code:
Proc and Devpts mounted. Now going into the Chroot Environment....... Which means that it actually does work. I'll change testchroot to make it do "dir /tools/bin" instead. Gives this output: Code:
Proc and Devpts mounted. Now going into the Chroot Environment....... So I tried to make a dobash file in the /drives/lmc-linux directory. I made the command "/./dobash"; gives the output Code:
Proc and Devpts mounted. Now going into the Chroot Environment....... Code:
Proc and Devpts mounted. Now going into the Chroot Environment....... Maybe i'll just make a file dobash in the current, normal root. doing command: "cp dobash /" Trying startchroot: Code:
Proc and Devpts mounted. Now going into the Chroot Environment....... Okay. So now I can chroot but I can't run any commands. What if I try to modify the chroot command in a way that it doesn't chroot "$LFS" but it chroots "/drives/lmc-linux"... ... ... Gives the same output. But... Hmm... it is "/drives/lmc-linux" in the command. If i make it /drives/lmc-linux (so without the "") then it gives ... ... ... The same output. :scratch: Do you know what the problem is now? Thanks, DaZjorz. |
Here comes a very large thingy. Maybe it could help you.
If I run "chroot /drives/lmc-linux /tools/bin/env" it gives this output: Code:
LESSKEY=/etc/lesskey.bin |
One thingy more. I'll just start developing LMC like this:
i'll make a file runchrootcommand with this contents: Code:
mount proc $LFS/proc -t proc export COMMAND=/the/command/i/want ./runchrootcommand Well at least I think i can do that. I'll test it. Edit: Nope. |
What is /tools/bin/env for a kind of program? It runs in each time chroot runs. Would be like 'environment' or something. Maybe the error is in there..?
|
Guys, I asked this question on an IRC forum and people told me to do chapter 4 and 5 all over. It costs a lot of time but i hope it will work then.
Thanks for your help! |
Hi,
1 ENV -------- You can always gain information on a command using the man pages or the info pages. When finding some details for eg "env": "man env" or "info env" -- info env -- If no command name is specified following the environment specifications, the resulting environment is printed. This is like specifying a command name of `printenv'. ---- 2 MOUNT OF PROC AND DEVPTS ---------------------------------------- When invoking your script multiple (this case 2) times it will result in: mount proc $LFS/proc -t proc mount devpts $LFS/dev/pts -t devpts echo "Proc and Devpts mounted. Now going into the Chroot Environment......."; chroot /drives/lmc-linux /tools/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ $COMMAND echo "Command done."; mount proc $LFS/proc -t proc mount devpts $LFS/dev/pts -t devpts echo "Proc and Devpts mounted. Now going into the Chroot Environment......."; chroot /drives/lmc-linux /tools/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ $COMMAND echo "Command done."; As you can see, you''ll mount 2 times proc and devpts: mount proc $LFS/proc -t proc mount devpts $LFS/dev/pts -t devpts ... mount proc $LFS/proc -t proc mount devpts $LFS/dev/pts -t devpts This is of course generates that error. Just mount it 1 time. Dont do it in your script. You don't need any script... As I will explain. You can check if the proc and devpts are mounted by the command "mount" or looking in the file "/etc/mtab". 3 CHROOT PROBLEM -------------------------- Normally one will only chroot 1 time, executing a shell (eg bash). Then all commands entered in this bash session are executed in the chroot environment. This is what you like. If you want multiple commands to execute without user intervention you can make a bashscript and run this. Eg: --script-for-chroot.sh-- #!/bin/bash echo "Now in chroot environment" echo "Your new environment is: " env echo "Leaving chroot environment" ----------------------------- Does this work in on your system? chroot "$LFS" /tools/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ bash --login +h I think it should... greets, Tom |
Just a few observations. If you want to build a Linux system automatically why don't you use Gentoo? Linux From Scratch is really for people who want to take the time to learn how linux works.
If you don't put && at the end of every line the script will go down the list of commands and execute each of them in turn whether or not the previous one succeeded so just because it prints out whatever doesn't mean the previous commands worked. How can a script enter chroot? That doesn't make sense. You start running the script on a bash binary on your host computer and then expect it to pass control to a new binary in the chroot environment and continue running the script from the same point? Automated Linux From Scratch has an application that's capable of this if you're interested. It uses xml scripts to control it. |
I meant:
script: in your new environment is called: dosomething.sh and then chroot /mnt/lfs /bin/dosomething.sh - Tom |
Indeed, your post is clear and helpful and makes perfect sense. It wasn't you I was ranting against, tvburger. I'm sorry if I caused any offence.
|
Hi folks,
LFS 6.1 FC3 Host I ran to the same problem; [root@localhost ~]# chroot "$LFS" /tools/bin/env -i HOME=/root TERM="$TERM" PS1='\u:\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h Code:
/tools/bin/env: /tools/bin/bash: No such file or directory [root@localhost ~]# readelf -l /bin/dmesg | grep interpreter [Requesting program interpreter: /lib/ld-linux.so.2] [root@localhost ~]# find / -name bash Code:
/root/bash B.R. satimis |
All times are GMT -5. The time now is 12:06 AM. |