Several Methods to remove the old version of Ubuntu 16.04 Kernel
When LVM, encryption, or disk storage space is enabled, You can regularly or manually delete Linux kernels that are not used in earlier versions to prevent insufficient space for/boot partitions. It is very easy to remove the old Linux Kernel in Ubuntu 16.04. You can perform manual operations or use unattended-upgrades for automatic execution. The following describes the operation steps in detail.
Automatically remove old versions of Ubuntu 16.04 Kernel
1. Run the following command to automatically remove the old kernel and software packages that are no longer needed by the Ubuntu 16.04 system:
sudo apt autoremove --purge
2. Execute the following command on the terminal to enable the unattended upgrade (Ubuntu 16.04 is enabled by default ):
sudo dpkg-reconfigure unattended-upgrades
3. Use vi or nano to change the Unattended-Upgrade: Remove-Unused-Dependencies "false" in the/etc/apt. conf. d/50unattended-upgrades configuration file to true.
Semi-automatic removal of earlier versions of Ubuntu 16.04 Kernel
If you have installed the latest Kernel from the Kernel PPA or manually compiled Kernel, The purge-old-kernels script is the best way to clear old Kernel versions.
1. Run the following command to install the byobu package:
sudo apt install byobu
2. Execute the following command periodically:
sudo purge-old-kernels
Manually remove old versions of Ubuntu 16.04 Kernel
If your/boot partition is full, you cannot use apt to upgrade, install, and remove software packages and related dependencies. You can use the dpkg command to perform operations manually:
1. view the current Kernel version:
uname -r
2. List all other kernel versions excluding the current kernel version:
dpkg -l | tail -n +6| grep -E 'linux-image-[0-9]+'| grep -Fv $(uname -r)
The output may include the following three States of the kernel image:
- Rc: indicates that the object has been removed.
- Ii: indicates that the removal condition is met (removable)
- IU: has entered the apt installation queue, but has not been installed (cannot be removed ).
3 For example, to remove the old linux-image-4.4.0-21-generic kernel in the state of ii, you can use the following command:
sudo dpkg --purge linux-image-4.4.0-21-generic
Ubuntu 16.04 LTS was officially released and downloaded for 5 years of technical support
Ubuntu 16.04 USB flash drive installation graphic tutorial
15 things to be configured after installing Ubuntu 16.04 LTS
Ubuntu 16.04 LTS released Canonical today to announce new system features
Upgrade Ubuntu 15.10 To Ubuntu 16.04
Install Lua game engine in Ubuntu 16.04
How to Use the Snap package for Ubuntu 16.04 LTS
Ubuntu 16.04 requires your help to make GNOME Software more beautiful