Remove old kernel on Ubuntu

Over time the system is installed, a new kernel update, delete the old kernel does not automatically result in insufficient boot disk space, clean up once before, recently filled, and spent time search command, and then later turn into easy viewing here.

Viewing System Version:

sun@sun-pc:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.5 LTS
Release:	16.04
Codename:	xenial

Check kernel version: uname -a

sun@sun-pc:~$  uname -a 
Linux sun-pc 4.15.0-33-generic #36~16.04.1-Ubuntu SMP Wed Aug 15 17:21:05 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

                            cat /proc/version

sun@sun-pc:~$ cat /proc/version
Linux version 4.15.0-33-generic (buildd@lgw01-amd64-010) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)) #36~16.04.1-Ubuntu SMP Wed Aug 15 17:21:05 UTC 2018

In Ubuntu kernel image contains the following package.

  • Image--Linux : the kernel image
  • Image-extra--Linux : additional kernel modules
  • headers--Linux : kernel headers

Viewing the kernel:

dpkg --get-selections | grep linux
sudo apt-get purge linux-image-3.19.0-{18,20,21,25}
sudo apt-get purge linux-headers-3.19.0-{18,20,21,25}
sudo apt-get purge linux-modules-4.15.0-{29,30,32}

If for any reason GRUB configuration is not properly upgraded after deleting the old kernel, you can try to manually update the configuration with update-grub2 command.

sudo update-grub2

Restart the computer

sudo shutdown -r now

Reference Links: https://blog.csdn.net/david_xtd/article/details/18888409

https://linux.cn/article-6245-1.html

Guess you like

Origin blog.csdn.net/qq_30460905/article/details/82077974