Don't edit /etc/grub.d/grub.cfg

DJ Lucas dj at linuxfromscratch.org
Mon Aug 23 22:28:34 PDT 2010


On 08/23/2010 10:38 PM, Bruce Dubbs wrote:
> DJ Lucas wrote:

>> Additionally, we can comment out the search line in 00_header (since it
>> is pretty much useless on default build) and add some additions there
>> (like background image, or prettier colors, etc.).  

I think I spoke too soon on that.  I haven't been able to figure out
exactly where that line comes from.

> Wow.  I think that's a lot harder than just editing a file.  

Oh yes, it is certainly more difficult, but I was looking more at
explaining how things are done (education has always been a top priority
in the past).  Also, by editing the grub.cfg file manually, we are
making a recommendation that conflicts with one made by the developers.
 Doing something like that has a tendency to bite you in the rear later
on down the road.  I do realize that I'm asking for a lot of changes to
be made very late in the development cycle, but I really think it's
wrong to recommend editing that file if the devs don't want you doing
it.  I'll be happy to do the leg work.

We also used to have multiple examples in the book, for instance the
prettier colors and the chainloading example.  The chainloading example
need not be Windows specific (though that is probably the most used).
Chainloading is useful for booting to CD, floppy, (PXE?,) or any other
bootloader, even another copy of grub, on a different partition.

Additionally, the possibility of destroying a good config if
grub-mkconfig is run again kinda scares me.  Though it shouldn't happen
given the text in the book, who knows what kind of documentation a user
might run into out in the wild.  I ran into exactly that command when
looking for the chainloader example, the second hit with "grub2
chainload windows" in Google (the first one *looked* really hairy).

http://wiki.archlinux.org/index.php/GRUB2#Dual-booting

Ultimately, for my previous message, I used the first 'hairy' example
because it is a lot more informative as to what is really happening when
you run grub-mkconfig:

http://blogs.koolwal.net/2008/12/28/windows-xpvista-dual-boot-does-not-boot-from-grub2-or-grub-pc/

> To add a 
> new kernel, you just need to add 2 lines.
> 
> menuentry "LFS SVN 20100627, Linux 2.6.34" {
>          linux   /linux-2.6.34 root=/dev/sda13 ro
> }

The following example would work just as well as manually editing the
file, and would avoid the 'scare' I had mentioned above:

cat >> /etc/grub.d/40_custom << "EOF"
menuentry "LFS SVN 20100627, Linux 2.6.34" {
linux   /linux-2.6.34 root=/dev/sda13 ro
}
EOF

Finally, I'm still not very happy with that disaster created by the
10_linux script, which is why I suggested changing the permissions on it
(and have done so locally).

-- DJ Lucas

-- 
This message has been scanned for viruses and
dangerous content, and is believed to be clean.




More information about the lfs-dev mailing list