1

I am building Linux from Scratch (guide version 10.1). Everything compiled without any errors, but I am now stuck at the step where it requires me to enter the chroot environment (section 7.4). My command is the following:

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

It fails with the following error:

chroot: failed to run command ‘/usr/bin/env’: No such file or directory

I have checked the following things:

$LFS points to the correct path

/dev, /run, /proc, /sys, /dev/pts and /dev/shm are all correctly mounted

/usr/bin/env exists

/bin/bash exists

/bin/sh is a symlink to /bin/bash

/bin/bash and /usr/bin/env have all their dependencies installed to /lib and /lib64 (checked using ldd)

Also, I want to point out that I am doing this build on x86-64, for x86-64, on Ubuntu 20.04 using Linux kernel 5.4.

3 Answers 3

1

I found the problem! It was a bad symlink (/lib64/ld-linux-x86-64.so.2 pointed to the absolute path on the host system, not relative to the LFS root, /lib/ld-2.36.so). It is such a shame that chroot gave me such a misleading and vague error message, instead of clarifying what and where went wrong. I changed the link, and now it works perfectly fine.

0

I crushed same problem but I couldnt understand what do you mean by (/lib64/ld-linux-x86-64.so.2 pointed to the absolute path on the host system, not relative to the LFS root, /lib/ld-2.36.so) Could you explain more information about solution ? and how to change link ? And I want to poing that I am building x86-64 operation system.I found this at LFS11.0 5.5. Glibc-2.34 Host usr/bin/env:

COLORTERM=truecolor DISPLAY=:0.0 LANG=en_US.UTF-8 LANGUAGE= PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games TERM=xterm-256color XAUTHORITY=/home/kali/.Xauthority LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.zst=01;31:.tzst=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.wim=01;31:.swm=01;31:.dwm=01;31:.esd=01;31:.jpg=01;35:.jpeg=01;35:.mjpg=01;35:.mjpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.webp=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.m4a=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.oga=00;36:.opus=00;36:.spx=00;36:.xspf=00;36: MAIL=/var/mail/root LOGNAME=root USER=root HOME=/root SHELL=/usr/bin/zsh SUDO_COMMAND=/usr/bin/su SUDO_USER=kali SUDO_UID=1000 SUDO_GID=1000 LFS=/mnt/lfs COMMAND_NOT_FOUND_INSTALL_PROMPT=1 POWERSHELL_TELEMETRY_OPTOUT=1 DOTNET_CLI_TELEMETRY_OPTOUT=1 SHLVL=1 PWD=/usr/bin OLDPWD=/home/kali LESS_TERMCAP_mb= LESS_TERMCAP_md=
LESS_TERMCAP_me=
LESS_TERMCAP_so= LESS_TERMCAP_se=
LESS_TERMCAP_us= LESS_TERMCAP_ue=
_=/usr/bin/./env

LFS usr/bin/env:

PWD=/ HOME=/home/lfs TERM=xterm-256color SHLVL=1 PS1=${debian_chroot:+($debian_chroot)}\u@\h:\w$ LFS_TGT=x86_64-lfs-linux-gnu LC_ALL=POSIX LFS=/mnt/lfs CONFIG_SITE=/mnt/lfs/usr/share/config.site PATH=/mnt/lfs/tools/bin:/usr/bin _=./usr/bin/env OLDPWD=/home

3
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Sep 12, 2021 at 9:38
  • 1
    This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review
    – Toto
    Commented Sep 12, 2021 at 9:55
  • But my question is same as this question so I just want to get attention of writer of this post. Thus he/she can response me more quick then asking new question.If I am wrong please say me cause I am new and I dont wanna break any rules of this website. And at the same time I cant comment his/her answer cause of my reputation.
    – Ahmet Adin
    Commented Sep 12, 2021 at 10:09
0

@lorinet3 I ran into the same problem. I checked and the links are relative.

$ echo $LFS
/home/sayan/lfs/lfs_filesystem
$ exa -l $LFS/lib64
lrwxrwxrwx 27 root  6 Jun 11:43 ld-linux-x86-64.so.2 -> ../lib/ld-linux-x86-64.so.2
lrwxrwxrwx 27 root  6 Jun 11:43 ld-lsb-x86-64.so.3 -> ../lib/ld-linux-x86-64.so.2

I am following LFS 11.1 guide in x86_64 machine. I still get the same error. What else can be broken?

1
  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jun 6, 2022 at 6:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .