How to delete redundant 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 1913:02:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

The currently used version is: 4.15.0-42-generic

Step 2: View all cores

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 cores

All 39 versions are redundant to 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

Check again 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

If the status is deinstall, it has been uninstalled. If you feel uncomfortable, you can use purge to delete the configuration file and clean 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, grub needs to be updated to remove invalid startup items

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

The above is the whole content of this article, I hope it will be helpful to everyone's study.

Recommended Posts

How to delete redundant kernels in Ubuntu
How to delete redundant kernels in Ubuntu
How to use hanlp in ubuntu
How to install mysql in Ubuntu 14.04
How to install mysql in Ubuntu 14.04
How to add swap partition in Ubuntu
How to easily compile openJDK in Ubuntu
How to install cuda10.1 driver in Ubuntu
How to add users to Sudoers in Ubuntu
How to install ROS Noetic in Ubuntu20.04
How to set static IP in ubuntu14.04
How to modify software source in Ubuntu 7.10
How to open root account in Ubuntu20.04
How to hide applications in Ubuntu Dash?
How to upgrade to Ubuntu 20.04
How to upgrade to Ubuntu 20.04
How to modify time zone and time in ubuntu
How to configure TensorFlow use environment in Ubuntu
How to install python in ubuntu server environment
How to use dpkg command in Ubuntu system
How to open the ubuntu system in win10
How to delete files and directories in python
How to configure /var/log/messages in Ubuntu system log
How to install Hadoop in standalone mode on Ubuntu 18.04
How to view detailed network routing table in Ubuntu
How to use Putty to log in to ubuntu installed in VirtualBox
How to modify time zone and time in ubuntu system
Example of how to modify ip address in Ubuntu20.04
How to create a Python virtual environment in Ubuntu 14.04
How to upgrade to Ubuntu 16.04 LTS
How to control the ubuntu system in win10 through ssh
How to install memcache and start it in ubuntu environment
How to compile and install PHP and Nginx in Ubuntu environment
How to map shared disk to window in linux under Ubuntu
How to install Ruby on Ubuntu 20.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install VirtualBox on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Apache on Ubuntu 20.04
How to install Git on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
How to wrap in python code
How to install PHP7.4 in CentOS
How to install Vagrant on Ubuntu 20.04
How to install Bacula-Web on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to compile ijkplayer-android under ubuntu
How to install Anaconda3 on Ubuntu 18.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install MemSQL on Ubuntu 14.04
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install Mailpile on Ubuntu 14.04
How to install PrestaShop on Ubuntu 16.04