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 02-01-2015, 05:57 PM   #1
caveman86
Member
 
Registered: Nov 2014
Location: Adelaide, South Australia
Distribution: Slackware 14.1 x64, LFS 7.6 x64
Posts: 83

Rep: Reputation: 8
Finished the LFS book


Hi guys I have a quick question I have finished the LFS book now I am wondering is it possible to chroot into my LFS build so i can do the tasks which are in the BLFS book as it will make it easier for me to compile programs as I am still learning the various commands to compile etc it is easier to copy and past to make the process a lot easier so far my LFS system boots and I am rapt I am just wanting to make the next stage a little easier the only other option was I was thinking of preparing shell scripts for each program I need to compile but that is going to take a hell of a lot longer I am happy to accept it if i have to do it the long way by booting into my LFS system cheers in advance...

PS I have learnt so much so far and really enjoyed the challenges I was presented in the first book as things weren't as simple as the book at times but none the less it has been a great learning experience.
 
Old 02-01-2015, 06:52 PM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
I personally build a complete desktop in the chroot, but I boot into the new lfs at certain stages just to check that all is well, first as soon a bootable system is available, second after building xorg, then after install a basic desktop ( xfce is my preference ) and finally after all the extras that make a desktop usable, browser, gimp, mail, development files etc.

At which point I start using it full time but keep the old system around in case it all goes pete tong, I also take backups at the above points just in case.

Other people will do different things thats just how I do it.
 
1 members found this post helpful.
Old 02-01-2015, 06:56 PM   #3
caveman86
Member
 
Registered: Nov 2014
Location: Adelaide, South Australia
Distribution: Slackware 14.1 x64, LFS 7.6 x64
Posts: 83

Original Poster
Rep: Reputation: 8
That is exactly what I am wanting to do to be honest once I have a desktop environment setup I am good to boot in and do the rest from there just quickly how do I chroot is there any special way of doing it after I finished the LFS book I am still new to this and don't want to screw this up but I gather it will be much easier for me to do this especially while I am still learning to compile libraries and programs properly. Thank you for your help so far
 
Old 02-01-2015, 07:03 PM   #4
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
I always use a small script to chroot so I don't have to type too much and also so that the chrooot environment is set/restored the same every time have a look here

http://lfspkg.darktech.org/helperscripts.html

For a basic chroot script, change it as needed but you will almost certainly need /dev, /proc and /sys mounted in the chroot to do anything meaninful, don't forget yto unmount them after leaving the chroot.
 
Old 02-01-2015, 07:19 PM   #5
caveman86
Member
 
Registered: Nov 2014
Location: Adelaide, South Australia
Distribution: Slackware 14.1 x64, LFS 7.6 x64
Posts: 83

Original Poster
Rep: Reputation: 8
Thanks heaps mate I only have one partition sorry for stupid sounding qustions so do I only need to mount/dev/sda1 with the mount -v and mount vt commands for my setup or do you need to follow the script

Last edited by caveman86; 02-01-2015 at 07:20 PM.
 
Old 02-01-2015, 07:30 PM   #6
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
No change the script as needed, if you only have your lfs partition mounted then dont mount the /media stuff, you wont have them any way, but the first bit you should use ie
Code:
 LFS=$(pwd)
mount -v --bind /dev $LFS/dev
mount -vt devpts devpts $LFS/dev/pts
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
presuming the script is in the root of the mounted lfs partition, hence the first line above, this scrip was actuall designed to be run from a folder within tthe root of the mounted lfs hence the pushd .. command at the front of the script so that should be commented out, mthe script needs updating and is on my 'todo' list just use it as a guide for what you need to do.
 
Old 02-01-2015, 07:36 PM   #7
caveman86
Member
 
Registered: Nov 2014
Location: Adelaide, South Australia
Distribution: Slackware 14.1 x64, LFS 7.6 x64
Posts: 83

Original Poster
Rep: Reputation: 8
Ok I haven't mounted it yet I am just getting my head around how to go about doing this before I do chroot into this as I am new to the whole chrooting thing I only done it for the first time in the LFS book and I also did it a couple of days ago to restore my grub bootloader as I just installed a new hard drive and had to put my LFS setup and my slackware setup back on the new hard drive from disk images...... Ok I am just a little confused I am most likely confusing myself so ust to clarify I only have one partition for my LFS setup and the script is designed for that am i right? sorry for the silly questions I want to do this right without screwing it up
 
Old 02-01-2015, 07:52 PM   #8
caveman86
Member
 
Registered: Nov 2014
Location: Adelaide, South Australia
Distribution: Slackware 14.1 x64, LFS 7.6 x64
Posts: 83

Original Poster
Rep: Reputation: 8
I think I screwed up somewhere by deleting the /tools directory
 
Old 02-01-2015, 08:12 PM   #9
caveman86
Member
 
Registered: Nov 2014
Location: Adelaide, South Australia
Distribution: Slackware 14.1 x64, LFS 7.6 x64
Posts: 83

Original Poster
Rep: Reputation: 8
Is there any way around this or do I have to start from the beginning again
Quote:
chroot: failed to run command '/tools/bin/env': No such file or directory
 
Old 02-01-2015, 10:07 PM   #10
caveman86
Member
 
Registered: Nov 2014
Location: Adelaide, South Australia
Distribution: Slackware 14.1 x64, LFS 7.6 x64
Posts: 83

Original Poster
Rep: Reputation: 8
Ok I don't know why but the script didn't work for me I presume it is because I deleted the /tools directory like I was instructed to in the book anyhow I found this on the net and I was able to chroot into the lfs partition and work away as needed http://www.linuxfromscratch.org/hint...and-resume.txt
Quote:
From section 6.62. Cleaning Up to The End
=========================================
From this point till the end of the whole LFS build. Steps to resume
the building
environment are:
1. Restart computer and boot from LiveCD
2. Mount your lfs partition
export LFS=/mnt/lfs
mkdir -pv $LFS
mount /dev/sda2 $LFS
3. Mount your swap partition (skip this step if you do not use any swap
partitions)
swapon /dev/sda1
4. Mount the virtual kernel filesystems
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
5. Entering the chroot environment
chroot "$LFS" /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
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 your working directory
cd /sources
That seemed to do the trick
 
Old 02-02-2015, 05:35 AM   #11
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
If this works for you do it this way, but I would suggest sticking it in a script as you are less likely to make a typo that way.

You can and probably should remove the tools folder AFTER you have built the basic system, but before you adjust the tool chain it's a good idea to save the the tools folder, as the lfs book suggests here:
http://www.linuxfromscratch.org/lfs/...gingowner.html

I just cd into the tools folder and do:
Code:
tar -zpcvf ../tools-${LFSVERSION}.tar.gz .
Where LFSVERSION is set set to the version of the book I am using, that way if something goes wrong after adjusting thee tool chain I have a clean set of tools I can use.
 
Old 02-02-2015, 10:47 AM   #12
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
I tend to do this:

1. Build everything needed or optional in the LFS book. This includes anything listed during chapters like berkeley db and cracklib as well as anything else listed at the end of the LFS book.

2. I then complete Chapter 3 at least and then import many of the system utilities as well before moving on to Xorg.

3. After Xorg I work on Xfce. It's lightweight enough to be built quickly and get basic stuff inserted.

4. After I get Midori or Firefox built, it's all native B/LFS.
 
  


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
error when I finished lfs 7.3 potterius Linux From Scratch 1 05-11-2013 08:23 AM
how to start blfs once lfs is finished bhismnarayan Linux From Scratch 5 03-14-2011 11:22 AM
finished lfs 6.3.... @d4M Linux From Scratch 9 02-10-2009 09:07 AM
finished a C++ book.... any coding projects for newbie zetsui Programming 9 05-06-2004 01:02 PM
Finished LFS - it's more than 1Gb ! Bert Linux From Scratch 4 12-06-2002 04:15 PM

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

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