LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (http://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Error while 'chrooting' into build environment (http://www.linuxquestions.org/questions/linux-from-scratch-13/error-while-chrooting-into-build-environment-891412/)

sudeepkulkarni 07-13-2011 12:09 AM

Error while 'chrooting' into build environment
 
Hi, I have taken up LFS as my college project. I have completed the test system installation so far and now going to continue with actual system building (i.e. chapter 6)

The problem is that when I give the 'chroot' command i.e.

Quote:

chroot "$LFS" /tools/bin/env -i......
I get error as
Quote:

:/tools/bin/env - no such file or folder found
.

But when I manually check the /tools/bin directory,I can find the required file 'env'. So what can be the error?

zer0signal 07-13-2011 01:09 AM

a) are you root?

b) do the command pwd from where you are issueing the

Quote:

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

sudeepkulkarni 07-14-2011 12:54 AM

Yes, I am indeed performing the operation as root.

The o/p of pwd command is, as expected:

Quote:

/

druuna 07-14-2011 02:41 AM

Hi,

I really doubt that the following is what was shown after the chroot command:
Quote:

:/tools/bin/env - no such file or folder found
Can you post the complete and correct error message that is shown?

Also provide some basic information:
- Are you building the latest stable LFS (6.8),
- Which host are you using and did you make it compliant,
- Did you have any problems in the previous chapters.

Although the error message shown isn't correct/complete, the only thing I can come up with is this: Is $LFS (/mnt/lfs) mounted?

Hope this helps.

sudeepkulkarni 07-16-2011 01:29 AM

Here are the answers as requested:

1) Yes, I am using the latest build i.e. 6.8

2)I am using Linux Mint 11 (Katya) i686. I am not sure what you mean when you say "making it compliant" - but I have run the script to test whether the system is ready for compilation or not and the output was "compilation OK"

3)I did encounter a few problems while building the test system, e.g. GCC, GLIBC didn't compile successfully at first. But then i simply removed the respective files and folders and reinstalled it - then there was no problem.

4)Here is the output of "mount" command confirming that I have indeed mounted the /mnt/lfs i.e. $LFS partition:

Quote:

/dev/sda8 on / type ext4 (rw,errors=remount-ro,commit=0)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/swapnil/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=swapnil)
/dev/sda10 on /mnt/lfs type ext3 (rw)
Quote:

swapnil-inspiron / # 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
chroot: failed to run command `/tools/bin/env': No such file or directory
swapnil-inspiron / #

5)Here is the o/p of of the "/tools/bin/env" command which is a symlink to $LFS/tools/bin/env

Quote:

swapnil-inspiron bin # env
ORBIT_SOCKETDIR=/tmp/orbit-swapnil
SSH_AGENT_PID=1533
SHELL=/bin/bash
TERM=xterm
XDG_SESSION_COOKIE=97d685c54e6ce41e1602a4d500000008-1310796704.632489-1247394897
WINDOWID=62914593
GNOME_KEYRING_CONTROL=/tmp/keyring-23T8sl
GTK_MODULES=canberra-gtk-module
USER=root
LFS=/mnt/lfs
SSH_AUTH_SOCK=/tmp/keyring-23T8sl/ssh
DEFAULTS_PATH=/usr/share/gconf/gnome.default.path
USERNAME=swapnil
SESSION_MANAGER=local/swapnil-inspiron:@/tmp/.ICE-unix/1500,unix/swapnil-inspiron:/tmp/.ICE-unix/1500
XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg
MAIL=/var/mail/root
DESKTOP_SESSION=gnome
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
LC_MESSAGES=en_IN.UTF-8
PWD=/tools/bin
GDM_KEYBOARD_LAYOUT=us
LANG=en_IN
GNOME_KEYRING_PID=1481
MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path
GDM_LANG=en_IN
COMPIZ_CONFIG_PROFILE=ubuntu
UBUNTU_MENUPROXY=libappmenu.so
GDMSESSION=gnome
HOME=/root
SHLVL=2
LANGUAGE=en_IN:en
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
LOGNAME=root
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-DJu28hmYb6,guid=b17f26ce8eabb92246c934db00000026
XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/
WINDOWPATH=7
DISPLAY=:0
XAUTHORITY=/var/run/gdm/auth-for-swapnil-x2XoKc/database
COLORTERM=gnome-terminal
_=/usr/bin/env
OLDPWD=/
Hope this much information is sufficient.

druuna 07-16-2011 03:36 AM

Hi,
Quote:

Originally Posted by sudeepkulkarni (Post 4416299)
2)I am using Linux Mint 11 (Katya) i686. I am not sure what you mean when you say "making it compliant" - but I have run the script to test whether the system is ready for compilation or not and the output was "compilation OK"

I am talking about this: vii. Host System Requirements

Quote:

4)Here is the output of.....
Quote:

swapnil-inspiron / # 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
chroot: failed to run command `/tools/bin/env': No such file or directory

I see mistakes in the above command (in red). These aren't show stoppers, but I do wonder if you made any other "typo's".

Quote:

5)Here is the o/p of of the "/tools/bin/env" command which is a symlink to $LFS/tools/bin/env
The env command is reachable and working, as the above output shows.

Maybe something went wrong in chapter 5 (I'm guessing the toolchain or gcc), if that is the case all packages you build are not linked correctly. What is the output of the following command (as root):
Code:

ldd /tools/bin/env
The output should show something like this:
Code:

ldd /tools/bin/env
  libc.so.6 => /tools/lib/libc.so.6
  /tools/lib64/ld-linux-x86-64.so.2

If the bold parts are missing: You need to start all over again!

Hope this helps.

sudeepkulkarni 07-18-2011 01:37 AM

Oh no!!! :cry: the bold parts are definitely missing. So I screwed up while installing, resulting in incorrect links. All the libraries are linked to the host system itself

So I am going to start the whole procedure again. But I do have one question - is there a way to verify that whatever packages that have been installed are set up properly? It would be immensely helpful if I could verify the correctness of the installed packages.

Also can anyone suggest what would be the perfect host system for installing this LFS latest build? I am thinking of following distros:

1)Slackware (13.1/13.37)

2)Linux Mint(10/11)

3)CentOS (5.6/6)

Which of these sounds good?

druuna 07-18-2011 02:09 AM

Hi,
Quote:

Originally Posted by sudeepkulkarni (Post 4417793)
Oh no!!! :cry: the bold parts are definitely missing. So I screwed up while installing, resulting in incorrect links. All the libraries are linked to the host system itself

That's a bummer!

Quote:

So I am going to start the whole procedure again. But I do have one question - is there a way to verify that whatever packages that have been installed are set up properly? It would be immensely helpful if I could verify the correctness of the installed packages.
The build process for each package should, in general, tell you if it was done correctly. When you reach chapter 6 you will also do a make check/test step to verify the build. Doing this step in chapter 5 isn't useful (as mentioned in the book). You could run them, but a failed test does not mean that the package was build incorrectly (for chapter 5, you must run the make check/test steps in chapter 6).

The LFS team created some test for packages/steps that are really important (have a look at 5.8 and 5.10). These test should not fail, if they do you need to figure out what went wrong and fix it before continuing!

Quote:

Also can anyone suggest what would be the perfect host system for installing this LFS latest build? I am thinking of following distros:
1)Slackware (13.1/13.37)
2)Linux Mint(10/11)
3)CentOS (5.6/6)
Which of these sounds good?
The LFS liveCD is the best host, although if you have state of the art hardware it might fail (mentioned here).

If you do want to use a distro I would choose Slackware (I prefer Debian, but that one isn't on your list). Do make sure that you make the host compliant!! Not doing so will get you in trouble.

TIP: Once you reach the end of chapter 5 I would advise you to make a backup of what you have build this far. This will make sure that you do not have to start from scratch if you make a mistake in chapter 6 (caution box near the bottom).

Hope this helps.

sudeepkulkarni 07-18-2011 09:11 AM

1 Attachment(s)
So I started rebuilding the system and soon encountered an error. The GCC pass-1 phase didn't complete successfully. I encountered problem while running command "make". I have attached the "config.log" file from GCC build process here. Please tell me what is wrong.

Thanks for the help.

druuna 07-18-2011 09:15 AM

Hi,

Can you also post the error(s) shown in the terminal?

EDIT: Is the make command installed on your host distro?

sudeepkulkarni 07-19-2011 12:04 AM

1 Attachment(s)
Here is the output of "make" command as attachment.

And yes, make command is there on Slackware 13.37 (host)

druuna 07-19-2011 01:49 AM

Hi,

The only time I've seen errors like this is when the host is not compliant. In this case I'm guessing that gcc related programs are missing on your host. Revisit the host requirements page and make sure _all_ is correct!

BTW: Why don't you use the LFS liveCD instead of Slackware?

sudeepkulkarni 07-21-2011 05:29 AM

2 Attachment(s)
Okay, so I am now past GCC compilation, it is successful. Now when I try to install glibc-2.13, I get following error:

Quote:

make[1]: Failed to remake makefile `/mnt/lfs/tools/build/config.make'.
make[1]: *** No rule to make target `/mnt/lfs/tools/build/Versions.all', needed by `/mnt/lfs/tools/build/abi-versions.h'. Stop.
make[1]: Leaving directory `/mnt/lfs/tools/glibc-2.13'
make: *** [all] Error 2
Is it again due to non-compliance? The glibc version in host is 2.11.1, which I think is allowed. I am attaching the 'config.log' file and o/p of the shell script 'version-check.sh'.

druuna 07-21-2011 05:51 AM

Hi,

The error message you posted is just that, the possible interesting parts are the lines before the error is shown. Please post those (if you are not sure, post the 10-15 lines before the make[1]: Failed to remake makefile `/mnt/lfs/tools/build/config.make'. line.

One thing that I do notice: I don't see the glibc-build directory from which you should do the build steps (/mnt/lfs/sources/glibc-2.13 vs /mnt/lfs/sources/glibc-build) and there's also no /mnt/lfs/sources directory.

BTW: I had a look at the output created by the version-check.txt script: That looks fine.

EDIT: Please read this chapter so we don't have to keep asking for extra/correct information: 1.5. Help

sudeepkulkarni 07-21-2011 11:51 PM

Here is what I do while installing any package:

1. Unpack the package archive in the host OS itself.
2. Change its permissions
3. cp -rv /path/to/<pkg-name> $LFS/tools
4. mkdir -v $LFS/tools/<pkg-build>
5. cd <pkg-build>
6. $LFS/tools/<pkg-name>/configure...........
7. make
8. make install

IS there something wrong with this scheme? Do I have to create the sources directory?

P.S. I will post the whole make log shortly.


All times are GMT -5. The time now is 05:43 PM.