Linux From ScratchThis 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.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
After two past failed attempts with earlier versions I've finally completed LFS 6.3 using the LiveCD - and learnt a great deal along the way! I've followed the book very carefully (I don't know enough to stray anyway!)
I'm now stuck in Chapter 8.4 'Making the LFS System Bootable'. I want to make a dual-boot system for LFS and my Windows XP system, both of which are in separate partitions.
In chapter 8.4, I run the GRUB shell then type: root (hd0,2). But I get the dreaded "Error 21: Selected disk does not exist".
LFS is built on partition sda3 which is of type ext3. Other partitions contain Windows XP (sda1), a 'User' partition for my Windows files (sda6) and a small partition for the Linux swap file (sda5).
I use just a single SATA hard drive (no RAID).
When compiling the Kernel I have ensured that Serial ATA (prod), SCSI and type ext3 have all been enabled.
Although I've found others on this forum with Error 21 problems, they seem to be doing things a bit different to me so have been of little help.
I can't find any hints that address this problem, nor does Google throw up anything useful.
I'm determined not to have to give up yet again and have to snatch defeat from the jaws of success! so any advice would be very much appreciated.
I tried all partition numbers from 0 to 6 in each of drive numbers 0 to 4 but always got that dreaded error 21 message. I couldn't see much future in going any further but it was definitely worth a go.
I've looked in my BIOS to see if there is anything I could conceivably change to do with the SATA drive but couldn't see anything.
I'm going to re-visit those other posts and see if there's anything I have missed. Meanwhile I hope there is someone out there who can shed some light on the problem.
Many thanks Yancek for your reply. Here is the information you requested:
fdisk -l produces the following output:
Disk /dev/sda: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 12748 102398278+ 7 HPFS/NTFS
/dev/sda2 24907 30514 45046260 f W95 Ext’d (LBA)
/dev/sda3 12749 24906 97659135 83 Linux
/dev/sda5 24907 25496 4739143+ 83 Linux
/dev/sda6 25497 30514 40307053+ 7 HPFS/NTFS
I have built my LFS system on sda3 with a small swap file on sda5.
The other partitions are for my existing Windows XP system.
In GRUB: find /boot/grub/stage1 produces: (hd0,2)
find /boot/vmlinuz produces: Error 15: File not found
geometry (hd0) produces the following:
Drive 0x80: C/H/S=30515/255/63, The number of sectors=490234752, /dev/sda
Partition num: 0, Filesystem type unknown, partition type 0x7
Partition num: 2, Filesystem type is ext2fs, partition type 0x83
Partition num: 4, Filesystem type unknown, partition type 0x83
Partition num: 5, Filesystem type unknown, partition type 0x7
I hope this might give some clue to what is going on.
In my BIOS I have set the first boot device to be my DVD R/W drive (because my host is the LFS Live DVD) and the second boot device is my SATA hard drive.
you need a swap file for linux. you can also in the live cd open a terminal and and type grubconf. then tell it where to put grub grub always looks for the /boot folder. so make sure you have one in side the boot folder better be your kernel vmlinuz. ok now tell grub what hard drive to put the grub folder then tell it to put the boot loader on hda1 or sda1.
even if you boot it it will crash you need a linux file type 82 swap file.
so partition one of you drives cfdisk /dev/dev/sda choose a partition like sda5 if you got know data on it the delete it then remake it a little smaller give your self at least a gig of swap area if your hurting for space nothing under 524 mb. cfdisk /dev/sda choose sda5 or what ever resize it then with the left over free space make a linux primary swap partition type 82 any way after your throughputting grub on the go to the /boot/grub/menu.1st file and make sure it point to your /boot/vmlinuz/ root=/dev/sdXXX
keep hacking you will get it but before you do this you might want to down load super grub so if things go bad you can boot your other windows systems I see in there.
Thanks everybody for your valued help. There is a lot to absorb - particularly from Drakeo so I need to go off now and digest it all.
I have got a bit further, syg00 asked if I was logged on as root - I am but it set me to thinking about exactly how I am starting the system from the LiveCD whilst finishing it off. I've been using the excellent hint by Joseph Dupre but realised I didn't fully understand exactly what I'm doing - particularly with regard to populating /dev. I read a line in the LFS book which goes: mount -v --bind /dev/$LFS/dev. When I used this, grub was happy and I continued on. Now I have grub appearing at start-up but it only has my Windows option! LFS is nowhere to be seen on the menu. I can boot into Windows OK.
Unfortunately for me the LFS book does not assume use of the LiveCD so it's not that straightforward for a beginner. Clearly I have more studying to do to fully understand what's required. I am using LFS as an educational project for myself to learn about Linux so that's only to be expected.
I'll post again when I've made progress but meanwhile very many thanks to you all for your most valuable suggestions. I will study them all in detail.
chapter 6.4 "Entering the chroot environment" basically covers what you need to do after a reboot. there is also a hint that covers starting over from a saved point. I put all my startup stuff in bash script that I run after mounting the root partition.
bring up the livecd environment and run [fdisk /dev/sda] type "m" for help
type "p" to view your partition scheme. type "a" to toggle the bootable flag on /dev/sda3. You're going to want to change the partition type on /dev/sda5 type "t" to do so, it's going to be on a extended partition so select "e" and pick/type in your partition (been a while since I've used extended). the type is going to be 82 for linux/solaris swap, you can hit "l" to see all available partition types. Type "w" to write your changes to the partition table.
At this point you're going to have to run [mkswap /dev/sda5] to format the swap partition (always remember fdisk doesn't format anything).
Make sure your partitions are all listed in /etc/fstab appropriately.
Go back to the chapter on making the system bootable and make sure that you have your menu.lst file configured properly. Oh, and the find /boot/vmlinuz command didn't work because the kernel is named lfskernel-188.8.131.52 so you'd use find /boot/lfskernel-184.108.40.206 (for lfs 6.3). That should get you up and running, or at least past the 21 error. have fun