Article directory
1. Download the specified kernel
1.1 View the current kernel
Use uname -a
the command to know that the current kernel is 5.4.0-149-generic
, and install the specified kernel as needed.5.4.0-139-generic
uname -a
Linux adyonggan-u01 5.4.0-149-generic #156~18.04.1-Ubuntu SMP Wed Jan 25 15:56:22 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
1.2 Download the kernel
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install linux-image-5.4.0-139-generic linux-headers-5.4.0-139-generic linux-modules-extra-5.4.0-139-generic
Installing the specified version can Tab
be completed by:
**-generic
It is a generic (generic) kernel image package, which is optimized for a wide range of hardware and uses, uses standard CPU scheduling policies, and is suitable for most conventional desktop and server applications.**-lowlatency
It is a low-latency (lowlatency) kernel image package, the goal is to reduce system response time and I/O delay, especially suitable for real-time audio/video processing and other applications that require high low-latency response.
PS: Note that the low-latency kernel may have a certain impact on the overall performance of the system, because it performs scheduling switching more frequently to provide higher real-time performance.**-image-**
It is a kernel image package for a specific kernel version. It is a file containing the operating system kernel and is the core component for starting and running the operating system.**-headers-**
Contains kernel header files associated with a specific kernel version.**-modules-extra-**
It is a loadable kernel component that contains additional kernel modules to support specific hardware devices, file systems, or other functions.
2. Switch the designated kernel
2.1 Modify grub configuration file
If there is a grub option when the computer starts, ignore this step. This step is for the system to enter Ubuntu directly. Use sudo vim /etc/default/grub
edit grub configuration, modified as follows:
GRUB_DEFAULT="gnulinux-advanced-c64beb92-0ea7-498d-bcf9-47c29cc9c45e>gnulinux-5.4.0-149-generic-advanced-c64beb92-0ea7-498d-bcf9-47c29cc9c45e"
#GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=3
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
in:
- GRUB_TIMEOUT_STYLE means setting the display mode of the boot menu. Hidden means hiding the boot menu after the countdown is over, and only displays the background during the waiting time without displaying menu options.
- GRUB_TIMEOUT indicates that the boot menu display time is specified, in seconds. In this example, the boot menu will be displayed for 3 seconds and then the default boot entry will be automatically selected. If the user does not make a selection within 3 seconds, the default boot item will be automatically launched.
Save and exit the grub configuration file, use itsudo update-grub
to take effect, and then restart the computer.
2.2grub switching kernel
After restarting the computer, grub界面选ubuntu的高级选项
select the specified kernel installed to enter the system and determine whether the kernel version has been changed.
uname -r
5.4.0-139-generic
3. Delete the specified kernel
3.1 View the current kernel
uname -r
3.2 View all cores
dpkg --get-selections | grep linux
3.3 Delete the specified kernel
Delete herelinux-5.6.16-050616-generic
sudo apt-get remove *5.6.16-050616*
3.4 Review the kernel
Use dpkg --get-selections | grep linux
the command to see that linux-5.6.16
the status is deinstall, which means it has been uninstalled.
3.5 Delete specified kernel configuration items
Delete herelinux-5.6.16-050616-generic
sudo apt-get purge *5.6.16-050616*
3.6 Review the kernel
dpkg --get-selections | grep linux