LFS 7.1 First Boot, grub error
I just tried booting my LFS system for the first time, and encountered an error when booting. GRUB loads the OS name, but when it comes time to boot, it says "error: file not found".
Below is the grub.cfg file that I created right before I rebooted (my root partition is mounted on /dev/sda3, so I used that, like the book suggested. Code:
cat > /boot/grub/grub.cfg << "EOF" |
If you have a separate boot partition as the set root command suggests, then you should not include "/boot" in the path of that linux command. On the other hand, if you do not have a separate boot partition, then the set root command should specify (hd0,3).
|
Is there a way to change the configuration file now that I am not able to boot? What is the meaning of the (hd0,3) option? Why not use the "sda" nomenclature?
|
Quote:
Quote:
Quote:
|
Quote:
|
Quote:
Code:
grub> search -f /boot/grub/grub.cfg P.S.: The search command that gives results also will be the clue as to whether or not to use "/boot" in the path of the linux command. |
Another thing I forgot about is if you find out some partition numbers in the grub.cfg were wrong and fix them, it may boot farther along and stop again if your /etc/fstab also contains partition errors. Anyway, it happens all the time. Be prepared to fix that, too.
|
Quote:
|
Hi
What file system did you use to build lfs, did you make it ext3 or ext4? |
So I tried this:
Code:
grub> search -f /boot/grub/grub.cfg Code:
grub> hd0 msdos6 I've tried: Code:
set root=(hd0,3) Code:
set root=(hd0,2) |
Quote:
|
Quote:
Code:
grub> linux (hd0,6)/boot/vmlinuz-3.5.2-lfs-7.1 root=/dev/sda6 ro If that doesn't at least attempt to boot the LFS system, then boot with a live CD and post some more information to show the partition layout better such as the fdisk output for /dev/sda. I'm wondering where is or what happened to the host system, for example. P.S.: Some other grub> searches that might help untangle this might be searching specifically for the LFS kernel and the lfs-release file (if you created it)... Code:
grub> search -f /vmlinuz-3.5.2-lfs-7.1 |
Quote:
Now, this begs the question, where is the original boot file that the base system uses? How can I roll back to that? Also, what does it actually mean when we search for: Code:
grub> search -f /boot/grub/grub.cfg Code:
grub> hd0 msdos6 I'm sorry for my ignorance, but I've never spent any time messing around with GRUB, so I'm really in the dark here. |
Hi
Can you boot a live cd and post the output of fdisk -l, to see partition layout |
Code:
fdisk -l Code:
Device Boot Start End Blocks Id System |
So am i correct you cant find boot or grub for lfs?
|
Using the search function of grub, the only thing I've been able to find is the grub.cfg file, on hd0 msdos6. Outside of that, I've tried searching for several different locations, and apparently it's just nowhere to be found...
|
Hi
If you mount the lfs partition usin live cd you can look through the whole partition, You could use host system to mount the partition |
Quote:
|
Quote:
|
The plot thickens. Thanks for the link to the software, stoat. I tried to boot with the SG2 program, and here are the results:
- First option: Detect any OS. Selecting this option brings up just two listings; LFS, and LFS single user mode. I tried picking both of them, and neither of them will boot. GRUB acts like it is doing something (data running across the screen) then just stops after a few seconds, with some text on the screen saying something about kernel panic (most of the text doesn't mean anything to me, if you want me to post more details, let me know). - Second option: Detect any GRUB2 configuration file (grub.cfg). This results in one listing, grub.cfg, listed on hd0,6, and when selecting this I get the same error as before: file not found, and no booting action. - Third option: Detect any GRUB2 installation (even if MBR is overwritten). This has the same result as option 2, it lists the LFS system, and when I pick it, still no boot. I also chose the list devices/partitions option, which resulted in a listed of the partition table, which included hd0,6 as a type ext2 FS, and hd0,3, as an ext2 FS, for my Fedora install. For what it's worth, I don't have any data on this system, just the base system, which I installed for the sole purpose of building LFS, and the LFS build that I am working on. So, no major loss other than time if I have to start over. At this point, I'm just curious where I went wrong so I don't do it again next time. I'm going to try looking at the config files I made just before rebooting via mounting the lfs partition within the Fedora live CD environment to try and glean some more answers. PS. I don't think the host was using legacy grub. The host is/was (Taps playing in background) Fedora 17. Also, just to be clear, when Grub loads, it says Grub 1.99 at the top of the screen. |
Use that live CD to mount and examine the filesystem of /dev/sda1. Its size makes it look like the Fedora boot partition. If so, the Fedora kernel, initial ram filesystem, and GRUB folder should be there. But in post #10 you mentioned using the existing boot partition. I'm wondering if it got formatted or if the Fedora boot files are still there or what. And if you find the LFS boot files in the /boot folder of /dev/sda6, maybe you could post the grub.cfg that we know is there since the one in post #1 is not it. Perhaps someone will see what is causing the file not found error and offer something to fix it. Who knows, the LFS system might miraculously boot to a login prompt. If so, it at least would be possible to tweak and finalize if for BLFS without the further need of the host system. If it doesn't boot own its own now, that would be trouble without the host system available.
|
Posting the output of lfs /boot might help as well
|
Quote:
Code:
[root@localhost /]# mkdir /mnt/exboot Code:
[root@localhost grub]# cd /mnt/lfs Code:
[root@localhost lfs]# cd /boot |
Hi
The boot dir dose not look right for lfs. It looks like the boot dir of fedora The files which should have been copied when building the kernel chapter 8.3 vmlinuz-3.5.2-lfs-7.2 System.map-3.5.2 config-3.5.2 I see what you have done cd /mnt/lfs/boot dont do /mnt/lfs then cd /boot That will put you in host boot dir You should of cd /mnt/lfs Then cd boot |
You're right. My mistake. See below.
Code:
[root@localhost grub]# cd /mnt/lfs |
Ok
Your 1st post you were looking for vmlinuz-3.5.2-lfs-7.1 You should of had vmlinuz-3.2.6-lfs.7.1 your grub.cfg should look like this Code:
Begin /boot/grub/grub.cfg installing grub to Code:
grub-install /dev/sda or what did you do? |
Since the book said that this chapter was optional, all I did was create the new /mnt/lfs/boot/grub/grub.cfg file as shown above.
I'm at a real loss as to how Grub is working here. I've tried updating the grub.cfg file as you showed above. I've also checked that the files were copied in Section 8.3 (vmlinuz-3.2.6-lfs-7.1, System.map-3.2.6, and config-3.2.6) were all placed in the /boot directory of the /mnt/lfs partition for the LFS system. Where does grub look for the information to choose which kernels (or OS) to display for selection on booting? Is this the information in the grub.cfg file? If so, it is correctly reading that file, since the kernel listed in Grub's boot menu is the 3.2.6 lfs kernel. Once I choose a kernel to boot, where does Grub look for the image (or what tells grub where to look for the image)? It seems like no matter what I do, I get the error: file not found error on trying to boot the 3.2.6 image. What file is grub referring to when it says it is not found? |
I,m not sure where the problem is but at the moment you now know that you are on sda6 which kernel to use vmlinuz-3.2.6-lfs-7.1.
I hope you now get a grub prompt when you boot the machine? There could be problems in the kernel config. When you built the kernel did you check and build in devtmpfs as mention on kernel page Code:
Device Drivers ---> |
Yes, I do get a grub terminal when I boot.
Also, I did make the change in the kernel configuration for the devtmpfs as required. |
Maybe it's just a typo. These are different...
Quote:
Quote:
|
Quote:
If you are using the boot loader of another system (such as Fedora's) to boot LFS, then its boot.img and core.img were embedded and its grub.cfg is being used, so that menuentry stuff you have been agonizing over needs to be in Fedora's grub.cfg. In that case, a grub.cfg in the LFS /boot partition would not be needed nor used. But if you installed LFS's GRUB in the master boot record (with the grub-install /dev/sda command), then LFS's core.img was embedded and its grub.cfg is being used and where your menuentry stuff has to go and be accurate. |
Quote:
After I fixed the typo, it booted. Facepalm. |
Quote:
|
All times are GMT -5. The time now is 12:57 AM. |