LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 08-06-2011, 06:32 PM   #1
unitedfollowers
LQ Newbie
 
Registered: Aug 2011
Location: USA/CO
Distribution: FC-14
Posts: 11

Rep: Reputation: 0
Cannot get a LFS 6.8 usb build to boot


I've successfully compiled LFS onto a usb drive (as far as I can tell with no errors) and now when I try to boot into the usb drive I get nothing. I've tried to add a manual entry to my host system's GRUB (v.97) and it says that it couldn't mount the partition GRUB error 17.

I've also tried to use this plop boot manager to boot into the USB, but when I try to it just freezes;the keyboard does not work and the screen is stuck on the plop boot manager main screen. I have to power down to recover from this.

I don't seem to get any other errors so I'm stuck as to what is going wrong here.

Here's some info:
(sdb is my usb device)
/dev/sdb1 -> /boot
/dev/sdb2 -> swap
/dev/sdb3 -> /

In fdisk all the partitions show up with id 83. I know sdb1 and sdb3 are ext3 as I did the proper mkfs.ext3 to them in the beginning.

My fstab:
Code:
# file system   mount-point   type   options          dump   fsck
#
/dev/sdb3       /             ext3   defaults         1      1    
/dev/sdb2       swap          swap   pri=1            0      0
/dev/sdb1       /boot         ext3   defaults         0      0
proc            /proc         proc   defaults         0      0
sysfs           /sys          sysfs  defaults         0      0
devpts          /dev/pts      devpts gid=4,mode=620   0      0
tmpfs           /dev/shm      tmpfs  defaults         0      0
And here's a snippet of the /boot/grub/grub.cfg:
Code:
### BEGIN /etc/grub.d/10_linux ###
menuentry "GNU/Linux, with Linux 2.6.37-lfs-6.8" --class gnu-linux --class gnu --class os {
	insmod ext2
	set root='(hd1,1)'
	search --no-floppy --fs-uuid --set 6d76e32e-d827-4990-a4f0-2fece319ec43
	echo	Loading Linux 2.6.37-lfs-6.8 ...
	linux	/vmlinux-2.6.37-lfs-6.8 root=/dev/sdb3 ro  
}
menuentry "GNU/Linux, with Linux 2.6.37-lfs-6.8 (recovery mode)" --class gnu-linux --class gnu --class os {
	insmod ext2
	set root='(hd1,1)'
	search --no-floppy --fs-uuid --set 6d76e32e-d827-4990-a4f0-2fece319ec43
	echo	Loading Linux 2.6.37-lfs-6.8 ...
	linux	/vmlinux-2.6.37-lfs-6.8 root=/dev/sdb3 ro single 
}
### END /etc/grub.d/10_linux ###
I am 99% sure that the relevant USB drivers and SCSI drivers are built into the kernel not as modules. I can give the .config file but that is quite large so I'm leaving it out.

What's going on?

Additionally, I ran this boot info script from sourceforge, it outputted this

=> Grub2 (v1.97-1.98) is installed in the MBR of /dev/sdb and looks at sector
1 of the same hard drive for core.img. core.img is at this location and
looks in partition 1 for /grub.

So I think that means that GRUB is installed and is finding things to an extent within my usb drive.

Also, when I try doing the step in 8.4.3 of the V-6.8 LFS book to test my GRUB configuration, I get nowhere. In my host system, which is running legacy GRUB, I type "root (hd1,1)" in grub and it says unknown Filesystem, partition type 0x83. Then if I try to do the kernel line it says cannot mount partition.

Is there some kind of log file maybe that would give more info on any other errors that might help diagnose this problem?

Last edited by unitedfollowers; 08-07-2011 at 04:54 PM.
 
Old 08-13-2011, 02:15 PM   #2
unitedfollowers
LQ Newbie
 
Registered: Aug 2011
Location: USA/CO
Distribution: FC-14
Posts: 11

Original Poster
Rep: Reputation: 0
Progress

So I formatted the USB drive, and started over with LFS from chapter 6. This time I only used two partitions:

/dev/sdb1 --> /
/dev/sdb2 --> swap

I made my new fstab accordingly. I've gotten all the way back to the point I was with my first try. Then when I tried to use GRUB to boot into the USB drive with the root as (hd1,1) I got the same error as before. Then I changed it to (hd1,0) to see what would happen and I got somewhere. Then I got a kernel panic.

Code:
VFS: Unable to mount root fs via NFS, trying floppy
VFS: Cannot open root device "sdb1" or unknown block (2,0)
Please eppend a correct "root=" boot option here are available partitions:
0800 sda driver:sd
0801 sda1
0802 sda2
0803 sda3
0b00 sr0 driver:sr
kernel panic - not syncing, unable to mount root fs on unknown block (2,0)
My Legacy GRUB menu.lst looks like this for LFS:

Code:
title LFS
	root (hd1,0)
	kernel /boot/vmlinux-2.6.37-lfs-6.8 root=/dev/sdb1 ro
Fstab:
Code:
# Begin /etc/fstab

# file system  mount-point  type   options         dump  fsck
# 

/dev/sdb1      /            ext3   defaults        1     1
/dev/sdb2      swap         swap   pri=1           0     0
proc           /proc        proc   defaults        0     0
sysfs          /sys         sysfs  defaults        0     0
devpts         /dev/pts     devpts gid=4,mode=620  0     0
tmpfs          /dev/shm     tmpfs  defaults        0     0
# End /etc/fstab
I've looked around on these forums and seen other's problems with kernel panic. They've tried things like changed the sd to hd but I've tried the root line with sdb1,sdb,and hdb1 with no result. I know sdb1 IS ext3 and I know the kernel has ext3 compatibility built in.

It seems that it really does not like my partition for some reason.

Also something that is perplexing me, GRUB seems to consider (hd1,0) ext2fs and hd1,1 as unknown. This is strange as hd1,1 (or sdb1) is ext3 by cfdisk and other utilites. I also have ext2 build into the kernel.

Any tips?

Last edited by unitedfollowers; 08-13-2011 at 03:16 PM.
 
Old 08-14-2011, 03:53 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Are you sure you need to use sdb in your configuration files?

I've never created or used a bootable USB device, but looking at the info you posted it looks like it is picked up as sda (which sounds kinda logical):
Code:
.
Please eppend a correct "root=" boot option here are available partitions:
0800 sda driver:sd
0801 sda1
0802 sda2
0803 sda3
.
Versus:
Code:
root (hd1,0)
kernel /boot/vmlinux-2.6.37-lfs-6.8 root=/dev/sdb1 ro

and

/dev/sdb1      /            ext3   defaults        1     1
/dev/sdb2      swap         swap   pri=1           0     0
Hope this helps.
 
Old 08-14-2011, 01:18 PM   #4
unitedfollowers
LQ Newbie
 
Registered: Aug 2011
Location: USA/CO
Distribution: FC-14
Posts: 11

Original Poster
Rep: Reputation: 0
The sda partitions belong to my host harddrive, NTFS, an LVM, and a /boot. They are not partitions on the usb.
 
Old 08-14-2011, 01:28 PM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Quote:
Originally Posted by unitedfollowers View Post
The sda partitions belong to my host harddrive, NTFS, an LVM, and a /boot. They are not partitions on the usb.
True, but that is during the build.

Once you boot from the USB device it could be seen as the first device present and thus be sda instead of sdb.
 
Old 08-14-2011, 07:42 PM   #6
unitedfollowers
LQ Newbie
 
Registered: Aug 2011
Location: USA/CO
Distribution: FC-14
Posts: 11

Original Poster
Rep: Reputation: 0
With root still as (1,0), I've changed the GRUB root line to use sda1, sda2, and sda3. This confirmed my suspicion that these partitions were of my host system's hard-drive, and not of the USB, as sda1 was reported as NTFS (my windows partition), sda2 as unknown (as it was the LVM), and sda3 as the /boot for my fedora system. That was a good thought though, but still I only made two partitions on the USB drive that filled up the entire capacity so there was no way it could have been sda with three partitions.

I did change the fstab accordingly when I used the sda partitions.

Maybe I did something wrong when I set up the USB device?

First I unmounted the USB storage (as its automounted upon detection) and then ran fdisk on /dev/sdb (my USB device). Here I created two primary partitions, one 3GB sized, and the other approx. 0.7GB. I then made sure that both were type 83 (a linux partition) and then made the 3GB partition bootable.
I then wrote the changes and left fdisk.

At this point the 3GB partition is the / and the .7 is for the swap.
Next, I used mke2fs -jv /dev/sdb1 (I also used mkfs.ext3 /dev/sdb1 on a previous attempt). Both gave no errors and completed themselves. Then I used mkswap on /dev/sdb2. No error there.

Finally, I mounted /dev/sdb1 to /mnt/lfs and followed the book to get to the point where I am now and also used swapon on /dev/sdb2.

I'm starting to guess my USB drive is one of those that just don't work with this type of thing. Strange thing though, as I've used this universal USB installer from pendrivelinux and put Ubuntu on this same USB device before and gotten it to be able to boot (though it stopped working a couple boots after).

A further thing, when I verify the partition table in fdisk on /dev/sdb currently it gives me this:
Code:
Partition 1: previous sectors 6293503 disagrees with total 6289728
Partitions 2: cylinder 1018 greater than maximum 1017
Partition 2: previous sectors 7823295 disagrees with total 7820134
Remaining 2047 unallocated 512-byte sectors
I haven't played with partitions since I originally used fdisk to set the device up in the beginning. Maybe this is where the partitions problems are arising due to weird allocation of the sectors? (just shooting in the dark here, I have no real idea what the above means)

Last edited by unitedfollowers; 08-14-2011 at 08:03 PM.
 
Old 08-15-2011, 01:51 AM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

As I stated in one of my previous replies, I never tried to make a bootable USB device.....

If I do a quick search on creating a bootable USB device I do notice that it isn't as simple as installing an OS and setting up a bootloader (grub in this case). For one your BIOS must be able to handle this (which it probably does, you do mention running Ubuntu from an USB device). And I do believe you need to create an image that is put on the USB device.

WIKI - Live USB

You might want to do a search on linux create bootable usb and see what is involved.

Hope this helps.
 
1 members found this post helpful.
Old 08-15-2011, 07:49 AM   #8
unitedfollowers
LQ Newbie
 
Registered: Aug 2011
Location: USA/CO
Distribution: FC-14
Posts: 11

Original Poster
Rep: Reputation: 0
I've tried everything but realizing that haha, thanks that's what I should have done in the beginning. I'll try again after some research this weekend
 
Old 08-15-2011, 08:19 AM   #9
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
You're welcome
 
Old 09-05-2011, 08:13 PM   #10
unitedfollowers
LQ Newbie
 
Registered: Aug 2011
Location: USA/CO
Distribution: FC-14
Posts: 11

Original Poster
Rep: Reputation: 0
Update Again

Finally got somewhere I believe, three weeks later (I've been busy so...) So I think I found out that the fdisk verify errors I got were a factor on why LFS on bootup detected my sdb partition as unknown. I think the problem was that the partition allocations didn't match up to the cylinder and cylinders designated to one partition ran into the next, resulting in a messed up boot up process. So I redid my partitions with Gparted and aligned to cylinders, and now on LFS boot up I get further, I think. I still get a kernel panic, but at least now the list of available partitions shows my sdb1 and sdb2 (/ and swap respectively) partitions. I also get a ton more output to the boot up screen, talking about USB devices (keyboard and mouse) and talking about the USB mass storage device that holds LFS. However, I'm still getting kernel panics; When supplied with root=/dev/sdb1 and root as (1,0) it can't mount the rootfs or block (2,0). What I don't get is why its saying block 2,0...I'm on 1,X am I not? Or is this something else?

I've also seen that others have posted about LFS and USB sticks. The two summaries I've deduced is to make a bootable image like druuna linked to or make an initrd and pass it to GRUB (there was one poster that said he got LFS to work on a USB but the key part was getting the initrd right).

I'd like to give making an initrd a try, as the image is mostly read only with write operations complicating the matter.
So I've looked into what it takes to make an initrd, and it seems similar to an image in that it encompasses a copy of your system. But I am stuck on how to create the initrd. I've read that there's scripts available but you need to compile Busybox to make the scripts work, which I'm not so sure is necessary. Is there a way to make an initrd without busybox-related scripts?
 
Old 09-06-2011, 04:11 AM   #11
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,
Quote:
Originally Posted by unitedfollowers View Post
I'd like to give making an initrd a try, as the image is mostly read only with write operations complicating the matter.
So I've looked into what it takes to make an initrd, and it seems similar to an image in that it encompasses a copy of your system. But I am stuck on how to create the initrd. I've read that there's scripts available but you need to compile Busybox to make the scripts work, which I'm not so sure is necessary. Is there a way to make an initrd without busybox-related scripts?
This doesn't seem to be LFS specific and I would suggest you post a new thread which contains this in Linux - General to get the exposure it deserves.

Hope this helps.

PS: There is a LFS hint about initrd, but it does use busybox: initrd for LFS
 
Old 09-06-2011, 04:05 PM   #12
mulyadi.santosa
Member
 
Registered: Sep 2011
Posts: 96

Rep: Reputation: 15
hi guys, this is my first post in LQ

Ehm, just idea, have you tried to add "rootdelay=nn" as your kernel parameter into your boot loader? "nn" is number in seconds. It will delay your boot just when it about to reach root filesystem root pivoting/mounting.

I read many times that distros like Tiny core use that trick to allow Linux kernel USB subsystem to completely finish USB initialization before proceeding into loading Linux (in this, tiny core is installed in USB flash disk)
 
2 members found this post helpful.
Old 09-06-2011, 11:08 PM   #13
unitedfollowers
LQ Newbie
 
Registered: Aug 2011
Location: USA/CO
Distribution: FC-14
Posts: 11

Original Poster
Rep: Reputation: 0
Success!

I have finally managed to get into my LFS system on my USB stick thanks to the help of posters! It turns out the last piece I needed was to add rootdelay=10 to the kernel line in GRUB to allow the USB stick to settle and initialize and it worked! Thanks for your time in helping me out! I just have a linux console fail error which I can resolve rather quickly.

Just as a recap...
My first problem was that when I used fdisk the partitions didn't align to the cylinder so one partition ran into another. This is probably what caused my partition to be unknown during bootup time. This maybe just relevant to my USB stick.
The second problem was that I needed to add rootdelay to the kernel line in GRUB so that the USB drive could settle and thus the rootfs could then be found.
Also, in my case, my fstab needed to be sdb and not sda as even when I booted into LFS it still saw sda as my host system's hdd and sdb as my USB stick LFS drive.

This was done without images or an initrd.

Special Thanks to mulyadi for saving from going to extra lengths to get my system to boot!

Last edited by unitedfollowers; 09-06-2011 at 11:09 PM.
 
Old 09-06-2011, 11:35 PM   #14
mulyadi.santosa
Member
 
Registered: Sep 2011
Posts: 96

Rep: Reputation: 15
Hi unitedfollowers

Glad you made it Well sometimes we could borrow knowledge from other distros....and sometimes that could be very valuable.

Regarding device name, I suggest to use label or UUID instead of names like "sda". That way, no matter how your storages are configured, it would be the same. AFAIK, to support block name laballing, you would need blkid. There could be more.....
 
  


Reply

Tags
boot, grub, lfs, usb



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] boot problem after installing LFS on a USB stick vmsda Linux From Scratch 1 03-28-2011 10:47 AM
Can't boot LFS ( kernel panic - not syncing ) LFS 6.6 Lyle Linux From Scratch 14 05-15-2010 03:22 AM
How to build an USB key compatible with UDB-FDD boot BIOS ? bcostacurta Linux - General 1 12-11-2008 08:32 AM
LFS - How to Use CD to Boot from USB HD mmmmtmmmm Linux From Scratch 1 09-26-2007 02:51 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

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

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