Set "older" kernel as default grub entry

Solution 1:

First, make a backup copy of /etc/default/grub. If something goes wrong, you can easily revert to the known-good copy.

sudo cp /etc/default/grub /etc/default/grub.bak

Then edit the file using the text editor of your choice (e.g. gedit, etc.).

sudo -H gedit /etc/default/grub

Find the line that contains GRUB_DEFAULT - this is what you'll want to edit to set the default. You must know the full name of the kernel you want - e.g. Ubuntu, with Linux 3.13.0-53-generic - along with the full name of the "advanced menu" - e.g. Advanced options for Ubuntu.

You then combine those two strings with > and set GRUB_DEFAULT to them as: GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 3.13.0-53-generic" (including quotes).

Save it, then build the updated grub menu.

sudo update-grub

See also: GNU GRUB Manual 2.02 or more specifically section 15.1.0 on setting the default.


Note: There is a method utilizing numbers to access kernels and menus but this is not recommended as it is unreliable when kernel updates occur.

Solution 2:

The best solution for me was to set (in /etc/default/grub):

 GRUB_DEFAULT=saved
 GRUB_SAVEDEFAULT=true

With this settings the last selected value is kept for the next boot. If you have a new kernel you don't have to edit your config.

Don't forget to re-run sudo update-grub

The solution is from reading: info grub-mkconfig

Solution 3:

Now that an Advanced menu is default in Ubuntu, you'll need to select it before the kernel you want using the > character.

Set e.g.:

GRUB_DEFAULT="1>7"

in /etc/default/grub and re-run sudo update-grub.

It is important to note that for the GRUB menu entries numbering starts with 0. Therefore the 1 above points to the Advanced menu. As a precaution, you may want to initially set GRUB_TIMEOUT=5. Some may be unable to access GRUB by hitting a key at boot time. This is a safety net in case you accidentally point to something like Memory test instead. It is also necessary to include the above numbers in quotes. It will not work otherwise.

I tested on 16.04 LTS.

Solution 4:

To be able to set which boot option to use as default you need to know what there is... so:

To display the menu entries without actually booting, try something like:

$ lsb_release -s -rdc
Ubuntu 16.04.4 LTS
16.04
xenial

$ update-grub --version
grub-mkconfig (GRUB) 2.02~beta2-36ubuntu3.17

$ grep -Ei 'submenu|menuentry ' /boot/grub/grub.cfg | sed -re "s/(.? )'([^']+)'.*/\1 \2/"
menuentry  Ubuntu
submenu  Advanced options for Ubuntu
    menuentry  Ubuntu, with Linux 4.4.0-34-generic
    menuentry  Ubuntu, with Linux 4.4.0-34-generic (upstart)
    menuentry  Ubuntu, with Linux 4.4.0-34-generic (recovery mode)
menuentry  System setup