LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-09-2017, 02:04 AM   #1
sks150693
LQ Newbie
 
Registered: Jun 2017
Posts: 2

Rep: Reputation: Disabled
chroot: failed to run command '/tools/bin/env': Too many levels of symbolic links


I am trying to build OS with the help of LFS-8.0,i Have completed till chapter-5 but in 6 i am getting error from 48hr. i tried my best solve it.even still i doing to fix it.But i want to take your experience and guidance.

Error:
root@administrator-Lenovo-U410:/mnt/lfs# 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
chroot: failed to run command '/tools/bin/env': Too many levels of symbolic links




while my configuration is :
root@administrator-Lenovo-U410:/mnt/lfs# /tools/bin/env
XDG_VTNR=7
XDG_SESSION_ID=c2
SHELL=/bin/bash
TERM=xterm
LC_ALL=POSIX
USER=root
SUDO_USER=sumitkumars
SUDO_UID=1001
LFS=/mnt/lfs
USERNAME=root
PATH=/tools/bin:/bin:/usr/bin
MAIL=/var/mail/root
PWD=/mnt/lfs
LANG=en_IN
LFS_TGT=x86_64-root-linux-gnu
SHLVL=1
XDG_SEAT=seat0
SUDO_COMMAND=/bin/su
HOME=/root
LANGUAGE=en_IN:en
LOGNAME=root
SUDO_GID=1001
COLORTERM=gnome-terminal
_=/tools/bin/env
OLDPWD=/mnt/lfs/tools


i have check with different test answer which is present in forum.:
root@administrator-Lenovo-U410:/mnt/lfs# ldd /tools/bin/env
linux-vdso.so.1 (0x00007fffb7142000)
libc.so.6 => /tools/lib/libc.so.6 (0x00007faf4ec0c000)
/tools/lib64/ld-linux-x86-64.so.2 (0x00007faf4efaa000)
root@administrator-Lenovo-U410:/mnt/lfs# ldd /tools/bin/bash
linux-vdso.so.1 (0x00007ffd18cc9000)
libdl.so.2 => /tools/lib/libdl.so.2 (0x00007f498046a000)
libc.so.6 => /tools/lib/libc.so.6 (0x00007f49800cc000)
/tools/lib64/ld-linux-x86-64.so.2 (0x00007f498066e000)
root@administrator-Lenovo-U410:/mnt/lfs# readelf -l /tools/bin/bash | grep interpreter
[Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2]
root@administrator-Lenovo-U410:/mnt/lfs# readelf -l /tools/bin/env | grep interpreter
[Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2]
root@administrator-Lenovo-U410:/mnt/lfs# find -L /tools -name bash 2>/dev/null
/tools/bin/bash
/tools/include/bash
/tools/lib64/bash
/tools/lib/bash
/tools/share/doc/bash
root@administrator-Lenovo-U410:/mnt/lfs# find -L /tools -name env 2>/dev/null
/tools/bin/env
root@administrator-Lenovo-U410:/mnt/lfs# ls -l /tools
total 60
drwxr-xr-x 2 root root 12288 Jun 8 10:41 bin
drwxr-xr-x 2 root root 4096 Jun 7 13:26 etc
drwxr-xr-x 41 root root 4096 Jun 8 09:33 include
drwxr-xr-x 12 root root 12288 Jun 8 09:33 lib
lrwxrwxrwx 1 root root 3 Jun 6 04:08 lib64 -> lib
drwxr-xr-x 6 1002 1002 4096 Jun 8 09:25 libexec
drwxr-xr-x 5 root root 4096 Jun 8 06:08 man
drwxr-xr-x 2 root root 4096 Jun 8 09:31 sbin
drwxr-xr-x 17 root root 4096 Jun 8 09:31 share
drwxr-xr-x 3 root root 4096 Jun 7 13:26 var
drwxr-xr-x 4 root root 4096 Jun 6 04:08 x86_64-pc-linux-gnu
drwxr-xr-x 4 root root 4096 Jun 7 12:27 x86_64-root-linux-gnu
root@administrator-Lenovo-U410:/mnt/lfs# ls -l /tools/bin/bash
-rwxr-xr-x 1 root root 4331888 Jun 8 06:41 /tools/bin/bash
root@administrator-Lenovo-U410:/mnt/lfs# ls -l /tools/bin/env
-rwxr-xr-x 1 root root 148448 Jun 8 07:32 /tools/bin/env
root@administrator-Lenovo-U410:/mnt/lfs#
 
Old 06-09-2017, 07:59 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
The message seems fairly straight forward about the env command itself.

What do you see if you run "ls -l /tools/bin/env"? "ls -ld /tools/bin"? "ls -ld /tools".

If /tools/bin is a link to /usr/local/tools/bin which and /usr/local is a link to /usr/share and /usr/share is a link to /share etc... it might explain this error. (Of course the links might be anywhere - I'm just illustrating possibilities.) If "env" exists in /bin (as it does on RHEL) and is not a link there then adding /bin to the front of your PATH (before calling env command itself) would likely solve the issue.
 
1 members found this post helpful.
Old 06-09-2017, 12:01 PM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 5,570
Blog Entries: 16

Rep: Reputation: 3305Reputation: 3305Reputation: 3305Reputation: 3305Reputation: 3305Reputation: 3305Reputation: 3305Reputation: 3305Reputation: 3305Reputation: 3305Reputation: 3305
Quote:
Originally Posted by MensaWater View Post
The message seems fairly straight forward about the env command itself.

What do you see if you run "ls -l /tools/bin/env"? "ls -ld /tools/bin"? "ls -ld /tools".

If /tools/bin is a link to /usr/local/tools/bin which and /usr/local is a link to /usr/share and /usr/share is a link to /share etc... it might explain this error. (Of course the links might be anywhere - I'm just illustrating possibilities.) If "env" exists in /bin (as it does on RHEL) and is not a link there then adding /bin to the front of your PATH (before calling env command itself) would likely solve the issue.
When you are building LFS, /tools on the host system is a link to $LFS/tools. $LFS/tools is not a link to anything and nor is $LFS/tools/bin; they are simple directories. At this stage in an LFS build, programs on the host are no longer used; everything is done with the new LFS tools in /tools/bin.

As far as I can see, the chroot instruction given by the OP is correct, so I'm not sure what is going wrong here. In addition to your suggestions, it would be worth doing "readlink /tools" in the host system.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
chroot: cannot run command `/tools/bin/env': No such file or directory Basel Linux From Scratch 10 06-09-2018 02:15 PM
[SOLVED] chroot: failed to run command ‘/tools/bin/env’: No such file or directory: chapter 6.4 zoelee4 Linux From Scratch 28 09-10-2016 06:38 PM
[SOLVED] chroot: failed to run command '/bin/bash': Permission denied AlleyTrotter Slackware 5 10-18-2012 04:09 PM
slackware 14.0, chroot: failed to run command ‘/bin/bash’: No such file or directory rameshoty Slackware 6 10-18-2012 06:26 AM
6.4. Entering the Chroot Environment: /tools/bin/env: no such file jpeters Linux From Scratch 1 03-29-2009 09:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:28 PM.

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