LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-10-2015, 06:51 PM   #1
thinkrorbot
Member
 
Registered: Feb 2015
Location: Sydney, Australia
Distribution: Linux mint 17.1
Posts: 39

Rep: Reputation: Disabled
BLFS 7.7, Segmentation fault (core dumped) when trying to compile a package


Hello all,

How do I compile a package using make in a chroot environment without the segmentation fault error popping up?

For example, in the BLFS botscripts package, I can't install random using make. It comes up with the error message "Segmentation fault(core dumped)". Instead, I have to reboot into LFS to install it. The same thing happens in the other packages I tried such as emacs and openssl.

I mounted /dev/sda11 to /mnt/lfs and /dev/sda12 to /mnt/lfs/boot and when into the chroot environment using the following commands:
Code:
chroot "$LFS" /usr/bin/env -i              \
    HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
    PATH=/bin:/usr/bin:/sbin:/usr/sbin     \
    /bin/bash --login
How do I compile packages in a chroot environment?

Thanks
 
Old 04-10-2015, 08:08 PM   #2
moonfrog
Member
 
Registered: Oct 2008
Location: San Diego County, CA
Distribution: LFS, Gentoo
Posts: 64

Rep: Reputation: 23
I always run through "Ch 6.2. Preparing Virtual Kernel File Systems" before chrooting.

my chroot looks like:

Code:
 Hopeless formatting...see post 7

Last edited by moonfrog; 04-11-2015 at 05:26 PM. Reason: wtf
 
Old 04-11-2015, 02:18 AM   #3
thinkrorbot
Member
 
Registered: Feb 2015
Location: Sydney, Australia
Distribution: Linux mint 17.1
Posts: 39

Original Poster
Rep: Reputation: Disabled
Thanks for the reply,

Your instructions simply opened up xterm for me logged in as root. I tried to mount those directories and use the chroot instructions in lfs 6.73 but it ended up with the same result.
 
Old 04-11-2015, 02:27 AM   #4
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Segmentation fault may be arising because of kernel/glibc/software incompatibilities. Which kernel version support you used during glibc build. Is the version used newer than host kernel?
 
Old 04-11-2015, 04:39 PM   #5
thinkrorbot
Member
 
Registered: Feb 2015
Location: Sydney, Australia
Distribution: Linux mint 17.1
Posts: 39

Original Poster
Rep: Reputation: Disabled
I have Kernel version 3.19 and used --enable-kernel=2.6.32 to configure Glibc as the instructions state.
 
Old 04-11-2015, 05:00 PM   #6
thinkrorbot
Member
 
Registered: Feb 2015
Location: Sydney, Australia
Distribution: Linux mint 17.1
Posts: 39

Original Poster
Rep: Reputation: Disabled
I got it working using moonfrog's commands but instead of mount -v --bind /dev dev, use mount -v --bind /dev $LFS/dev
 
Old 04-11-2015, 05:15 PM   #7
moonfrog
Member
 
Registered: Oct 2008
Location: San Diego County, CA
Distribution: LFS, Gentoo
Posts: 64

Rep: Reputation: 23
The formatting in my commands up there are F'ed...can't be run as is
I've tried 4 times to edit them but it only tries to make it worse

I'll try again here, this would be for chrooting w/o being on the build host:


mount /mnt/lfs
cd /mnt/lfs

mkdir -pv {dev,proc,sys,run}
mount -v --bind /dev dev
mount -vt devpts devpts dev/pts -o gid=5,mode=620
mount -vt proc proc proc
mount -vt sysfs sysfs sys
mount -vt tmpfs tmpfs run

if [ -h dev/shm ]; then
mkdir -pv $(readlink dev/shm)
fi

chroot . /usr/bin/env -i \
HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/bin/bash --login
source /etc/profile
export PS1="(lfs-chroot) $PS1"
 
1 members found this post helpful.
Old 04-12-2015, 07:17 AM   #8
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,147

Rep: Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855
Quote:
Originally Posted by moonfrog View Post
...
export PS1="(lfs-chroot) $PS1"
I never think to set PS1 when I chroot just as a check that I know where I am, added to my chroot script.
 
  


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
Segmentation fault (core dumped) mohammad taqy bayat Linux - Newbie 3 08-25-2014 02:10 AM
Segmentation fault (core dumped) sirjase Programming 8 12-18-2013 03:40 AM
Segmentation fault (core dumped) nasim751 Programming 2 01-28-2008 02:56 PM
Segmentation fault (core dumped) nasim751 Programming 1 01-27-2008 09:18 PM
segmentation fault (core dumped) - what??? Micro420 Programming 6 12-07-2006 01:03 AM

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

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