[ale] Continuing Saga of Centos 5.6

Michael B. Trausch mike at trausch.us
Fri Aug 12 10:13:54 EDT 2011


(Sorry, somehow I lost the message from Derek.  I'm replying both to his
and Jim's message here.)

On 08/12/2011 09:55 AM, Jim Lynch wrote:
> On 08/11/2011 12:51 PM, Derek Atkins wrote:
>> "Michael B. Trausch"<mike at trausch.us>  writes:
>>
>>> On 08/10/2011 09:33 AM, Derek Atkins wrote:
>>>> Even Fedora 15 still uses Grub v1.
>>>>
>>>> It's sufficiently different that Red Hat hasn't switched over.
>>> A shame, really.  GRUB 2 is far superior in every way.
>> I would argue it's NOT superior in *every* way -- the fact that you have
>> to run a program to build your configuration every time you tweak it is
>> most definitely a step backwards IMHO.  It's not as bad as LILO, but
>> it's certainly damn close!  I *LIKE* the fact that I can just hand-edit
>> a single configuration file and it gets used at runtime.

Boot configurations are rather complex today.  Virtually the whole
process of configuring the boot process is automated.

That isn't to say that you cannot hand-edit the configuration; you could
quite easily create something like "vigrub" (similar in purpose to
"visudo") such that when you edit aspects of the GRUB configuration you
automate the calling of grub-mkconfig.  Honestly, though, the modular
"meta-configuration" files significantly reduce the complexity exposed
to the human user, and make it possible for package managers to automate
the bootloader configuration 100% as well without having to parse the
existing whole-configuration file.

Perhaps if the group desires it, I will reprise my presentation on GRUB
2 with a focus on the configuration process itself; I gave a talk on it
a while back, but the focus was really an introduction to all of GRUB 2.
 Once one gets used to it, though, it is really a much better system
than GRUB legacy.

>> Sure, grub2 has its benefits too, such as better LVM and FS support.
>> But the configuration bit is a large chunk to chew.
>>
>> I don't blame Red Hat for being cautious.
>>
>> Just the simple task of changing your boot parameters in g2 took me half
>> an hour to figure out what file to change and how to change it..  And
>> even then I didn't get it right the first time!  Whereas with g1 it's
>> boom -- there you go!  Open file, add options, save file, reboot.  Done.

It is always the case that the familiar is more expedient than the
unfamiliar.  I can change boot parameters---for all of my kernels, not
just one of them---in just a minute or so.  You can even dynamically add
things to the GRUB 2 configuration.  This is how the os-prober
functionality works; it is called after the Linux kernels.

You can write a program (shell script, C program, whatever) to generate
portions of the configuration any way you want; the only requirement is
that when the file is called, it outputs its configuration fragment(s)
to stdout, and grub-mkconfig assembles all that into the whole
configuration file.

> I have to agree with Derek.  I still haven't figured out how to set the 
> default.  I ended up reorganizing my options, putting the kernel I 
> wanted to be the default at the top.  Not optimal but it worked.

How to set the default kernel?  Typically the first option, however,
there is a "defaults" file that you can use to specify which option is
your default option.  (It counts from zero.)

If you wish to always have a particular kernel be the first one listed,
you can simply copy the boot configuration into a script in /etc/grub.d
and have it run before 10_linux, and just output its configuration
stanza.  In this way you can force the settings and the kernel version
used to be static.

If you are someone who boots into Windows frequently and Linux-based
systems only rarely, you can rename the /etc/grub.d/30_os-prober file
(the number might be different) to /etc/grub.d/05_os-prober and then
Windows will be the first option and thus be booted by default.

You can also instruct grub to save the last booted option and use that
as the default, by putting the following in grub's defaults file:

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

On Gentoo, that file is /etc/defaults/defaults (I think that's probably
a packaging error); on Ubuntu, IIRC, it is /etc/grub/defaults.

	--- Mike


More information about the Ale mailing list