[Forward Content] Kernel Installation Tutorial
Tofloor
default avatar
SuperDavid
deepin
2024-09-19 02: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:

<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

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

<span>uname -r</span>

or

<span>uname -a</span>

  1. List all installed kernels:

<span>dpkg -l | grep "linux-image\|linux-headers"</span>

or

<span>dpkg --get-selections | grep linux</span>

  1. Select the unwanted kernel for uninstallation.

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>

Reply Favorite View the author
All Replies

No replies yet

New Thread

Popular Events

More
国际排名
WHLUG