[lfs-support] Grub 2.00 questions again ... sorry

Bruce Dubbs bruce.dubbs at gmail.com
Wed Sep 5 13:33:25 PDT 2012

Mikie wrote:
> Hello all,
> Anyone who does not have time or the desire to get into this please
> feel free to ignore past this sentence.
> I have been Googling for three days and I even tried Bing (don't tell
> anyone that I used Bing though).
> This may be a dumb question but ...
> I see that Book 7.2 section 8.4 installs Grub and then we create a
> grub.cfg.
> I have been reading the Grub 2 tutorials and many times I see you
> should not edit grub.cfg rather grub (dot nothing). Then Grub scripts
> in /etc/default/grub.d will be run by the update-grub command which
> will take /boot/grub/grub as an input file ... ... and recreate
> grub.cfg as an output file.

That's the official GRUB position.  It is designed for large distros 
like Fedora, Debian, Ubuntu, etc that think they own grub.cfg.  They are 
wrong.  On *MY* system, *I* own grub.cfg.

Those scripts in /etc/grub.d have no idea of what kernels I want in my 
boot menu or what disks/partitions go with which kernels.

> I assume that in LFS a minimalist philosophy of creating a small
> quick grub.cfg is chosen.

Only to start.  Right now I have 11 entries, but I recent cleaned it up 
from a lot more.

> So as an experiment I liveCD booted, wiped a HD, fdisk'ed, formatted
> ext3, mounted on $LFS, ... then, created:
> /boot /etc/default usr/lib
> and installed Grub 1.98 via:

That's pretty old.  2.0 is current.

> grub-install  --root-directory=$LFS /dev/sda
> (I tried --boot-directory=/boot but it would not accept if
> --root-directory= is used)
> and it completed no errors but ...
> All .mod and .img files were placed in /boot/grub/ No files anywhere
> else.

That's 1.98 behavior.  They now go in /boot/grub/i386-pc for LFS.

> 1> no update-grub scripts in /etc/default/grub.d       (in fact no
> grub.d or scripts anywhere)

> 2> the .mod and .img files were not in
> /usr/lib/grub/i386-pc as I see on many other distro's and tutorials
> but were in /boot

Again, that's the old behavior.

Also, I do recommend a separate partition for /boot.  I have the 
following in my fstab:

/dev/sda1      /boot        ext3   defaults             1     2

Then all my boots access the same partition and all my kernels are in 
the same place.  Once it's set up, then you don't really need to do much 
to have a new system boot.  Just copy the kernel to /boot and edit 
/boot/grub/cfg to add basically one entry.  For example:

menuentry "BLFS Dev (LFS-7.2-rc1 SSD sdc2), Linux 3.5.2" {
    linux /vmlinuz-3.5.2-lfs-72-rc1 root=/dev/sdc2 rootfstype=ext4 ro \
      raid=noautodetect rootflags=data=writeback

> So I would assume I am doing something wrong in my use of the
> grub-install command. I assume the scripts needed to create a
> grub.cfg from a manually created grub file must come from the grub
> source tarball?

Yes, they are install in Chapter 6.

   -- Bruce

More information about the lfs-support mailing list