Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to delete redundant kernels in Ubuntu

Shulou Source: shulou.com Published: 2022-06-01 21:24:20 11月15日 Update

How to remove redundant kernel in Ubuntu? Many novices are not very clear about this. In order to help you solve this problem, the following small series will explain it in detail for everyone. Those who have this need can come to learn. I hope you can gain something.

Step 1: View the current kernel

rew $ uname -aLinux rew 4.15.0-42-generic #45~16.04.1-Ubuntu SMP Mon Nov 19 13:02:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Current version: 4.15.0-42-generic

Step 2: View all kernels

rew $ dpkg --get-selections | grep linuxconsole-setup-linux installlibselinux1:amd64 installlibselinux1:i386 installlinux-base installlinux-firmware installlinux-generic-hwe-16.04 installlinux-headers-4.15.0-42 installlinux-headers-4.15.0-39 installlinux-headers-4.15.0-39-generic installlinux-headers-4.15.0-42-generic installlinux-headers-generic-hwe-16.04 installlinux-image-4.15.0-39-generic installlinux-image-4.15.0-42-generic installlinux-image-generic-hwe-16.04 installlinux-libc-dev:amd64 installlinux-libc-dev:i386 installlinux-modules-4.15.0-39-generic installlinux-modules-4.15.0-42-generic installlinux-modules-extra-4.15.0-39-generic installlinux-modules-extra-4.15.0-42-generic installlinux-sound-base installpptp-linux installsyslinux installsyslinux-common installsyslinux-legacy installutil-linux install

Step 3: Remove redundant kernels

All 39 versions are redundant to me, so delete them:

rew $ sudo apt-get remove \linux-headers-4.15.0-39 \linux-headers-4.15.0-39-generic \linux-image-4.15.0-39-generic \linux-modules-4.15.0-39-generic \linux-modules-extra-4.15.0-39-generic

Check again after unloading:

rew $ dpkg --get-selections | grep linuxconsole-setup-linux installlibselinux1:amd64 installlibselinux1:i386 installlinux-base installlinux-firmware installlinux-generic-hwe-16.04 installlinux-headers-4.15.0-42 installlinux-headers-4.15.0-42-generic installlinux-headers-generic-hwe-16.04 installlinux-image-4.15.0-39-generic deinstalllinux-image-4.15.0-42-generic installlinux-image-generic-hwe-16.04 installlinux-libc-dev:amd64 installlinux-libc-dev:i386 installlinux-modules-4.15.0-39-generic deinstalllinux-modules-4.15.0-42-generic installlinux-modules-extra-4.15.0-39-generic deinstalllinux-modules-extra-4.15.0-42-generic installlinux-sound-base installpptp-linux installsyslinux installsyslinux-common installsyslinux-legacy installutil-linux install

The status is deinstall, that is, it has been uninstalled. If you feel uncomfortable looking at it, you can use purge to delete it completely together with the configuration file and clean up the kernel list.

rew $ sudo apt-get purge \linux-headers-4.15.0-39 \linux-headers-4.15.0-39-generic \linux-image-4.15.0-39-generic \linux-modules-4.15.0-39-generic \linux-modules-extra-4.15.0-39-generic

Step 4: Update the system boot

Grub needs to be updated after kernel deletion to remove invalid startup entries

rev $ sudo update-grub #Select grub/grub2 according to the situation. Is it helpful to read the above? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.

Tags: Kernel version help update clear comfortable content redundancy this situation document article novice more status knowledge system industry information information channel Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Linux Apple macOS OPPO Reno