hamwaves.com
;

GRUB: Changing the Default Kernel

Serge Y. Stroobandt

Copyright 2013–2016, licensed under Creative Commons BY-NC-SA

  1. Home
  2. Information Technology
  3. Desktop Systems
  4. Changing Default Kernel

Introduction

GNU GRUB (short for GNU GRand Unified Bootloader) is the boot loader of most GNU/Linux distributions. It gives a user the choice to boot one of multiple operating systems or select a specific kernel configuration available on a disk partition of the computer system.

Now, suppose you just upgraded your rolling release GNU/Linux distribution. The upgrade also included a new version of the Linux kernel. By default, GRUB will choose the latest kernel to boot after its menu time-out.

Occasionally, a new kernel might break a custom-installed package that does not belong to the standard repositories. Furthermore, it might be that you cannot or do no want to solve this issue straight away. More importantly, you do not want to disrupt the daily routine of other users whilst you are figuring things out. As long as you have not removed the older version of the kernel, you could configure GRUB to boot with that older kernel by default. Here is how it is done.

Start counting from zero

Edit /etc/default/grub with administrative privileges:

$ sudo nano /etc/default/grub

Look for the line containing GRUB_DEFAULT=0. Change the number knowing that computers always count starting from zero. In this case, zero corresponds to the latest kernel.

Don’t forget to update-grub

After editing the above configuration file, do not forget to run update-grub to cause an update of /boot/grub/grub.cfg.

$ sudo update-grub

That is all. Now you can sit back and solve the broken package issue in a relaxed way, perhaps even remotely via OpenSSH. By the way, full details of the options that are available in the /etc/default/grub configuration file can be obtained by typing:

$ info -f grub -n 'Simple configuration'

or, more conveniently, by clicking this link.

5
Creative Commons Licence
This work is licensed under a Creative Commons Attribution‑NonCommercial‑ShareAlike 4.0 International License.
Other licensing available on request.
GNU GPL v3
Unless otherwise stated, all originally authored software on this site is licensed under the terms of GNU GPL version 3.
cookie
This static web site has no backend database.
Hence, no personal data is collected and GDPR compliance is met.
Moreover, this domain does not set any first party cookies.

All Google ads shown on this web site are, irrespective of your location,
restricted in data processing to meet compliance with the CCPA and GDPR.
However, Google AdSense may set third party cookies for traffic analysis and
use JavaScript to obtain a unique set of browser data.
Your browser can be configured to block third party cookies.
Furthermore, installing an ad blocker like EFF's Privacy Badger
will block the JavaScript of ads.
Google's ad policies can be found here.
This page employs a Python Bottle server‑side script.
This page includes an open-source client-side script, written in Python and
transcoded by Brython to make it run as secure JavaScript in the browser.
Static XHTML generated from Markdown by Pandoc and
the GNU/Linux make, sed and gpp commands.
LaTeXmath markup rendered with MathJax.
BibTeX references are best read with JabRef.
Unattended CSS typesetting with Prince.
This work is published at https://hamwaves.com/grub-default/en/.
profile for Serge Stroobandt on Stack Exchange, a network of free, community-driven Q&A sites
GnuPG
Use my OpenPGP public key to encrypt messages for:

echo c2VyZ2VAc3Ryb29iYW5kdC5jb20K |base64 -d
Last update: Wednesday, September 1, 2021.