How to delete extra kernels in Ubuntu

How to delete extra kernels in Ubuntu

Step 1: View the current kernel

rew $ uname -a
Linux 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

The current version is: 4.15.0-42-generic

Step 2: View all kernels

rew $ dpkg --get-selections | grep linux
console-setup-linux install
libselinux1:amd64 install
libselinux1:i386 install
linux-base install
linux-firmware install
linux-generic-hwe-16.04 install
linux-headers-4.15.0-42 install
linux-headers-4.15.0-39 install
linux-headers-4.15.0-39-generic install
linux-headers-4.15.0-42-generic install
linux-headers-generic-hwe-16.04 install
linux-image-4.15.0-39-generic install
linux-image-4.15.0-42-generic install
linux-image-generic-hwe-16.04 install
linux-libc-dev:amd64 install
linux-libc-dev:i386 install
linux-modules-4.15.0-39-generic install
linux-modules-4.15.0-42-generic install
linux-modules-extra-4.15.0-39-generic install
linux-modules-extra-4.15.0-42-generic install
linux-sound-base install
pptp-linux install
syslinux install
syslinux-common install
syslinux-legacy install
util-linux install

Step 3: Remove redundant kernels

All 39 versions are redundant for me, 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

Recheck after uninstalling:

rew $ dpkg --get-selections | grep linux
console-setup-linux install
libselinux1:amd64 install
libselinux1:i386 install
linux-base install
linux-firmware install
linux-generic-hwe-16.04 install
linux-headers-4.15.0-42 install
linux-headers-4.15.0-42-generic install
linux-headers-generic-hwe-16.04 install
linux-image-4.15.0-39-generic deinstall
linux-image-4.15.0-42-generic install
linux-image-generic-hwe-16.04 install
linux-libc-dev:amd64 install
linux-libc-dev:i386 install
linux-modules-4.15.0-39-generic deinstall
linux-modules-4.15.0-42-generic install
linux-modules-extra-4.15.0-39-generic deinstall
linux-modules-extra-4.15.0-42-generic install
linux-sound-base install
pptp-linux install
syslinux install
syslinux-common install
syslinux-legacy install
util-linux install

The status is deinstall, which means it has been uninstalled. If you feel uncomfortable with it, you can use purge to completely delete it including 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 system boot

After deleting the kernel, you need to update grub to remove invalid boot items

rew $ sudo update-grub #Select grub/grub2 according to the situation

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Ubuntu 16.04 kernel upgrade steps
  • Ubuntu Android source code and kernel download and compilation
  • Adding Hardware Abstraction Layer (HAL) module to access Linux kernel driver for Android in Ubuntu
  • Implementing a built-in C executable program in Ubuntu to test the Linux kernel driver for Android
  • How to write Linux kernel driver for Android system in Ubuntu
  • Download, compile and install Android kernel source code on Ubuntu
  • Detailed explanation of the implementation process of building a kernel tree in Ubuntu 12.04

<<:  The implementation process of long pressing to identify QR code in WeChat applet

>>:  JavaScript to implement image preloading and lazy loading

Recommend

Solve the problem of not finding NULL from set operation to mysql not like

An interesting discovery: There is a table with a...

jQuery plugin to implement minesweeper game (2)

This article shares the second article of using j...

Solution to MySQL master-slave delay problem

Today we will look at why master-slave delay occu...

Solution to invalid margin-top of elements in div tags

Just as the title says. The question is very stran...

How to write the introduction content of the About page of the website

All websites, whether official, e-commerce, socia...

HTML+CSS to achieve charging water drop fusion special effects code

Table of contents Preface: accomplish: Summarize:...

Detailed explanation of Vue project packaging

Table of contents 1. Related configuration Case 1...

ES6 loop and iterable object examples

This article will examine the ES6 for ... of loop...

Summary of Mysql high performance optimization skills

Database Command Specification All database objec...

Detailed explanation of Excel parsing and exporting based on Vue

Table of contents Preface Basic Introduction Code...

Vue3 gets the current routing address

Correct answer Using useRouter : // router path: ...

Complete MySQL Learning Notes

Table of contents MyISAM and InnoDB Reasons for p...

Problems installing TensorRT in docker container

Uninstall the installed version on Ubuntu: sudo a...