Disk Usage Analyzer shows 4.4.0-45 and 4.4.0-47 under /lib/modules, why is that? Is it needed to have two kernels or has the old one stayed after an update? Is it safe to remove the older kernel?
5 Answers
It is common to keep one older kernel version around in case the new one breaks.
The previous version is available on grub's Advanced Options menu.
Kernels that Ubuntu automatically installs can be automatically removed by using:
sudo apt autoremove
This removes older kernels (that Ubuntu automatically installed) but keeps the current version and the one before it.
When you manually install kernels (often necessary to get new hardware support or address a certain "glitch" you have) you need to manually remove them.
- 105,762
The kernel version 4.4.0-47 is the latest update of the kernel released by Canonical Kernel Team.
You can purge the old kernel from the command line using purge-old-kernels tool.
To install it run:
sudo apt-get install bikeshed
To keep the latest kernel and purge old kernel:
sudo purge-old-kernels --keep 1
The two directories exist because kernel modules built for kernel 4.4.0-45 aren't compatible with kernel modules built for kernel 4.4.0-47.
Deleting kernels is difficult, especially for noobs. It's too easy to break your system, leave files behind, and in general, force you to learn way more than you want to about the innards of Linux. It's good to learn, but not when you're trying to fix a broken system.
Luckily, there is a tool to help. It's called purge-old-kernels, and is part of (comes along with) the byobu package. (if man purge-old-kernels fails, do sudo apt-get install byobu and retry).
From http://manpages.ubuntu.com/manpages/xenial/en/man1/purge-old-kernels.1.html
xenial (1) purge-old-kernels.1.gz
Provided by: byobu_5.105-0ubuntu1_all
NAME
purge-old-kernels - remove old kernel and header packages from the
system
- 37,856
The other reason is that, the kernel is updated from time to time, so you can choose either to use the old one or the new one.
- 309
You can easily remove old kernals once you have verified that the current Kernal works with your system.
Open the terminal and enter the following command:
sudo apt autoremove --purge
type in your password, and profit..
- 27,638