> Source: https://meetrix.io/blogs/change-default-kernel-ubuntu/
> Markdown copy of that page. Cite the URL above, not this file.

Development

# Ubuntu Set Default Kernel: How to Change Kernel in Linux with GRUB

[By Buddhika Jayawardhana](https://meetrix.io/blogs/authors/buddhika-jayawardhana/) • September 15, 2026 • 5 min read

There are good reasons to pin a kernel. A driver or kernel module your software depends on only builds against one version. A new kernel introduced a regression. A vendor certified their product on a specific release. Whatever the reason, Ubuntu will happily install a newer kernel on the next upgrade and boot into it, so you have to tell GRUB what you want.

This guide was first written in 2018 for Ubuntu 16.04 on EC2. The approach still works, but the commands have been updated for 22.04, 24.04 and 26.04, and it now uses a safer way to test a kernel on a server you can't reach if boot fails.

## Ubuntu 22.04 default kernel version, and what you are running

```bash
uname -r
dpkg --list 'linux-image-*' | grep ^ii
```

The first command shows the running kernel, the second lists every kernel installed. For reference, these are the kernels each release shipped with (Canonical's [kernel lifecycle page](https://ubuntu.com/kernel/lifecycle) has the full HWE schedule):

| Release | GA kernel | Notes |
| --- | --- | --- |
| Ubuntu 22.04 | 5.15 | HWE track moves to newer kernels, ending at 6.8 |
| Ubuntu 24.04 | 6.8 | HWE track follows later interim releases |
| Ubuntu 26.04 | 7.0 | Newest LTS |

On cloud instances the running kernel is usually a provider flavour, such as `6.8.0-1021-aws` rather than `-generic`. That matters later.

## Install the kernel version you want

If the kernel you want isn't in the list yet, install it. The standard kernel metapackage:

```bash
sudo apt update
sudo apt install -y linux-generic
```

Or a specific version, if it is still in the archive:

```bash
apt-cache search linux-image-6.8.0 | grep generic | tail -5
sudo apt install -y linux-image-6.8.0-45-generic linux-modules-extra-6.8.0-45-generic
```

The version numbers here are examples; use one from the search output. The old guide installed `linux-image-extra-virtual`, a 16.04-era package that current releases don't use.

## Ubuntu choose kernel from the GRUB menu entries

Before touching anything, back up the GRUB defaults and list the menu entries by name (the [GNU GRUB manual](https://www.gnu.org/software/grub/manual/grub/grub.html) explains the naming rules if your menu looks different):

```bash
sudo cp /etc/default/grub /etc/default/grub.bak
grep -E "(menuentry|submenu) " /boot/grub/grub.cfg | cut -d "'" -f2
```

You will see something like this:

```plaintext
Ubuntu
Advanced options for Ubuntu
Ubuntu, with Linux 6.8.0-1021-aws
Ubuntu, with Linux 6.8.0-1021-aws (recovery mode)
Ubuntu, with Linux 6.8.0-45-generic
Ubuntu, with Linux 6.8.0-45-generic (recovery mode)
```

Specific kernels live inside the **Advanced options for Ubuntu** submenu. GRUB addresses them as the submenu title, a `>`, then the entry title, all in one string:

```plaintext
Advanced options for Ubuntu>Ubuntu, with Linux 6.8.0-45-generic
```

The 2018 version of this guide used the long `gnulinux-...` IDs instead of titles. Those work too, but titles are readable and survive being copied into a ticket.

## Ubuntu switch kernel for one boot to test it

On a server you can only reach over SSH, never make an untested kernel the permanent default. If it doesn't boot, you have no console to pick another one. Boot it once instead:

```bash
sudo sed -i 's/^GRUB_DEFAULT=.*/GRUB_DEFAULT=saved/' /etc/default/grub
sudo update-grub
sudo grub-reboot "Advanced options for Ubuntu>Ubuntu, with Linux 6.8.0-45-generic"
sudo reboot
```

`grub-reboot` sets the kernel for the next boot only. If the machine comes back, check `uname -r`. If it doesn't, a plain reboot from your cloud console returns it to the previous default, and you have lost nothing.

## Ubuntu change default kernel permanently

Once the test boot works, save it as the default:

```bash
sudo grub-set-default "Advanced options for Ubuntu>Ubuntu, with Linux 6.8.0-45-generic"
sudo reboot
```

### Ubuntu GRUB set default kernel in the config file

Because `GRUB_DEFAULT=saved` is already set, no `update-grub` is needed for the command above. If you would rather keep the choice visible in the config file, put the full string directly in `/etc/default/grub` as `GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 6.8.0-45-generic"` and run `sudo update-grub`.

To stop the next upgrade from pulling in a newer kernel and making you do this again, hold the kernel metapackages:

```bash
sudo apt-mark hold linux-generic linux-image-generic linux-headers-generic
```

Held kernels stop getting security fixes

A held kernel is a kernel that no longer receives patches. Hold only for as long as the reason for pinning exists, and write down why, so someone runs `apt-mark unhold` later instead of discovering a two-year-old kernel during an audit.

## Cloud images and EC2

Two things behave differently on AWS, GCP and other cloud images.

**Files in `/etc/default/grub.d/` override `/etc/default/grub`.** Ubuntu cloud images ship settings there, and anything defined in those files wins because they are read afterwards. If your change seems ignored, check them:

```bash
grep -r GRUB_DEFAULT /etc/default/grub /etc/default/grub.d/
```

**Provider kernels exist for a reason.** The `-aws` kernel carries drivers and tuning for EC2's networking and storage. Switching an EC2 instance to `-generic` usually works, but test the network throughput and the EBS volume performance after the switch, and keep the provider kernel installed so you can go back. If you run workloads like [a Jitsi Meet videobridge](https://meetrix.io/blogs/install-jitsi-meet-ubuntu/) or a [Kurento media server](https://meetrix.io/blogs/install-kurento-media-server-ubuntu/), where network performance is the whole point, stay on the provider kernel unless you have a specific reason not to.

When a server needs a specific kernel for every future instance, bake it into an image rather than repeating these steps each time. [AWS VM Import/Export](https://meetrix.io/blogs/aws-vm-import-export/) covers bringing a locally built VM into EC2, and [installing the AWS CLI](https://meetrix.io/blogs/install-aws-cli/) is the prerequisite for most of that tooling.

## Frequently Asked Questions

How do I change kernel in Linux?

On Ubuntu and Debian: install the kernel, find its GRUB menu entry, boot it once with grub-reboot, then make it permanent with grub-set-default. RHEL, Rocky and Fedora use grubby --set-default instead of editing GRUB entries by name.

What is the default kernel version in Ubuntu 22.04?

Ubuntu 22.04 shipped with the 5.15 GA kernel. Systems on the hardware enablement (HWE) track move to newer kernels, ending with 6.8 from Ubuntu 24.04. uname -r shows the one you are running, and cloud images often use a provider flavour such as -aws.

What was the default kernel in Ubuntu 16.04?

Ubuntu 16.04 shipped with Linux 4.4, and its HWE track ended on 4.15. The release left standard support in April 2021, so on a 16.04 server upgrading the whole release matters far more than choosing a kernel.

How do I boot an older kernel just once?

Set GRUB\_DEFAULT=saved in /etc/default/grub and run update-grub once. Then sudo grub-reboot with the menu entry name boots that kernel on the next restart only, and falls back to the saved default after. It is the safe way to test on a remote server.

Why does my GRUB\_DEFAULT change have no effect?

Either update-grub was not run afterwards, or a file in /etc/default/grub.d/ sets the same variable and overrides it, which is common on cloud images. Also check that the menu entry text matches exactly, including the 'Advanced options for Ubuntu>' submenu prefix.

How do I stop Ubuntu from upgrading my chosen kernel?

Hold the metapackage that pulls in new kernels, for example sudo apt-mark hold linux-generic linux-image-generic, or the -aws variants on EC2. Remember to unhold it later, because held kernels stop receiving security fixes.

What happened to linux-image-extra-virtual?

It was a package from the Ubuntu 16.04 era that added extra driver modules to the virtual kernel. Current releases do not use it. Install linux-generic for the standard kernel, or linux-generic-hwe- for the hardware enablement track.

Meetrix Store

Pre-configured open source images for AWS and Google Cloud.

[Browse products](https://meetrix.io/store/)

Meetrix Store New

One-click deploys on AWS and Google Cloud.

-    [Jitsi Meet Self-hosted video calls for 50 to 500 users](https://meetrix.io/store/jitsi-meet/)
-    [RustDesk Remote desktop AMI, a TeamViewer alternative](https://meetrix.io/store/rustdesk/)
-    [Coturn TURN/STUN for WebRTC, no per-minute relay fees](https://meetrix.io/store/coturn/)
-    [Plane Issues, cycles and roadmaps, a Jira alternative](https://meetrix.io/store/plane/)
-    [Mailcow Business email on your own domain](https://meetrix.io/store/mailcow/)
-    [Listmonk Newsletters with no per-subscriber fees](https://meetrix.io/store/listmonk/)

[Browse all products](https://meetrix.io/store/)
