LinuxQuestions.org
Register a domain and help support LQ
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 01-09-2013, 09:02 PM   #1
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 65

Rep: Reputation: 0
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"
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd0,2)
menuentry "GNU/Linux, Linux 3.5.2-lfs-7.1" {
        linux   /boot/vmlinuz-3.5.2-lfs-7.1 root=/dev/sda3 ro
}
EOF
What have I missed?
 
Old 01-09-2013, 09:17 PM   #2
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 482

Rep: Reputation: 133Reputation: 133
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).
 
Old 01-09-2013, 10:07 PM   #3
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 65

Original Poster
Rep: Reputation: 0
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?
 
Old 01-09-2013, 10:29 PM   #4
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 482

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by engineer

Is there a way to change the configuration file now that I am not able to boot?
In the same terminal you have been working in, open the file /boot/grub/grub.cfg that you just created and fix it one way or the other for the situation. Then save it and move on.

Quote:
Originally Posted by engineer

What is the meaning of the (hd0,3) option?
GRUB uses and understands that (hdX,X) syntax. In GRUB 2, (hd0,3) would indicate the first drive and its third partition (the device name equivalent of /dev/sda3, usually). The set root=(hd0,3) command line indicates to GRUB the location of the boot files. The paths in the subsequent commands, such as the linux command, are relative to it.

Quote:
Originally Posted by engineer

Why not use the "sda" nomenclature?
That /dev/sda3 thing is a device name used by the operating system. GRUB is not using it. The root=/dev/sda3 in the linux command is merely a parameter being passed to the kernel which needs it. As for the pure question of why it is that way, who knows. It's been that way since the beginning of legacy GRUB when we all were throwing rocks and sticks at each other and howling at the moon.

Last edited by stoat; 01-10-2013 at 08:52 AM.
 
Old 01-09-2013, 10:51 PM   #5
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 65

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by stoat View Post
In the same terminal you have been working in, open the file /boot/grub/grub.cfg that you just created and fix it one way or the other for the situation. Then save it and move on.

GRUB uses and understands that (hdX,X) syntax. In GRUB 2, (hd0,3) would indicate the first drive and its third partition (the device name equivalent of /dev/sda3, usually).

That /dev/sda3 thing is a device name used by the operating system. GRUB is not using it. In the grub.cfg file, the root=/dev/sda3 in the linux command is not serving the same purpose as the set root=(hd0,3) command line which GRUB uses to find the boot files. In the linux command, root=/dev/sda3 is merely a parameter being passed to the kernel which needs it. As for the pure question of why it is that way, who knows. It's been like then since the beginning of legacy GRUB when we all were throwing rocks and sticks at each other and howling at the moon.
I would just modify the file, but I'm not able to get to a command prompt, other than the basic grub one. I can't get into the system at the moment. I also think I tried hd0,3 as well as removing the /boot parameter, to no avail. I was able to do that by modifying the line within the basic grub edit window where you select the OS you want to boot.

Last edited by engineer; 01-09-2013 at 10:52 PM.
 
Old 01-09-2013, 11:20 PM   #6
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 482

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by engineer

I would just modify the file, but I'm not able to get to a command prompt, other than the basic grub one.
If it's still stopping with that "file not found" message, then try having GRUB search for the boot partition with the search command at the boot menu's grub> prompt. Like this...
Code:
grub> search -f /boot/grub/grub.cfg
grub> search -f /grub/grub.cfg
Try both. One should give results that can be used to settle what to put in the set root command (and the root= kernel parameter if they're the same partition). Anyway, edit the lines as you did before, boot, hope. If it boots, then fix the grub.cfg file.

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.

Last edited by stoat; 01-10-2013 at 12:05 AM.
 
Old 01-09-2013, 11:51 PM   #7
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 482

Rep: Reputation: 133Reputation: 133
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.
 
Old 01-10-2013, 10:49 AM   #8
Keith Hedger
Member
 
Registered: Jun 2010
Location: Devon,UK
Distribution: Linux From Scratch, Slackware64,
Posts: 924

Rep: Reputation: 179Reputation: 179
Quote:
Originally Posted by stoat View Post
...As for the pure question of why it is that way, who knows. It's been that way since the beginning of legacy GRUB when we all were throwing rocks and sticks at each other and howling at the moon.
LOL! I still use Grub legacy ( I find it easier to set up and reinstall when I inevitably fubar my system )!
 
Old 01-10-2013, 03:16 PM   #9
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Centos6.3/Debain
Posts: 1,742
Blog Entries: 1

Rep: Reputation: 244Reputation: 244Reputation: 244
Hi

What file system did you use to build lfs, did you make it ext3 or ext4?
 
Old 01-10-2013, 06:42 PM   #10
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 65

Original Poster
Rep: Reputation: 0
So I tried this:

Code:
grub> search -f /boot/grub/grub.cfg
And the output was

Code:
grub> hd0 msdos6
I'm having trouble remembering exactly how I setup the partitions, I had originally wrote it down, but then I started over, and changed one or two things... From what I remember, I used the /boot partition that already existed, and created a new Swap partition, / partition, and the lfs partition itself. If memory serves, all (but the swap) were ext3 FS type.

I've tried:

Code:
set root=(hd0,3)
and:

Code:
set root=(hd0,2)
And then tried to boot, but neither of these worked. I also tried modifying the lines with the 'e' for edit command at the GRUB menu, and removing the /boot prefix on the /vmlinuz line. I think I'm not understanding something here when it comes to modifying this file. Thank you for all the help so far.
 
Old 01-10-2013, 06:50 PM   #11
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 65

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by stoat View Post
. As for the pure question of why it is that way, who knows. It's been that way since the beginning of legacy GRUB when we all were throwing rocks and sticks at each other and howling at the moon.
Now, THAT, is funny!
 
Old 01-10-2013, 10:05 PM   #12
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 482

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by engineer

I'm having trouble remembering exactly how I setup the partitions
Uh, I think that right there is the problem. Anyway the search commands found a single grub.cfg file in the second logical partition of an extended partition. And since the command that produced that result had "/boot" in its path, that is not a separate boot partition but a partition with a directory named "boot" in its filesystem (such as in a root partition). So a reasonable thing to try at the grub> prompt is this...
Code:
grub> linux (hd0,6)/boot/vmlinuz-3.5.2-lfs-7.1 root=/dev/sda6 ro
grub> boot
And see what happens.

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
grub> search -f /boot/vmlinuz-3.5.2-lfs-7.1
grub> search -f /etc/lfs-release
If you find those, then all that is necessary to boot the system will be known with certainty.

Last edited by stoat; 01-10-2013 at 10:31 PM.
 
Old 01-12-2013, 12:00 PM   #13
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 65

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by stoat View Post
Uh, I think that right there is the problem. Anyway the search commands found a single grub.cfg file in the second logical partition of an extended partition. And since the command that produced that result had "/boot" in its path, that is not a separate boot partition but a partition with a directory named "boot" in its filesystem (such as in a root partition). So a reasonable thing to try at the grub> prompt is this...
Code:
grub> linux (hd0,6)/boot/vmlinuz-3.5.2-lfs-7.1 root=/dev/sda6 ro
grub> boot
And see what happens.

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
grub> search -f /boot/vmlinuz-3.5.2-lfs-7.1
grub> search -f /etc/lfs-release
If you find those, then all that is necessary to boot the system will be known with certainty.
Ok, I've tried several permutations of the search command, with no luck beyond the previous output. None of the last three commands you posted yielded any results. Also, in my infinite wisdom, the version is 3.2.6, not 3.5.2 as I erroneously posted above--I did try the searches with the correct information.

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
and get output:

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.
 
Old 01-12-2013, 12:57 PM   #14
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Centos6.3/Debain
Posts: 1,742
Blog Entries: 1

Rep: Reputation: 244Reputation: 244Reputation: 244
Hi

Can you boot a live cd and post the output of fdisk -l, to see partition layout
 
Old 01-12-2013, 03:40 PM   #15
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 65

Original Poster
Rep: Reputation: 0
Code:
fdisk -l
Code:
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048   154626047    76800000   83  Linux
/dev/sda3       154626048   175106047    10240000   83  Linux
/dev/sda4       175106048   976773119   400833536    5  Extended
/dev/sda5       175110144   185350143     5120000   82  Linux swap / Solaris
/dev/sda6       185352192   292968447    53808128   83  Linux
The LFS system is on /dev/sda6, and the FS type is ext3.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] LFS 6.8: Grub Error TKH Linux From Scratch 5 08-20-2011 09:52 AM
Grub error 21 with LFS 6.3 Chapter 8.4 bines Linux From Scratch 10 12-24-2008 04:18 PM
LFS 6.2 grub boot error 15 problem HedAche Linux From Scratch 1 08-02-2007 02:20 PM
error in 6.34 grub lfs-6 sharmashikha Linux From Scratch 1 07-05-2005 09:22 AM
Boot LFS with Grub darkmage Linux From Scratch 2 08-20-2002 01:53 PM


All times are GMT -5. The time now is 08:52 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration