Home  >  Article  >  System Tutorial  >  How to boot to the old kernel of a Linux system by default

How to boot to the old kernel of a Linux system by default

PHPz
PHPzforward
2024-02-11 15:30:18917browse

An older reader encountered this problem. New kernel updates in Linux Mint are not working as expected. Booting into an older kernel "fixed" the problem, but was troublesome in having to manually select the older kernel every time I booted. How to do it? That's what I'm going to show you in this tutorial.

如何默认启动到 Linux 系统的旧内核
This is a possible scenario. Your system received a kernel update, but somehow, things aren't going as smoothly as before.

You realize that if you boot into an older kernel (yes, you can downgrade the kernel), everything will go back to normal.

You will feel a little uncomfortable even though you are happy. Because you have to manually select the older kernel on every boot.

An older reader encountered this problem. New kernel updates in Linux Mint are not working as expected. Booting into an older kernel "fixed" the problem, but was troublesome in having to manually select the older kernel every time I booted.

It is not a good idea to remove the new kernel and use the old kernel, because the new kernel will be installed and used during the next system update.

Therefore, I recommend setting it to boot into an older Linux kernel by default. How to do it? That's what I'm going to show you in this tutorial.

Booting to an older Linux kernel
You may not know it, but your Linux distribution installs multiple Linux kernels on your system. Do not believe? Use the following command to list the installed kernels in Ubuntu:

apt list --installed | grep linux-image

When you upgrade your system, you will get a new version of the kernel. At this time, your system will automatically choose to boot to the latest available kernel.

In the grub screen you can go to Advanced option (older Linux versions):

如何默认启动到 Linux 系统的旧内核
ubuntu grub

Here you can see the available kernels to boot. Select the older one (entry without recovery option):
如何默认启动到 Linux 系统的旧内核
grub advanced options

You won't notice any difference in display. Your files and applications remain intact.

Now that you have booted into the old kernel, it is time to have your system automatically boot into it.

Make the old kernel the default startup item
If you're happy using a Linux terminal and commands, you can modify the /etc/default/grub file and add the following lines to it:

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

Then use the following command to update GRUB:

sudo update-grub

What you are doing here is telling your system to save the currently used startup entry as the default startup entry for future runs of GRUB.

However, not everyone is good with the command line, so I will focus on a GUI tool called Grub Customizer.

Install Grub Customizer
Install Grub Customizer on Ubuntu-based distributions using the official PPA:

sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt update
sudo apt install grub-customizer

For other distributions, please use your package manager to install this tool.

Use Grub Customizer to change the default startup items
When you run Grub Customizer, it displays available startup items.
如何默认启动到 Linux 系统的旧内核
Here you have two options.

Option one: Select the desired kernel item and move it up using the arrow buttons (shown on the top menu).
如何默认启动到 Linux 系统的旧内核
Moving old kernel up in Ubuntu grub

Option 2: Set the previously booted entry as the default entry.
如何默认启动到 Linux 系统的旧内核
I recommend using the second option as it will work even with new kernel updates.

This way you can downgrade the kernel in Ubuntu or other distributions without even removing the new kernel version.

Please note that most distributions like Ubuntu only maintain two kernel versions at a time. Therefore, eventually your preferred old kernel will be removed when a new kernel version is released.

This clever trick has helped me get out of trouble. At the time I was installing the latest Linux kernel in Ubuntu and for some reason it had some compatibility issues with my audio system.

Whatever the reason, you now know how to automatically boot into the old kernel.

The above is the detailed content of How to boot to the old kernel of a Linux system by default. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:lxlinux.net. If there is any infringement, please contact admin@php.cn delete