LinuxQuestions.org
Help answer threads with 0 replies.
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 09-06-2016, 03:39 PM   #16
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Debian
Posts: 2,511
Blog Entries: 1

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412

As quoted from version check lfs-7.8
Quote:
GCC-4.1.2 including the C++ compiler, g++ (Versions greater than 5.2.0 are not recommended as they have not been tested)
Not sure if this is causing problems but it could be an issue. "maybe"

and what do you mean
Quote:
...mostly
 
Old 09-06-2016, 05:36 PM   #17
zoelee4
Member
 
Registered: Aug 2016
Distribution: Debian, Ubuntu, BLFS
Posts: 116

Original Poster
Rep: Reputation: Disabled
is there anywhere that I could search to find the answer to this? I have been looking around and cannot find anything useful :|. thanks again for all your help!
 
Old 09-06-2016, 05:38 PM   #18
zoelee4
Member
 
Registered: Aug 2016
Distribution: Debian, Ubuntu, BLFS
Posts: 116

Original Poster
Rep: Reputation: Disabled
I have been using 7.8. sorry for the confusion.
 
Old 09-06-2016, 08:32 PM   #19
anak_bawang
Member
 
Registered: Jun 2015
Location: Bandung Indonesia
Distribution: Debian, LFS/BLFS
Posts: 138

Rep: Reputation: 23
Probably caused of broken symbolic link.
/tools should point to /mnt/lfs/tools
From host, try to check symbolic link
Code:
# ls -lah /
lrwxrwxrwx   1 root   root     14 Aug 30 14:48 tools -> /mnt/lfs/tools
 
Old 09-06-2016, 09:04 PM   #20
zoelee4
Member
 
Registered: Aug 2016
Distribution: Debian, Ubuntu, BLFS
Posts: 116

Original Poster
Rep: Reputation: Disabled
still no luck this is the output of the hard link command you sent:

Code:
sudo ls -lah /                                     
lrwxrwxrwx   1 root   root     14 Aug 30 14:48 tools -> /mnt/lfs/tools
total 116K
drwxr-xr-x  24 root root 4.0K Sep  6 16:17 .
drwxr-xr-x  24 root root 4.0K Sep  6 16:17 ..
drwxr-xr-x   2 root root 4.0K Sep  6 01:07 bin
drwxr-xr-x   4 root root 4.0K Sep  6 00:48 boot
drwxrwxr-x   2 root root 4.0K Sep  6 00:47 cdrom
drwxr-xr-x  20 root root 4.5K Sep  6 21:59 dev
drwxr-xr-x 129 root root  12K Sep  6 18:09 etc
drwxr-xr-x   4 root root 4.0K Sep  6 18:09 home
lrwxrwxrwx   1 root root   32 Sep  6 00:47 initrd.img -> boot/initrd.img-4.4.0-31-generic
drwxr-xr-x  21 root root 4.0K Sep  6 00:48 lib
drwxr-xr-x   2 root root 4.0K Jul 20 14:40 lib64
drwx------   2 root root  16K Sep  6 00:45 lost+found
drwxr-xr-x   4 root root 4.0K Sep  6 15:48 media
drwxr-xr-x   3 root root 4.0K Sep  6 01:02 mnt
drwxr-xr-x   3 root root 4.0K Sep  6 13:58 opt
dr-xr-xr-x 311 root root    0 Sep  6 18:15 proc
drwx------   5 root root 4.0K Sep  6 15:46 root
drwxr-xr-x  25 root root  760 Sep  6 22:00 run
drwxr-xr-x   2 root root  12K Sep  6 00:48 sbin
drwxr-xr-x   2 root root 4.0K Jun 29 16:13 snap
drwxr-xr-x   2 root root 4.0K Jul 20 14:39 srv
dr-xr-xr-x  13 root root    0 Sep  6 22:00 sys
drwxrwxrwt  12 root root  12K Sep  6 22:00 tmp
lrwxrwxrwx   1 root root   14 Sep  6 01:24 tools -> /mnt/lfs/tools
drwxr-xr-x  10 root root 4.0K Jul 20 14:39 usr
drwxr-xr-x  14 root root 4.0K Jul 20 15:08 var
lrwxrwxrwx   1 root root   29 Sep  6 00:47 vmlinuz -> boot/vmlinuz-4.4.0-31-generic
zsh: is a directory: /mnt/lfs/tools
when I try to enter the chroot enorment I still get the error:

Code:
chroot: failed to run command ‘/tools/bin/env’: No such file or directory
thanks again!
 
Old 09-06-2016, 09:16 PM   #21
zoelee4
Member
 
Registered: Aug 2016
Distribution: Debian, Ubuntu, BLFS
Posts: 116

Original Poster
Rep: Reputation: Disabled
ok, so I found this http://archive.linuxfromscratch.org/...ry/003105.html I did what it said and this is the output:

Code:
readelf -l a.out | grep ': /tools'
readelf: Error: 'a.out': No such file
obviously there is something wrong. however I do not know how to fix it... should I recompile gcc? thanks!
 
Old 09-07-2016, 01:48 PM   #22
zoelee4
Member
 
Registered: Aug 2016
Distribution: Debian, Ubuntu, BLFS
Posts: 116

Original Poster
Rep: Reputation: Disabled
I'm starting to think that this is not the problem, does anybody else know what the problem could be? Thanks again!
 
Old 09-07-2016, 03:58 PM   #23
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
Quote:
Originally Posted by zoelee4

ok, so I found this http://archive.linuxfromscratch.org/...ry/003105.html I did what it said and this is the output:
Code:
readelf -l a.out | grep ': /tools'
readelf: Error: 'a.out': No such file
That is out of context. Something always precedes that to create the dummy output file. Like this in chapter 5 while building Glibc and Gcc pass 2...
Code:
echo 'int main(){}' > dummy.c
$LFS_TGT-gcc dummy.c
readelf -l a.out | grep ': /tools'
So forget that.

Okay. I believe this is going to turn out to be something simple. And even though you have started over "many times", you could be doing the same wrong thing "many times". For example, you've rebooted. And you repeated the steps in 6.2 concerning the virtual kernel filesystems. But did you remember to remount the partition at /mnt/lfs before doing all that? Since your post didn't mention that, it's at least possible to have done those repeated steps in the mount point in the host system instead in the LFS partition. Some harmless things to try...

1. Change to root like the book says (you don't need to use sudo with the lfs user for entering chroot).

2. Unmount /mnt/lfs.
Code:
umount -v /mnt/lfs
3. Look at /mnt/lfs (it should be empty while umounted)
Code:
ls /mnt/lfs
4. Check that the LFS variable is "/mnt/lfs". Export it again if it is null or not right.
Code:
echo $LFS
5. Remount the LFS partition.
Code:
mount -v /dev/<xxx> $LFS
6. Just for fun, try just running the env executable in /tools. It should list some variables.
Code:
$LFS/tools/bin/env
7. If you make it this far, now redo the virtual filesystem stuff.
Code:
mkdir -pv $LFS/{dev,proc,sys,run}

mknod -m 600 $LFS/dev/console c 5 1
mknod -m 666 $LFS/dev/null c 1 3

mount -v --bind /dev $LFS/dev

mount -vt devpts devpts $LFS/dev/pts -o gid=5,mode=620
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run

if [ -h $LFS/dev/shm ]; then
  mkdir -pv $LFS/$(readlink $LFS/dev/shm)
fi
8. Now try entering chroot again.
Code:
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
If this didn't go anywhere, then no harm done. And maybe it's not such a simple thing after all. But in closing I'll say this: the LFS book is right about things like this. Follow the book (and nothing else). I don't remember about 7.8, but there are no published errata for the current stable version. Copy and paste instead of hand typing.
 
Old 09-07-2016, 04:09 PM   #24
zoelee4
Member
 
Registered: Aug 2016
Distribution: Debian, Ubuntu, BLFS
Posts: 116

Original Poster
Rep: Reputation: Disabled
thank you, however this did not work either I am not sure if this is necessary, but here is the output:

Code:
root@zoe:~# export LFS=/mnt/lfs
root@zoe:~# mount -v /dev/sda4 $LFS
mount: /dev/sda4 mounted on /mnt/lfs.
root@zoe:~# $LFS/tools/bin/env
SHELL=/bin/bash
TERM=xterm-256color
USER=root
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:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=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:*.jpg=01;35:*.jpeg=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:*.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:
SUDO_USER=zoe
SUDO_UID=1000
LFS=/mnt/lfs
USERNAME=root
MAIL=/var/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
PWD=/root
LANG=en_US.UTF-8
SHLVL=1
SUDO_COMMAND=/bin/bash
HOME=/root
LOGNAME=root
LC_CTYPE=en_US.UTF-8
LESSOPEN=| /usr/bin/lesspipe %s
SUDO_GID=1000
DISPLAY=:1
LESSCLOSE=/usr/bin/lesspipe %s %s
XAUTHORITY=/run/user/1000/gdm/Xauthority
_=/mnt/lfs/tools/bin/env
root@zoe:~# mkdir -pv $LFS/{dev,proc,sys,run}
root@zoe:~# 
root@zoe:~# mknod -m 600 $LFS/dev/console c 5 1
mknod: /mnt/lfs/dev/console: File exists
root@zoe:~# mknod -m 666 $LFS/dev/null c 1 3
mknod: /mnt/lfs/dev/null: File exists
root@zoe:~# 
root@zoe:~# mount -v --bind /dev $LFS/dev
mount: /dev bound on /mnt/lfs/dev.
root@zoe:~# 
root@zoe:~# mount -vt devpts devpts $LFS/dev/pts -o gid=5,mode=620
mount: devpts mounted on /mnt/lfs/dev/pts.
root@zoe:~# mount -vt proc proc $LFS/proc
mount: proc mounted on /mnt/lfs/proc.
root@zoe:~# mount -vt sysfs sysfs $LFS/sys
mount: sysfs mounted on /mnt/lfs/sys.
root@zoe:~# mount -vt tmpfs tmpfs $LFS/run
mount: tmpfs mounted on /mnt/lfs/run.
root@zoe:~# 
root@zoe:~# if [ -h $LFS/dev/shm ]; then
>   mkdir -pv $LFS/$(readlink $LFS/dev/shm)
> fi
root@zoe:~# 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’: No such file or directory
root@zoe:~#
thanks again for all your help!
 
Old 09-07-2016, 08:24 PM   #25
anak_bawang
Member
 
Registered: Jun 2015
Location: Bandung Indonesia
Distribution: Debian, LFS/BLFS
Posts: 138

Rep: Reputation: 23
As stoat suggested :
Quote:
Originally Posted by stoat View Post
6. Just for fun, try just running the env executable in /tools. It should list some variables.
Code:
$LFS/tools/bin/env
looks like, it work for you :
Quote:
Originally Posted by zoelee4 View Post
root@zoe:~# $LFS/tools/bin/env
SHELL=/bin/bash
TERM=xterm-256color
Let's try with shorter path
Code:
# /tools/bin/env
Is it still work or not.
 
Old 09-07-2016, 10:34 PM   #26
zoelee4
Member
 
Registered: Aug 2016
Distribution: Debian, Ubuntu, BLFS
Posts: 116

Original Poster
Rep: Reputation: Disabled
im a little confused

the output of
Code:
/tools/bin/env
is :

Code:
root@zoe:~# /tools/bin/env
SHELL=/bin/bash
TERM=xterm-256color
USER=root
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:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=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:*.jpg=01;35:*.jpeg=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:*.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:
SUDO_USER=zoe
SUDO_UID=1000
LFS=/mnt/lfs
USERNAME=root
MAIL=/var/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
PWD=/root
LANG=en_US.UTF-8
SHLVL=1
SUDO_COMMAND=/bin/bash
HOME=/root
LOGNAME=root
LC_CTYPE=en_US.UTF-8
LESSOPEN=| /usr/bin/lesspipe %s
SUDO_GID=1000
DISPLAY=:1
LESSCLOSE=/usr/bin/lesspipe %s %s
XAUTHORITY=/run/user/1000/gdm/Xauthority
_=/tools/bin/env
root@zoe:~#
and what do you mean by
Quote:
Is it still work or not.
?

thanks!
 
Old 09-07-2016, 10:38 PM   #27
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
So I guess you established that /mnt/lfs/tools/bin/env runs in the host system but not in the chroot environment. Something it (and maybe a bunch of others) needs is not there.

You used that old tutorial at least some. Just for fun, run the library-check.sh script found in the book (Host System Requirements).

P.S.: I would ditch that old tutorial. The book is all you need.
 
Old 09-07-2016, 10:56 PM   #28
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
One more thing just for fun...
Code:
ls -l /mnt/lfs/tools
 
Old 09-10-2016, 06:38 PM   #29
zoelee4
Member
 
Registered: Aug 2016
Distribution: Debian, Ubuntu, BLFS
Posts: 116

Original Poster
Rep: Reputation: Disabled
Found the problem

thanks for your help. I just reinstalled ubuntu, This time I installed ubuntu 14. I think that is the problem (earlier I was running ubuntu 16). I do not know why this is but that seemed to work for me.
 
  


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
chroot: cannot run command `/tools/bin/env': No such file or directory Basel Linux From Scratch 10 06-09-2018 02:15 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
chroot: cannot run command `/bin/bash': No such file or directory hubabuba Slackware 5 03-23-2008 05:37 PM
/tools/bin/env: /tools/bin/bash: No such file or directory DaZjorz Linux From Scratch 21 07-27-2005 07:11 AM

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

All times are GMT -5. The time now is 03:09 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