LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-30-2010, 08:29 PM   #1
grumpy.biatch
Member
 
Registered: Jun 2010
Posts: 48

Rep: Reputation: 0
Exclamation Resuming build with lfs live-cd


Hi,

I am using lfs live cd for building CLFS Version SVN-20100828-x86_64-Multilib. I was able to build till 10.4.1. Installation of Perl and had to quit due to few errors or possible mistakes on my part.

I wish to the chroot and start over. How do I find out what went wrong and rectify it. I am a BSD user and this is bit trivial for me.

Should I just mount the partition, 'export CLFS=/mnt/clfs' and chroot or I need to do something else.

Best,

Dave

Last edited by grumpy.biatch; 12-30-2010 at 08:35 PM.
 
Old 12-31-2010, 05:06 AM   #2
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
Hello,

Just from memory, here is what you need to do (as root):
Code:
mount /dev/sda1 /mnt/clfs
mount -t proc none /mnt/clfs/proc
mount -o bind /dev /mnt/clfs/dev
chroot /mnt/clfs
So I have assumed that you just have one partition... maybe you will also need to mount boot, usr or another partition.
Another point: I am not sure if that step is mandatory, but you may have to do a "mount -o bind /dev/pts /mnt/clfs/dev/pts". But you will quickly know if that step is mandatory as it may complain about a missing pty or something like that during the chroot step if that's really mandatory.

Regards,

Oliv'
 
Old 12-31-2010, 06:21 AM   #3
grumpy.biatch
Member
 
Registered: Jun 2010
Posts: 48

Original Poster
Rep: Reputation: 0
Exclamation

Quote:
Originally Posted by Oliv' View Post
Hello,

Just from memory, here is what you need to do (as root):
Code:
mount /dev/sda1 /mnt/clfs
mount -t proc none /mnt/clfs/proc
mount -o bind /dev /mnt/clfs/dev
chroot /mnt/clfs
So I have assumed that you just have one partition... maybe you will also need to mount boot, usr or another partition.
Another point: I am not sure if that step is mandatory, but you may have to do a "mount -o bind /dev/pts /mnt/clfs/dev/pts". But you will quickly know if that step is mandatory as it may complain about a missing pty or something like that during the chroot step if that's really mandatory.

Regards,

Oliv'
Hi Oliv',

Thanks a bunch. I have '/' and everything is in it.

Let me sum this up -

Code:
mount /dev/sdc2 /mnt/clfs
export CLFS=/mnt/clfs
mkdir -pv ${CLFS}
echo ${CLFS}
mount -v /dev/sdc2 ${CLFS}
mount -t proc none /mnt/clfs/proc
mount -o bind /dev /mnt/clfs/dev
mount -o bind /dev/pts /mnt/clfs/dev/pts (uncertain)
chroot "${CLFS}" /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
Let me know if this is right or I am messing it up.

Best
 
Old 12-31-2010, 06:34 AM   #4
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
Your first mount is useless... and may fail if /mnt/clfs does not exist as you do the mkdir after
And the mount /dev/pts is also probably useless. In fact, after thinking a bit about that, it would be useful only if use something like 'bin/login' instead of '/bin/bash' when running your chroot command.
Else it seems perfect

Best regards,

Oliv'
 
Old 12-31-2010, 08:17 AM   #5
grumpy.biatch
Member
 
Registered: Jun 2010
Posts: 48

Original Poster
Rep: Reputation: 0
Exclamation

Quote:
Originally Posted by Oliv' View Post
Your first mount is useless... and may fail if /mnt/clfs does not exist as you do the mkdir after
And the mount /dev/pts is also probably useless. In fact, after thinking a bit about that, it would be useful only if use something like 'bin/login' instead of '/bin/bash' when running your chroot command.
Else it seems perfect

Best regards,

Oliv'

I will be using live cd so I need to create a directory and a mount point. Please let me know if this is correct-

Code:
mkdir -pv ${CLFS}
mount /dev/sdc2 /mnt/clfs
export CLFS=/mnt/clfs
echo ${CLFS}
mount -t proc none /mnt/clfs/proc
mount -o bind /dev /mnt/clfs/dev
chroot "${CLFS}" /tools/bin/env -i \
    HOME=/root TERM="${TERM}" PS1='\u:\w\$ ' \
    PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
    /tools/bin/login --login +h

Last edited by grumpy.biatch; 12-31-2010 at 08:24 AM.
 
Old 12-31-2010, 09:03 AM   #6
grumpy.biatch
Member
 
Registered: Jun 2010
Posts: 48

Original Poster
Rep: Reputation: 0
I applied mind to this during GCC test suit build and this is according to me should work -

Code:
1. Boot from LiveCD
2. Mount clfs partition
        export CLFS=/mnt/clfs
        mkdir -pv ${CLFS}
        mount /dev/sdc2 ${CLFS}
3.      swapon /dev/sda5
4.      Mount the virtual kernel filesystems
        mount -vt proc proc $CLFS/proc
        mount -vt sysfs sysfs $CLFS/sys
        mount -v -o bind /dev ${CLFS}/dev
        mount -f -vt tmpfs tmpfs ${CLFS}/dev/shm
        mount -f -vt devpts -o gid=4,mode=620 devpts ${CLFS}/dev/pts
5. Entering the chroot environment
        chroot "${CLFS}" /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
6. Mount the rest
        mount -vt devpts -o gid=4,mode=620 none /dev/pts
        mount -vt tmpfs none /dev/shm
        cd /sources

Last edited by grumpy.biatch; 12-31-2010 at 10:19 AM.
 
Old 12-31-2010, 09:34 AM   #7
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
this setup seems perfect... about your "doubtful" line, I also find it quite strange as to my knowledge a typical mount command is: "mount [option] device mount-point". But there might have evolution that I am not aware
Anyway, I think that you will quickly see if that command fails or not.
 
Old 12-31-2010, 10:04 AM   #8
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Quote:
Originally Posted by grumpy.biatch View Post
I applied mind to this during GCC test suit build and this is according to me should work -

Code:
1. Boot from LiveCD
2. Mount clfs partition
        export CLFS=/mnt/clfs
        mkdir -pv $CLFS
        mount /dev/sdc2 $CLFS
3.      swapon /dev/sda5
4. Mount the virtual kernel filesystems
        mount -vt proc proc $CLFS/proc
        mount -vt sysfs sysfs $CLFS/sys
5. Entering the chroot environment
        chroot "$CLFS" /usr/bin/env -i \
        HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
         PATH=/bin:/usr/bin:/sbin:/usr/sbin \
        /bin/bash --login
6. Populating /dev
        mount -nvt tmpfs none /dev/sbin/udevstart (this is doubtful)
        mkdir -v /dev/pts
        mkdir -v /dev/shm
        mount -vt devpts -o gid=4,mode=620 none /dev/pts
        mount -vt tmpfs none /dev/shm
7. Entering working directory
        cd /sources
Hi,

I haven't build CLFS yet, however, I think you should switch order of point 5. and 6., i.e.
do all the mounting before you chroot. There should also be no need to create directories like /dev/pts when you re-chroot. I am also not sure if
Code:
mount -nvt tmpfs none /dev/sbin/udevstart (this is doubtful)
is really necessary.
So here is what I would do:
Code:
1. Boot from LiveCD
2.      swapon /dev/sda5
3. Mount clfs partition
        export CLFS=/mnt/clfs
        mkdir -pv $CLFS
        mount /dev/sdc2 $CLFS

4. Mount the virtual kernel filesystems
        mount -vt proc proc $CLFS/proc
        mount -vt sysfs sysfs $CLFS/sys
5. Populating /dev
        mount -vt devpts -o gid=4,mode=620 none $CLFS/dev/pts
        mount -vt tmpfs none $CLFS/dev/shm
6. Entering the chroot environment
        chroot "$CLFS" /usr/bin/env -i \
        HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
         PATH=/bin:/usr/bin:/sbin:/usr/sbin \
        /bin/bash --login
7. Entering working directory
        cd /sources
It is basically the same procedure as for 'normal' LFS.
 
Old 12-31-2010, 10:34 AM   #9
grumpy.biatch
Member
 
Registered: Jun 2010
Posts: 48

Original Poster
Rep: Reputation: 0
Exclamation

Quote:
Originally Posted by crts View Post
Hi,

I haven't build CLFS yet, however, I think you should switch order of point 5. and 6., i.e.
do all the mounting before you chroot. There should also be no need to create directories like /dev/pts when you re-chroot. I am also not sure if
Code:
mount -nvt tmpfs none /dev/sbin/udevstart (this is doubtful)
is really necessary.
I've not yet installed udev and in my opinion
Quote:
mount -nvt tmpfs none /dev/sbin/udevstart
is not necessary, trying wont hurt; it may return an error at most.

Thanks,

Dave
 
Old 01-01-2011, 12:58 AM   #10
grumpy.biatch
Member
 
Registered: Jun 2010
Posts: 48

Original Poster
Rep: Reputation: 0
Been there done that, it worked.

Thanks guys.
 
  


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
Resuming lfs build grumpy.biatch Linux From Scratch 0 12-26-2010 06:44 AM
[SOLVED] Resuming the LFS build environment after rebooting the system prakashsince92 Linux From Scratch 3 12-19-2010 12:51 PM
LFS live-cd: /dev/mapper/lfs-cd ran out of space bucovaina78 Linux From Scratch 0 10-12-2009 11:00 AM
Will compiling LFS on an 64 bit distro build an 64 bit LFS? Vampirite Linux From Scratch 4 08-31-2007 02:48 PM
How to build LiveCD from LFS isilinux Linux From Scratch 1 08-24-2005 03:45 AM

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

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