LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   [lfs 7.2] many command not found after chroot (https://www.linuxquestions.org/questions/linux-from-scratch-13/%5Blfs-7-2%5D-many-command-not-found-after-chroot-4175431804/)

mercuyr 10-12-2012 02:39 AM

[lfs 7.2] many command not found after chroot
 
Hi experts,

# ldd /tools/bin/bash
linux-vdso.so.1 => (0x00007fff4dbff000)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x0000003d5a800000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003d4ac00000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003d4dc00000)
libc.so.6 => /lib64/libc.so.6 (0x0000003d4a400000)
/tools/lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x0000003d4a000000)

# ldd /bin/bash
linux-vdso.so.1 => (0x00007fff563ff000)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x0000003d5a800000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003d4ac00000)
libc.so.6 => /lib64/libc.so.6 (0x0000003d4a400000)
/lib64/ld-linux-x86-64.so.2 (0x0000003d4a000000)

# 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
I have no name!:/# ls
bash: /bin/ls: No such file or directory
I have no name!:/# mkdir
bash: /tools/bin/mkdir: No such file or directory
I have no name!:/#

could anyone point me what's going wrong here?

druuna 10-12-2012 11:36 AM

There's not enough info yet to point to anything specific.

Just a thought: Is $LFS (still) mounted?

From outside the chrooted environment, what do the following commands show you:
Code:

mount
ls -l $LFS


mercuyr 10-16-2012 01:54 AM

1 Attachment(s)
Quote:

Originally Posted by druuna (Post 4804052)
There's not enough info yet to point to anything specific.

Just a thought: Is $LFS (still) mounted?

From outside the chrooted environment, what do the following commands show you:
Code:

mount
ls -l $LFS


Thanks for the reply, ls $LFS is still "/mnt/lfs".

I revert everything and start from the beginning, but been blocking at compiling gcc pass1:

configure: error: in `/mnt/lfs/sources/gcc-build/x86_64-lfs-linux-gnu/libgomp':
configure: error: C compiler cannot create executables

it happened on my two Fedora 16 box and a RHEL6 box, they have the same result above.

druuna 10-16-2012 02:01 AM

Quote:

Originally Posted by mercuyr (Post 4806786)
ls $LFS is still "/mnt/lfs".

That doesn't answer my question. /mnt/lfs is a mount point and will show when you execute ls $LFS.

Is the partition still mounted on that specific mount point? (2.4. Mounting the New Partition)

Quote:

I revert everything and start from the beginning, but been blocking at compiling gcc pass1:

configure: error: in `/mnt/lfs/sources/gcc-build/x86_64-lfs-linux-gnu/libgomp':
configure: error: C compiler cannot create executables

it happened on my two Fedora 16 box and a RHEL6 box, they have the same result above.
Is your host made fully compliant with the host requirements? Run the script mentioned in vii. Host System Requirements and post the outcome.

mercuyr 10-16-2012 04:12 AM

$ sh c1-version-check.sh
bash, version 4.2.37(1)-release
/bin/sh -> /usr/bin/bash
Binutils: version 2.22.52.0.1-10.fc17 20120131
bison (GNU Bison) 2.5
/usr/bin/yacc -> /usr/bin/yacc
bzip2, Version 1.0.6, 6-Sept-2010.
Coreutils: 8.15
diff (GNU diffutils) 3.2
find (GNU findutils) 4.5.10
GNU Awk 4.0.1
/usr/bin/awk -> /usr/bin/gawk
gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2)
(GNU libc) 2.15
grep (GNU grep) 2.14
gzip 1.4
Linux version 3.6.1-1.fc17.x86_64 (mockbuild@) (gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC) ) #1 SMP Wed Oct 10 12:13:05 UTC 2012
m4 (GNU M4) 1.4.16
GNU Make 3.82
patch 2.6.1
Perl version='5.14.2';
GNU sed version 4.2.1
tar (GNU tar) 1.26
Texinfo: makeinfo (GNU texinfo) 4.13
xz (XZ Utils) 5.1.2alpha
gcc compilation OK

druuna 10-16-2012 04:24 AM

Quote:

Originally Posted by mercuyr (Post 4806892)
$ sh c1-version-check.sh
bash, version 4.2.37(1)-release
/bin/sh -> /usr/bin/bash
Binutils: version 2.22.52.0.1-10.fc17 20120131
bison (GNU Bison) 2.5
/usr/bin/yacc -> /usr/bin/yacc
bzip2, Version 1.0.6, 6-Sept-2010.
Coreutils: 8.15
diff (GNU diffutils) 3.2
find (GNU findutils) 4.5.10
GNU Awk 4.0.1
/usr/bin/awk -> /usr/bin/gawk
gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2)
(GNU libc) 2.15
grep (GNU grep) 2.14
gzip 1.4
Linux version 3.6.1-1.fc17.x86_64 (mockbuild@) (gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC) ) #1 SMP Wed Oct 10 12:13:05 UTC 2012
m4 (GNU M4) 1.4.16
GNU Make 3.82
patch 2.6.1
Perl version='5.14.2';
GNU sed version 4.2.1
tar (GNU tar) 1.26
Texinfo: makeinfo (GNU texinfo) 4.13
xz (XZ Utils) 5.1.2alpha
gcc compilation OK

The blue entries might cause problems. I assume you are at the beginning of chapter 6 (6.4), with that in mind: I doubt these are the culprits because you do not mention any problems when building chapter 5.

How about my other/original question? (Is the partition still mounted on that specific mount point?).

mercuyr 10-16-2012 04:39 AM

Quote:

Originally Posted by druuna (Post 4806904)
The blue entries might cause problems. I assume you are at the beginning of chapter 6 (6.4), with that in mind: I doubt these are the culprits because you do not mention any problems when building chapter 5.

Thanks for the point out, but my fedora 17 box is already updated to latest. Any suggestion to build the best environment for LFS?


How about my other/original question? (Is the partition still mounted on that specific mount point?).

I have no the original environment now, so I cannot sure about it.

EDDY1 10-16-2012 04:40 AM

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
I have no name!:/# ls
bash: /bin/ls: No such file or directory
I have no name!:/# mkdir
bash: /tools/bin/mkdir: No such file or directory
I have no name!:/#

could anyone point me what's going wrong here?
The -i variable makes empty environment.
mkdir will fail because you haven't stated what directory to make.

druuna 10-16-2012 04:50 AM

Quote:

Originally Posted by EDDY1 (Post 4806924)
The -i variable makes empty environment.

Yes it does, but the rest of the command sets the environment (including PATH).

Quote:

mkdir will fail because you haven't stated what directory to make.
Also true, but you'll get another error message (mkdir: missing operand), besides that the ls command also doesn't seem to work.

druuna 10-16-2012 04:55 AM

@mercuyr: This thread seems to tackle an old problem and a new one.

Please tell us:
- which problem you are trying to tackle,
- which host you are using,
- which chapter you are,
- which error(s) you are facing.

If an error meassage is shown, please post it including a few lines before the error (have a look here: Help)

mercuyr 10-16-2012 05:50 AM

1 Attachment(s)
Quote:

Originally Posted by druuna (Post 4806943)
@mercuyr: This thread seems to tackle an old problem and a new one.

Please tell us:
- which problem you are trying to tackle,
- which host you are using,
- which chapter you are,
- which error(s) you are facing.

If an error meassage is shown, please post it including a few lines before the error (have a look here: Help)

- The problem I have now is that, compile GCC-4.7.1 Pass 1 failed (chapter 5.5):
make[2]: Leaving directory `/mnt/lfs/sources/gcc-build/x86_64-lfs-linux-gnu/libgcc'
Checking multilib configuration for libgomp...
mkdir -p -- x86_64-lfs-linux-gnu/libgomp
Configuring in x86_64-lfs-linux-gnu/libgomp
configure: creating cache ./config.cache
checking for --enable-version-specific-runtime-libs... no
checking for --enable-generated-files-in-srcdir... no
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-lfs-linux-gnu
checking target system type... x86_64-lfs-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for x86_64-lfs-linux-gnu-strip... /tools/x86_64-lfs-linux-gnu/bin/strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for x86_64-lfs-linux-gnu-gcc... /mnt/lfs/sources/gcc-build/./gcc/xgcc -B/mnt/lfs/sources/gcc-build/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include
checking for C compiler default output file name...
configure: error: in `/mnt/lfs/sources/gcc-build/x86_64-lfs-linux-gnu/libgomp':
configure: error: C compiler cannot create executables
See `config.log' for more details.
make[1]: *** [configure-target-libgomp] Error 1
make[1]: Leaving directory `/mnt/lfs/sources/gcc-build'
make: *** [all] Error 2

- which host you are using,
Fedora 17 32 & 64, RHEL6.2 64
Currently: BackTrack 5 R3 - 64 Bit

$ sh gh/c1-version-check.sh
bash, version 4.1.5(1)-release
/bin/sh -> /bin/bash
Binutils: (GNU Binutils for Ubuntu) 2.20.1-system.20100303
bison (GNU Bison) 2.4.1
/usr/bin/yacc -> /usr/bin/bison.yacc
bzip2, Version 1.0.5, 10-Dec-2007.
Coreutils: 7.4
diff (GNU diffutils) 2.8.1
find (GNU findutils) 4.4.2
GNU Awk 3.1.6
/usr/bin/awk -> /usr/bin/gawk
gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3
(Ubuntu EGLIBC 2.11.1-0ubuntu7.10) 2.11.1
GNU grep 2.5.4
gzip 1.3.12
Linux version 3.2.6 (root@bt) (gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) ) #1 SMP Fri Feb 17 10:34:20 EST 2012
m4 (GNU M4) 1.4.13
GNU Make 3.81
patch 2.6
Perl version='5.10.1';
GNU sed version 4.2.1
tar (GNU tar) 1.22
Texinfo: makeinfo (GNU texinfo) 4.13
xz (XZ Utils) 4.999.9beta
gcc compilation OK

druuna 10-16-2012 05:55 AM

You mention 4 hosts:
Quote:

Fedora 17 32 & 64, RHEL6.2 64
Currently: BackTrack 5 R3 - 64 Bit
Which one is it? You cannot use all four or use one and then switch to another (assuming the same LFS build).

The version check mentions ubuntu, which would make it 5 hosts (or is this from BackTrack?).

Did you remove the gcc source and build directories before retrying (have a look here: Second Important box).

It seems you are all over the place. I would suggest picking ONE host and start from scratch with the LFS build.

mercuyr 10-16-2012 06:02 AM

Quote:

Originally Posted by druuna (Post 4807000)
You mention 4 hosts: Which one is it? You cannot use all four or use one and then switch to another (assuming the same LFS build).

The version check mentions ubuntu, which would make it 5 hosts (or is this from BackTrack?).

Did you remove the gcc source and build directories before retrying (have a look here: Second Important box).

It seems you are all over the place. I would suggest picking ONE host and start from scratch with the LFS build.

It is I have compiled the GCC in 4 hosts, every time was extracting source separately, not use any old dir.
the check version mentioned ubuntu is the backtrack host.

druuna 10-16-2012 06:08 AM

Assuming an Ubuntu based host, have a look here: LFS 7.1 on Ubuntu 12.04. Maybe you notice anything that you do different and can fix the problem that way. Your partition layout may differ, but that shouldn't be a problem.


All times are GMT -5. The time now is 08:49 PM.