Changing kernel in grub 2

Ian Malone ibmalone at gmail.com
Fri Feb 3 19:27:45 UTC 2012


On 3 February 2012 19:19, don fisher <hdf3 at comcast.net> wrote:
> I have been using grub1, where you could edit the menu.1st command to change
> kernels. The only place that I see the kernels listed is in
> /boot/grub2/grub.cfg which is generated by the files in /etc.
>
> If the current kernel does not work as desired, how does one choose the
> previous kernel? The only choices I see are:
>
> 1. edit the script that says do not edit
> 2. remove the bad kernel from /boot and run grub2-mkconfig
>
> Please advise. Once boot is broken, it is really bad!
>

Been wondering this myself with the recent wireless breakage, I
haven't tried this yet, but:
https://help.ubuntu.com/community/Grub2 section /etc/default/grub
looks to be useful. Mine is currently set to 'saved' which doesn't
seem to do what you'd expect, I think it might be necessary to also do
GRUB_SAVEDEFAULT=true to remember the previous selection (something
you couldn't do previously, so an improvement if it works even if
there is a learning curve). The other thing to watch out for is having
a working kernel drop off your system when another update comes out.

GRUB_DEFAULT - Sets the default menu entry. Entries may be numeric, a
complete menuentry quotation, or "saved"

    GRUB_DEFAULT=0 Sets the default menu entry by menu position.
Counting of entries is the same as in GRUB - the first "menuentry" in
grub.cfg is 0, the second is 1, etc.

        Note: Grub 1.99 introduces a submenu menu structure. For a
menu item in a submenu, the entry becomes a two-digit entry. The first
entry is the position of the submenu title in the main menu. The
second entry is the position within the submenu. If the submenu is the
3rd entry in the main entry, and the user wishes to boot the first
entry in the submenu, it would be designated as "2>0"

    GRUB_DEFAULT="xxxx" An exact menu entry, including the quotation
symbols, may also be used. In this case, location in the menu will not
matter. Example: GRUB_DEFAULT="Ubuntu, Linux 2.6.31-9-generic"

        In a Grub 1.99 submenu, the format would first include the
submenu number, followed by the title. Example: "2>Ubuntu, Linux
2.6.38-8-generic"

    GRUB_DEFAULT=saved
        The information in this section applies to GRUB 1.98 and later.
        Enables the "grub-reboot" and "grub-set-default" commands to
set the default OS.

        The default OS will not be set by an interactive selection of
an OS from the menu.

        grub-set-default Sets the default boot entry until changed.

            The format is sudo grub-set-default X, with X being the
menu entry position (starting with 0 as the first entry) or the exact
menu string.

            Examples: sudo grub-set-default 3 or sudo grub-set-default
"Ubuntu, Linux 2.6.32-15-generic"

            To obtain the existing menu entry choice number (starting
from 0) or the menu entry "string", run grep menuentry
/boot/grub/grub.cfg

        grub-reboot This command sets the default boot entry for the
next boot only. The format of the command is the same as for
grub-set-default (see above).

GRUB_SAVEDEFAULT= If set to true this setting will automatically set
the last selected OS from the menu as the default OS on the next boot.

    No commands need be run to set the default OS.
    Any time a menu entry is manually selected from the GRUB 2 menu,
it becomes the default OS.

    This option currently does not work if your /boot directory
resides on an LVM partition or RAID.

-- 
imalone


More information about the users mailing list