Can't change root in cross-lfs-multilib-x86_64

Hi,

I get chroot error during chrooting into clfs

chroot "${CLFS}" /tools/bin/env -i HOME=/root TERM="${TERM}" PS1='\uw\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h
chroot: cannot change root directory to : No such file or directory 

My builds went smooth, it gave a couple of errors but I fixed those.

How do I chroot into clfs.

Best,

Dave

What you do not show is what the value of the parameter CLFS is. It looks like ${CLFS} gives a file that does not exist (No such file or directory). Thus first show:

echo "${CLFS}"

It gives -

/mnt/clfs

I’ve set environment right and followed the book in totality. Didnt get any errors till bash build and later had to rebuild ncurses & bash. Should I set environment again.

As you may have noticed I am not even looking into clfs (I do not even know what it is) or if you build/installed that correct. I am simply looking at the chroot statement you typed and the error it gives.

So you want to chroot to* /mnt/clfs.* Now the next mini-step (I thought you would have found that yourself) in this troubleshooting is of course checking if /mnt/clfs exists:

ls -l /mnt/clfs

Thus, little step by little step, one checks all the parameters of the chroot statement to see if we can see the same a chroot sees: No such file or directory.

Here are various details -

/mnt/clfs$ ls -l
total 60
drwxr-xr-x 9 clfs root 4096 Dec 27 08:36 cross-tools
-rw-r–r-- 1 root root 434 Dec 27 16:16 errors
drwx------ 2 root root 16384 Dec 27 03:54 lost+found
-rw-r–r-- 1 root root 25151 Dec 27 16:31 progress
drwxrwxrwx 37 clfs root 4096 Dec 27 16:43 sources
drwxr-xr-x 14 clfs root 4096 Dec 27 13:17 tools

ls -la /lib/ld*
-rwxr-xr-x 1 root root 133995 Nov 29 2007 /lib/ld-2.5.1.so
lrwxrwxrwx 1 root root 11 Nov 29 2007 /lib/ld-linux-x86-64.so.2 -> ld-2.5.1.so
clfs:/mnt/clfs$ ldd -v /bin/bash
libreadline.so.5 => /lib/libreadline.so.5 (0x00002b802bec9000)
libhistory.so.5 => /lib/libhistory.so.5 (0x00002b802c006000)
libncursesw.so.5 => /lib/libncursesw.so.5 (0x00002b802c10e000)
libdl.so.2 => /lib/libdl.so.2 (0x00002b802c276000)
libc.so.6 => /lib/libc.so.6 (0x00002b802c37a000)
/lib64/ld-linux-x86-64.so.2 (0x00002b802bdad000)

Version information:
/bin/bash:
libdl.so.2 (GLIBC_2.2.5) => /lib/libdl.so.2
libc.so.6 (GLIBC_2.4) => /lib/libc.so.6
libc.so.6 (GLIBC_2.3) => /lib/libc.so.6
libc.so.6 (GLIBC_2.3.4) => /lib/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/libc.so.6
/lib/libreadline.so.5:
libc.so.6 (GLIBC_2.3) => /lib/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/libc.so.6
/lib/libhistory.so.5:
libc.so.6 (GLIBC_2.2.5) => /lib/libc.so.6
/lib/libncursesw.so.5:
libdl.so.2 (GLIBC_2.2.5) => /lib/libdl.so.2
libc.so.6 (GLIBC_2.3) => /lib/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/libc.so.6
/lib/libdl.so.2:
libc.so.6 (GLIBC_2.2.5) => /lib/libc.so.6
libc.so.6 (GLIBC_PRIVATE) => /lib/libc.so.6
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
/lib/libc.so.6:
ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2

ldd /bin/bash
libreadline.so.5 => /lib/libreadline.so.5 (0x00002b82cee9f000)
libhistory.so.5 => /lib/libhis

Please, please, use CODE instead of QUOTE tags around computer text. Posting in Code Tags - A Guide

This will take some extra time for me to study because all layout is flown out of the windows (no pun intended).

Sorry abt that. Check the corrected version. I got this off typescript and there may be few errors in the text body. Files ‘errors’ & ‘progress’ are text files with various details and are not part of build.

/mnt/clfs$ ls -l
total 60
drwxr-xr-x  9 clfs root  4096 Dec 27 08:36 cross-tools
-rw-r--r--  1 root root   434 Dec 27 16:16 errors
drwx------  2 root root 16384 Dec 27 03:54 lost+found
-rw-r--r--  1 root root 25151 Dec 27 16:31 progress
drwxrwxrwx 37 clfs root  4096 Dec 27 16:43 sources
drwxr-xr-x 14 clfs root  4096 Dec 27 13:17 tools

ls -la /lib/ld*
-rwxr-xr-x 1 root root 133995 Nov 29  2007 /lib/ld-2.5.1.so
lrwxrwxrwx 1 root root     11 Nov 29  2007 /lib/ld-linux-x86-64.so.2 -> ld-2.5.1.so
clfs:/mnt/clfs$ ldd -v /bin/bash
	libreadline.so.5 => /lib/libreadline.so.5 (0x00002b802bec9000)
	libhistory.so.5 => /lib/libhistory.so.5 (0x00002b802c006000)
	libncursesw.so.5 => /lib/libncursesw.so.5 (0x00002b802c10e000)
	libdl.so.2 => /lib/libdl.so.2 (0x00002b802c276000)
	libc.so.6 => /lib/libc.so.6 (0x00002b802c37a000)
	/lib64/ld-linux-x86-64.so.2 (0x00002b802bdad000)

	Version information:
	/bin/bash:
		libdl.so.2 (GLIBC_2.2.5) => /lib/libdl.so.2
		libc.so.6 (GLIBC_2.4) => /lib/libc.so.6
		libc.so.6 (GLIBC_2.3) => /lib/libc.so.6
		libc.so.6 (GLIBC_2.3.4) => /lib/libc.so.6
		libc.so.6 (GLIBC_2.2.5) => /lib/libc.so.6
	/lib/libreadline.so.5:
		libc.so.6 (GLIBC_2.3) => /lib/libc.so.6
		libc.so.6 (GLIBC_2.2.5) => /lib/libc.so.6
	/lib/libhistory.so.5:
		libc.so.6 (GLIBC_2.2.5) => /lib/libc.so.6
	/lib/libncursesw.so.5:
		libdl.so.2 (GLIBC_2.2.5) => /lib/libdl.so.2
		libc.so.6 (GLIBC_2.3) => /lib/libc.so.6
		libc.so.6 (GLIBC_2.2.5) => /lib/libc.so.6
	/lib/libdl.so.2:
		libc.so.6 (GLIBC_2.2.5) => /lib/libc.so.6
		libc.so.6 (GLIBC_PRIVATE) => /lib/libc.so.6
		ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
	/lib/libc.so.6:
		ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
		ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2


ldd /bin/bash
	libreadline.so.5 => /lib/libreadline.so.5 (0x00002b82cee9f000)
	libhistory.so.5 => /lib/libhis

It seems that /mnt/clfs exists (even if you gave me a different output then I asked for). I see also that /mnt/clfs/tools exists. What about /mnt/clfs/tools/bin/env?

EDIT: I do not know why you gave me the other iinformation. Do not know how to interprete in connection with the chroot error.

From what I understand is that there is a linking error. I have bash with staticlib but a dynamic link is needed (its still unclear to me). Some other guys at clfs irc asked that information too so I thought it might be appropriate.

For /mnt/clfs/tools/bin/env, I will have to login and check. Will get the details in few minutes.

Well, not knowiing anything about that product, I know something about chroot. In the end all files you mention there must exist. That is, the directories that go into the PATH variable used by env must not exist in the sense that they do not give an error here. That means that */mnt/clfs/tools/bin/env *must be there, but also /mnt/clfs/tools/bin/bash. When one of them is not there a “No such file or directory” can be expected, but I admit that chroot shows it in s strange place. I think it gets a non zero return code and then says that it can not chroot and then places the message that it got after that. Which gives the strange combination.

When you say that */mnt/clfs/tools/bin/bash *might be corrupted, I am not sure that “No such file or directory” would be the result. But on the other hand, who knows whith those old Unix/Linux tools with cryptic error messages.

This is what I get -

clfs:~$ ls /mnt/clfs/tools/bin/env
/mnt/clfs/tools/bin/env

And /mnt/clfs/tools/bin/bash?, you forgot about that one? But it looks if they are all there. (btw* ls -l* gives better information, we coould e.g. see if they are executable).

About static/dynamic linking. The theory is that you either:
. link static and thus have the library within the same file as the tool;
or
. link dynamic, but you then must have a that library in a proper place within the chroot-ed directory tree.
Thus your idea about static linking seems logical enouigh to me.

In general the setting up of a chroot-ed environment is tedious enough, because there is allway something that you forgot to copy: /etc/passwd and friends, static libraries, tools called from tools, you name it. But in this case it seems that you think your product must cope with it. It could be that the product fails because the openSUSE places of having things differ a bit from where other distros have them. Not easy to find.

I did it -


linux-taup:~ # export CLFS=/mnt/clfs
linux-taup:~ # echo ${CLFS}
/mnt/clfs
linux-taup:~ # chroot "${CLFS}" /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
I have no name!:/# 

Thanks everyone!

You mean that CLFS was not exported to the environment?

No it was, I created new files. Not certain yet but somehow it worked and now stuck at Perl. Thanks for your help.

You are welcome.

Normaly we are interested in having the solution here also because that may help others. But in this case I think it is rather special.

Succes!

I had to re create ~/.bash_profile & ~/.bashrc.

Thanks.

As I said earlier, in a chrooted environment it is very easy to forget something that one needs. OTOH putting there to much denies the principle of the chrooted environnment :frowning:

I agree, there isnt much support available for cross-lfs and that makes going tough.

I have now compiled the base system and will like to use zypper & YaST in BCLFS book. Any ideas on licensing of these tools.

Best,

Dave

You mean licensing zypper and/or YaST? They are Open Source. Look for GPL and GPL2 licences. In general as long as you provide the source when asked for there is no problem imho.