4

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?

  • Ok. Will keep older kernel too. Thanks for the answers. – m147 Nov 23 '16 at 18:37
  • I updated my answer about not having to delete kernels manually in your circumstances. – WinEunuuchs2Unix Nov 23 '16 at 20:46
8

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.

| improve this answer | |
  • "Contrary to some suggestions I believe...": askubuntu.com/q/590673/158442 It's a very well-known problem that old kernels are not automatically removed, that's why /boot of so many users fill up: askubuntu.com/q/89710/158442, – muru Nov 24 '16 at 1:28
  • @muru I ran sudo apt autoremove the other night and I'm pretty sure it deleted kernels Ubuntu had automatically installed but not kernels I manually installed. But I'll research it more and revisit the above answer. – WinEunuuchs2Unix Nov 24 '16 at 2:20
  • @W that's you manually running autoremove. That works. But Ubuntu doesn't automatically do that for you, which causes problems. – muru Nov 24 '16 at 2:29
5

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
| improve this answer | |
3

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
| improve this answer | |
  • so it's best to just keep both kernels where they are yes? – m147 Nov 23 '16 at 18:22
  • Traditionally, one keeps the previous kernel, just in case the current, running kernel fails, or one finds an incompatibility that wasn't in the previous kernel. "keep both kernels where they are"? Do NOT mess with kernels as long as "noob" applies. Do NOT. If you must remove it (disk space), use purge-old-kernels. – waltinator Nov 23 '16 at 18:28
1

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.

| improve this answer | |
1

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..

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.