[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:
<span>sudo apt search linux-image-*</span>
This search method provides a more comprehensive list of kernels and is easier to understand.
It is not recommended to use:
<span>sudo apt search linux-image-deepin-*</span>
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:
<span>sudo apt-get update</span>
to update the repository information, and then check the available kernels again.
2. Installing Kernels from the Repository
Note: The <span>headers</span> and <span>image</span> 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.
Note: The <span>headers</span> and <span>image</span> 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.
[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:
<span>sudo apt search linux-image-*</span>
This search method provides a more comprehensive list of kernels and is easier to understand.
It is not recommended to use:
<span>sudo apt search linux-image-deepin-*</span>
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:
<span>sudo apt-get update</span>
to update the repository information, and then check the available kernels again.
2. Installing Kernels from the Repository
Note: The
<span>headers</span>
and<span>image</span>
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:
<span>sudo apt update && sudo apt install linux-image-<version> linux-headers-<version></span>
Example 1: Installing a kernel without a suffix:
<span>sudo apt update && sudo apt install linux-image-6.2.1 linux-headers-6.2.1</span>
Example 2: Installing a kernel with a suffix:
<span>sudo apt install linux-image-5.18.17-amd64-desktop-hwe linux-headers-5.18.17-amd64-desktop-hwe</span>
3. Rebooting and Verifying the Installed Kernel Version
After installation, reboot the system and check whether the kernel is correctly installed by running:
<span>uname -r</span>
or
<span>uname -a</span>
4. Uninstalling Unnecessary Kernels
<span>uname -r</span>
or
<span>uname -a</span>
<span>dpkg -l | grep "linux-image\|linux-headers"</span>
or
<span>dpkg --get-selections | grep linux</span>
Note: The
<span>headers</span>
and<span>image</span>
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:
<span>sudo apt purge linux-image-<version> linux-headers-<version></span>
Example 1: Uninstalling a kernel with a suffix:
<span>sudo apt purge linux-image-5.18.4-amd64-desktop-hwe linux-headers-5.18.4-amd64-desktop-hwe</span>
Example 2: Uninstalling a kernel without a suffix:
<span>sudo apt purge linux-image-6.1.12 linux-headers-6.1.12</span>