LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Unable to enter Chroot environment at 7.4 in the booklet. (https://www.linuxquestions.org/questions/linux-from-scratch-13/unable-to-enter-chroot-environment-at-7-4-in-the-booklet-4175728130/)

Azureian 08-17-2023 01:18 PM

Unable to enter Chroot environment at 7.4 in the booklet.
 
Hello, I am experiencing an issue where when I run the commands:
Code:

chroot "$LFS" /usr/bin/env -i \
 HOME=/root                  \
 TERM="$TERM"                \
 PS1='(lfs chroot) \u:\w\$ '  \
 PATH=/usr/bin:/usr/sbin      \
 MAKEFLAGS='-j4'              \
 /bin/bash --login

It displays
Code:

chroot: failed to run command ‘/usr/bin/env’: No such file or directory
I have read many forums and still can't figure out how to fix this.
I tried fixing the symlinks, but it did not work.

My $LFS variable is set to '/mnt/lfs'

Running 'ls -l /usr/bin/env' returns:
Code:

-rwxr-xr-x 1 root root 48536 Sep 20  2022 /usr/bin/env
Here are my permissions:
Code:

total 48
drwxr-xr-x  13 root root  4096 Aug 17 13:48 .
drwxr-xr-x  3 root root  4096 Aug 16 21:17 ..
lrwxrwxrwx  1 root root    7 Aug 17 13:48 bin -> usr/bin
drwxr-xr-x  18 root root  3520 Aug 16 22:41 dev
drwxr-xr-x  2 root root  4096 Aug 16 22:58 etc
lrwxrwxrwx  1 root root    7 Aug 17 13:48 lib -> usr/lib
drwxr-xr-x  2 root root  4096 Aug 17 13:46 lib64
drwx------  2 root root 16384 Aug 16 21:11 lost+found
dr-xr-xr-x 293 root root    0 Aug 17 13:36 proc
drwxrwxrwt  2 root root    40 Aug 17 13:36 run
lrwxrwxrwx  1 root root    8 Aug 17 13:48 sbin -> usr/sbin
drwxrwxrwt  2 lfs  root  4096 Aug 17 00:10 sources
dr-xr-xr-x  13 root root    0 Aug 16 20:47 sys
drwxr-xr-x  8 root root  4096 Aug 16 22:42 tools
drwxr-xr-x  9 root root  4096 Aug 16 23:50 usr
drwxr-xr-x  3 root root  4096 Aug 16 22:58 var

LDD for '/usr/bin/env'
Code:

        linux-vdso.so.1 (0x00007fffd9283000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8c5b459000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f8c5b667000)

ls output:
Code:

bin  etc  lib64      proc  sbin    sys    usr
dev  lib  lost+found  run  sources  tools  var

I would appreciate it if someone could inform me of what needs to be changed.

If it matters, I am running Kali 2023.2a 64bit on VMware Workstation 17.

Emerson 08-18-2023 10:30 PM

Quote:

My $LFS variable is set to '/mnt/lfs'
Then you must have /mnt/lfs/usr/bin/env for this command to work.

hazel 08-19-2023 03:37 AM

It should work if LFS is correctly set at the time the chroot command is given. Have you been doing this build in stages? If so, you need to visually check that LFS is set at the start of each stage.

@emerson: here is the version from the book
Code:

chroot "$LFS" /usr/bin/env -i  \
    HOME=/root                  \
    TERM="$TERM"                \
    PS1='(lfs chroot) \u:\w\$ ' \
    PATH=/usr/bin:/usr/sbin    \
    /bin/bash --login


derguteweka 08-21-2023 02:52 AM

Moin,

Quote:

Originally Posted by Azureian (Post 6448889)
Code:

        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8c5b459000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f8c5b667000)


Do both files exist (in /mnt/lfs) with sensible sizes/content?


cheers,
WK


All times are GMT -5. The time now is 02:16 AM.