[Techtalk] Grub defaults after new kernel image install

Carla Schroder carla at bratgrrl.com
Tue Jul 25 18:08:46 UTC 2006


On Tuesday 25 July 2006 10:45, Gina Lanik wrote:
> On Tue, Jul 25, 2006 at 09:10:53AM -0700, Carla Schroder wrote:
> > On Tuesday 25 July 2006 08:33, Gina Lanik wrote:
> > > > A slick trick is to use the 'savedefault' option, which probably isn't 
> > what 
> > > > you want, but I feel like telling about it anyway. :) If you are 
> > > > multi-booting or have multiple kernels, GRUB will boot whatever you 
booted 
> > to 
> > > > last, instead of always having the same default. It looks like this:
> > > 
> > > [...]
> > > 
> > > I remember seeing this on our Debian boxen. Confused me to no end 
because
> > > -every- stanza had the savedefault option listed, no idea why.
> > 
> > Because it only works with the stanzas that have the 'savedefault' option. 
> > That lets you exclude the ones you don't want. GRUB is kewl.
> 
> I agree - but riddle me this - how would I find out the last booted
> kernel/stanza when 'savedefault' is in every one? ;-)
> E.g.  three different initrds but the same title? I remember searching like
> crazy but couldn't find an answer.
> 

You won't know until you reboot and see the boot menu. I use 'savedefault' on 
my test machines, because I usually need to reboot a lot and it's just too 
much work to sit and wait for the boot menu and then pick the last one I 
used. Oh the suffering. For a production machine it's not very practical.

Not sure what you mean by 'three different initrds but the same title', 
because every stanza must have a different title. That's how GRUB tells them 
apart. Here is a snippet from my test Kubuntu box:


title		Ubuntu, kernel 2.6.15-26-k7
root		(hd0,4)
kernel		/vmlinuz-2.6.15-26-k7 root=/dev/mapper/Ubuntu-root ro quiet splash
initrd		/initrd.img-2.6.15-26-k7
savedefault
boot

title		Ubuntu, kernel 2.6.15-26-k7 (recovery mode)
root		(hd0,4)
kernel		/vmlinuz-2.6.15-26-k7 root=/dev/mapper/Ubuntu-root ro single
initrd		/initrd.img-2.6.15-26-k7
boot

title		Ubuntu, kernel 2.6.15-26-386
root		(hd0,4)
kernel		/vmlinuz-2.6.15-26-386 root=/dev/mapper/Ubuntu-root ro quiet splash
initrd		/initrd.img-2.6.15-26-386
savedefault
boot

title		Ubuntu, kernel 2.6.15-26-386 (recovery mode)
root		(hd0,4)
kernel		/vmlinuz-2.6.15-26-386 root=/dev/mapper/Ubuntu-root ro single
initrd		/initrd.img-2.6.15-26-386
boot


The recovery-mode stanzas don't get savedefault, because I rarely use them. 

Kubuntu installs new kernel versions on a frequent basis, so for me 
the 'savedefault' option serves a useful purpose. This prevents it from 
automatically booting to the new kernel after installation. Kubuntu 
automatically adds new menu entries to the top of the list, so 'boot 0' would 
always select the newest kernel. 

It's a small convenience, because of course there is always the boot menu to 
choose from. But I get absent-minded, so it saves me a bit of trouble.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Carla Schroder
 check out my "Linux Cookbook", the ultimate Linux user's
 and sysadmin's guide! http://www.oreilly.com/catalog/linuxckbk/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


More information about the Techtalk mailing list