[Forward Content] Kernel Installation Tutorial
Tofloor
poster avatar
SuperDavid
deepin
2024-09-19 10:41
Author

[Tutorials] Kernel Installation Tutorial: Viewing, Installing, and Uninstalling Local Kernels from the Repository

1. Viewing Available Kernels in the Repository

It is recommended to use:

sudo apt search linux-image-*

This search method provides a more comprehensive list of kernels and is easier to understand.

It is not recommended to use:

sudo apt search linux-image-deepin-*

This search yields fewer results, and the output may not be as easy to understand.

If, after adding the testing repository, you find that the number of available kernels has not increased, run:

sudo apt-get update

to update the repository information, and then check the available kernels again.


2. Installing Kernels from the Repository

Note: The headers and image files need to be replaced with the specific kernel you want to install, which you can copy from the list in the terminal, separating them with a space.

Format for installation:

sudo apt update && sudo apt install linux-image- linux-headers-

Example 1: Installing a kernel without a suffix:

sudo apt update && sudo apt install linux-image-6.2.1 linux-headers-6.2.1

Example 2: Installing a kernel with a suffix:

sudo apt install linux-image-5.18.17-amd64-desktop-hwe linux-headers-5.18.17-amd64-desktop-hwe


3. Rebooting and Verifying the Installed Kernel Version

After installation, reboot the system and check whether the kernel is correctly installed by running:

uname -r

or

uname -a


4. Uninstalling Unnecessary Kernels

  1. First, check the current kernel version to avoid accidentally uninstalling the kernel in use:

uname -r

or

uname -a

  1. List all installed kernels:

dpkg -l | grep "linux-image\|linux-headers"

or

dpkg --get-selections | grep linux

  1. Select the unwanted kernel for uninstallation.

Note: The headers and image files need to be replaced with the specific kernel you want to uninstall, which you can copy from the list in the terminal, separating them with a space.

Format for uninstallation:

sudo apt purge linux-image- linux-headers-

Example 1: Uninstalling a kernel with a suffix:

sudo apt purge linux-image-5.18.4-amd64-desktop-hwe linux-headers-5.18.4-amd64-desktop-hwe

Example 2: Uninstalling a kernel without a suffix:

sudo apt purge linux-image-6.1.12 linux-headers-6.1.12

Reply Favorite View the author
All Replies

No replies yet