LinuxQuestions.org
Review your favorite Linux distribution.
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 04-09-2016, 01:04 PM   #1
skorm513
LQ Newbie
 
Registered: Nov 2015
Posts: 9

Rep: Reputation: Disabled
LFS 7.9 - Environment not working properly after chroot


I am using the LFS 7.9-systemd book, attempting to create LFS using a Centos 7 host under an x86_64 architecture.

I believe that I have followed the instructions to a T.

I have the same user environment as specified in the book.

I've copied and pasted everything, and haven't omitted anything, yet I still cannot get the temporary environment in chapter 6 to work properly.

I keep on running into the following error when I attempt to execute the first command in section 6.7. "Linux-4.4.2 API Headers".

Attempting to execute
Code:
make mrproper
gives me the following error:

Code:
make: gcc: Command not found
./scripts/gcc-version.sh: line 25: /tools/bin/gcc: No such file or directory
I do not understand why this error occurs. /tools/bin/gcc -does- exist. Outside of the chroot environment, I -can- use the command. But inside of it, when I try to execute gcc, it insists that it does not exist even when ls reports that it does. In both environments of the lfs user and the root (when using chroot), I have /tools/bin as part of my PATH.

I am assuming that I have done everything right. I have, as the lfs user, run the code used to check the second pass:
Code:
echo 'int main(){}' > dummy.c
cc dummy.c
readelf -l a.out | grep ': /tools'
and it returns the proper output:
Code:
[Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2]
From reading this forum and other places like Stack Overflow, I understand the standard advice here is to burn it with fire and do the entire thing over again. Except that I have done so.. 4 times already. I'm not sure how to remedy the situation.

Will someone please help me or at least point me in the right direction?
 
Old 04-09-2016, 01:10 PM   #2
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
Hi

when chrooting in did you make sure lfs was in roots path?
did you mount everything properly

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

ch 6.2.3
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
 
Old 04-09-2016, 01:25 PM   #3
skorm513
LQ Newbie
 
Registered: Nov 2015
Posts: 9

Original Poster
Rep: Reputation: Disabled
Yes, $LFS was set in root's path. Otherwise the command to chroot
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
would have never worked.

I also have mounted all of the specified filesystems successfully:

Code:
mount | grep /lfs | column -t                                                                                                                      
/dev/sda9  on  /lfs          type  ext4      (rw,relatime,seclabel,data=ordered)
devtmpfs   on  /lfs/dev      type  devtmpfs  (rw,nosuid,seclabel,size=1979380k,nr_inodes=494845,mode=755)
devpts     on  /lfs/dev/pts  type  devpts    (rw,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
proc       on  /lfs/proc     type  proc      (rw,relatime)
sysfs      on  /lfs/sys      type  sysfs     (rw,relatime,seclabel)
tmpfs      on  /lfs/run      type  tmpfs     (rw,relatime,seclabel)
I used a partition mounted directly on /lfs instead of the book's example of /mnt/lfs. afaik it shouldn't make a difference, as $LFS is consistent between both the lfs user and the root user.

Last edited by skorm513; 04-09-2016 at 01:31 PM.
 
Old 04-09-2016, 09:40 PM   #4
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

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

...the standard advice here is to burn it with fire and do the entire thing over again. Except that I have done so.. 4 times already.
Four times? Then did you run the version-check.sh script on your host system? Various bizarre things can happen if that flunks.
 
Old 04-10-2016, 01:06 AM   #5
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
What happens if you run

Code:
/tools/bin/make mrproper
or

Code:
/usr/bin/make mrproper
just to try

You also say
Quote:
I have the same user environment as specified in the book
but here
Quote:
I used a partition mounted directly on /lfs instead of the book's example of /mnt/lfs
Hopefully thats not where the problem lies, just an observation.

whats the output of ls /lfs

Last edited by spiky0011; 04-10-2016 at 01:20 AM.
 
Old 04-10-2016, 07:31 AM   #6
skorm513
LQ Newbie
 
Registered: Nov 2015
Posts: 9

Original Poster
Rep: Reputation: Disabled
Ok.. so I fixed it. I'm not exactly sure -how-, but for the benefit of everyone else trying LFS who has had the same problem (I know there are quite a few of you, as I've read all your posts on various places like SO and mailing lists), I'll go through the process that somehow solved it.


I did another clean run, but before that, I did a couple of things:

I ran the version-check.sh (found in the preface), and found that /usr/bin/yacc -wasn't- a symlink to /usr/bin/bison, even after bison was already installed. I proceeded made sure that that symlink existed. This might have been what I had missed.

I ran the library-check.sh (also found in the preface). I had already installed the respective gmp, mpfrc, and mpc packages corresponding to my distribution.. but they -still- didn't show up when the script ran. I installed the respective devel packages, but the script -still- didn't find anything. Since it said that either none or all files indicated should be present, I assumed that I was good to go.

And after that, I just followed every single command and I was able to get past section 6.7.

Stoat - you're right - it seems truly bizarre what happened. I would have expected something to have give off an error somewhere long before entering the temporary chroot in Chapter 6.. but doing the above solved it.
 
  


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
[SOLVED] LFS 7.2 Chapter 6.4 Chroot Environment Error raza.ajmi Linux From Scratch 11 12-14-2012 01:34 AM
[SOLVED] using a chroot environment to install software in LFS jmc1987 Linux From Scratch 4 09-23-2010 12:31 PM
mount command not working in chroot. and now chroot not working mohit.jain Linux From Scratch 5 07-14-2006 03:57 AM
LFS Book Chapter 6 - 1st step (chroot to /mnt/lfs) doens't work bauld Linux From Scratch 11 03-15-2006 12:31 AM
chroot in lfs shahzadiub Linux - Newbie 5 06-23-2004 12:08 PM

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

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