Friday, 14 November 2014

Changing the default Grub2 entry on the fly

Just another one of those seldom needed bits of info that I'll have to google the next time I need it unless I write it down here.

Yesterday I realised that my network shares weren't being mounted as usual, and I haven't changed the configuration for a month.  The culprit seems to be the new 3.7-2-200 (or there abouts) kernel that I installed.  I don't have time to fully explore the reasons (deadlines, deadlines, deadlines,...) so I'm dropping back to the previous kernel for now. 

Grub2 has the ability to set the default entry to the last menu item selected, but this isn't the default, at least not in Fedora 20.  My original grub defaults (/etc/default/grub) were something like:

GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_CMDLINE_LINUX=" $([ -x /usr/sbin/rhcrashkernel-param ] && /usr/sbin/rhcrashkernel-param || :) rd.luks=0 vconsole.font=latarcyrheb-sun16 vconsole.keymap=uk rhgb quiet"

So although the default is set to saved, to activate the saving feature you need to add the following:


After a quick run of grub2-mkconfig to update the grub.cfg it's all good and my default kernel is non-borked one until a fix comes in, or I have time to read the documentation to see what 'new feature' broke my configuration ;-)