LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 03-26-2021, 06:34 PM   #1
farhatb
LQ Newbie
 
Registered: Mar 2021
Location: Tunisia
Distribution: Ubuntu
Posts: 3

Rep: Reputation: Disabled
Question lfs 10.1 | Entering the Chroot Environment | Ubuntu 20.04 | '/usr/bin/env’: Not a directory


Hello,
Host distribution: Ubuntu 20.04
LFS book version: 10.1
Section where the problem was encountered: 7.4. Entering the Chroot Environment
Error:
Code:
root@farhat-pc:/mnt/lfs# chroot "$LFS" /usr/bin/env -i   \
>     HOME=/root                  \
>     TERM="$TERM"                \
>     PS1='(lfs chroot) \u:\w\$ ' \
>     PATH=/bin:/usr/bin:/sbin:/usr/sbin \
>     /bin/bash --login +h
chroot: failed to run command ‘/usr/bin/env’: Not a directory
$LFS/bin/usr/env:
Code:
root@farhat-pc:/mnt/lfs# ls -lah usr/bin/env
-rwxr-xr-x 1 root root 265K mars 26 15:50 usr/bin/env
'$LFS/usr/env' is a file file not a directory!!
I am sure that I have followed the two previous section 7.2 && 7.3
Any hint please?
 
Old 03-26-2021, 06:44 PM   #2
goldennuggets
Member
 
Registered: Feb 2003
Location: USA
Distribution: Kubuntu, Manjaro
Posts: 239

Rep: Reputation: 24
I'm experiencing the same thing, building on top of OpenSuse.
https://www.linuxquestions.org/quest...ry-4175692690/
 
Old 03-27-2021, 06:11 AM   #3
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,152

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
is LFS set correctly?
 
Old 03-27-2021, 07:33 AM   #4
farhatb
LQ Newbie
 
Registered: Mar 2021
Location: Tunisia
Distribution: Ubuntu
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Keith Hedger View Post
is LFS set correctly?
Yes, sure
 
Old 03-27-2021, 08:51 AM   #5
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,152

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
is $LFS actually mounted?
 
Old 03-27-2021, 08:53 AM   #6
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,152

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
what is at $LFS/dev , $LFS/proc etc ie are the virtual systems mounted, what are the mount options for $LFS

Last edited by Keith Hedger; 03-27-2021 at 08:54 AM.
 
Old 03-27-2021, 09:15 AM   #7
goldennuggets
Member
 
Registered: Feb 2003
Location: USA
Distribution: Kubuntu, Manjaro
Posts: 239

Rep: Reputation: 24
Quote:
Originally Posted by Keith Hedger View Post
what is at $LFS/dev , $LFS/proc etc ie are the virtual systems mounted, what are the mount options for $LFS
I'm experiencing the same exact issues with $LFS mounted, the proper environment variables set, and virtual systems mounted according to the instructions in the 10.1 guide.
https://www.linuxquestions.org/quest...ry-4175692690/

It's a bit odd that both of us, on the same day, ran into the same issue, at the same exact point in the process.
 
Old 03-27-2021, 09:38 AM   #8
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,152

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
I had a similar problem when 1st using the new build system, it was the lib folders, are you using /lib64 and /usr/lib64 ( presuming a 64 bit machine ) or are you using /lib and /usr/lib ?

On my system /lib is symlink to /lib64 and /usr/lib is symlink to /usr/lib64.
 
Old 03-27-2021, 09:54 AM   #9
goldennuggets
Member
 
Registered: Feb 2003
Location: USA
Distribution: Kubuntu, Manjaro
Posts: 239

Rep: Reputation: 24
Quote:
Originally Posted by Keith Hedger View Post
I had a similar problem when 1st using the new build system, it was the lib folders, are you using /lib64 and /usr/lib64 ( presuming a 64 bit machine ) or are you using /lib and /usr/lib ?

On my system /lib is symlink to /lib64 and /usr/lib is symlink to /usr/lib64.
Very interesting and insightful!
So, it appears that I'm using /lib and /usr/lib for all but the following:
Inside /mnt/lfs/lib64 are ld-linux-x86_64.so.2 and ld-lsb-x86-64.so.3
/mnt/lfs/usr/lib64 contains several libstdc++ libraries

What do you think is the best way to proceed from here since there are libs in both?
 
Old 03-27-2021, 10:39 AM   #10
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,152

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
My only fix was to start from scratch, and make sure the links were in at the begining sorry
 
Old 03-27-2021, 10:40 AM   #11
goldennuggets
Member
 
Registered: Feb 2003
Location: USA
Distribution: Kubuntu, Manjaro
Posts: 239

Rep: Reputation: 24
Quote:
Originally Posted by Keith Hedger View Post
My only fix was to start from scratch, and make sure the links were in at the begining sorry
Ouch...
 
Old 03-27-2021, 11:07 AM   #12
KDSR
Member
 
Registered: Jan 2021
Location: Tucson
Distribution: Slackware
Posts: 31

Rep: Reputation: Disabled
probably this.... chapter 5.5.1

Code:
case $(uname -m) in
    i?86)   ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3
    ;;
    x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
            ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3
    ;;
esac
sym links not made properly
 
Old 03-27-2021, 12:39 PM   #13
goldennuggets
Member
 
Registered: Feb 2003
Location: USA
Distribution: Kubuntu, Manjaro
Posts: 239

Rep: Reputation: 24
Quote:
Originally Posted by KDSR View Post
probably this.... chapter 5.5.1

Code:
case $(uname -m) in
    i?86)   ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3
    ;;
    x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
            ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3
    ;;
esac
sym links not made properly
Okay! Now we're getting somewhere...however...
I've now run into this:
Code:
chroot: failed to run command ‘/usr/bin/env’: Too many levels of symbolic links
 
Old 03-27-2021, 01:15 PM   #14
farhatb
LQ Newbie
 
Registered: Mar 2021
Location: Tunisia
Distribution: Ubuntu
Posts: 3

Original Poster
Rep: Reputation: Disabled
Lightbulb

Thank you all,
I restart the process from the beginning and the issue has been resolved(It took me ~2-3 hours)
 
Old 03-27-2021, 01:21 PM   #15
hendrickxm
Member
 
Registered: Feb 2014
Posts: 344

Rep: Reputation: Disabled
You should have made those symlinks in chapter 5.5 and not afterwards.
Unfortunately this means redoing chapter 5.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Cannot find 'ssh-keygen' in '/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin' venu.navat Linux - Software 3 03-08-2012 04:00 AM
echo $PATH = /home/g3rc4n/bin:/usr/local/bin:/usr/bin:/bin:/usr/games ? i_heart_pandas Linux - Software 7 09-18-2009 08:33 AM
RPM dependency failure: /usr/bin/env instead of /bin/env anoosh3000 Linux - Software 1 04-10-2009 05:34 AM
6.4. Entering the Chroot Environment: /tools/bin/env: no such file jpeters Linux From Scratch 1 03-29-2009 09:58 PM
sudo /usr/bin/chroot /home/chroot /bin/su - xxx| /bin/su: user xxx does not exist saavik Linux - General 3 07-04-2007 10:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 12:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration