1

enter image description here

  • I want to clean disk space
  • Disk analyzer shows this graph
  • I noticed the repetitive pattern in /lib/modules (I guess old kernel versions)

How to determine obsolete kernels?

How to remove them safely?

Already tried sudo apt autoremove and sudo apt autoclean as described in this answer; these had no effect.

edit - why differs my question from the suggested duplicate: A simple solution like the one-liners I already tried would be nice, as I prefer a "user-friendly" way to work with my computer instead of using cryptic terminal-commands

Zanna
  • 70,465
Breaker222
  • 226
  • 3
  • 11

3 Answers3

2

Get a list of all kernels that are installed on your Ubuntu:

dpkg -l "*linux-image-*" | grep ^ii

check which one of them you are running:

uname -r

Remove everything except the one which is in uname -r outputs:

sudo apt autoremove --purge linux-image ...
Ravexina
  • 55,668
  • 25
  • 164
  • 183
1

Use /usr/bin/purge-old-kernels it's in the byobu package. purge-old-kernels handles the details (deleting all the parts of the old kernel, not deleting your current kernel, etc).

waltinator
  • 36,399
  • deleted 3.5GB with one command - works great. I hope also after reeboot ;) Official man page of the script btw: http://manpages.ubuntu.com/manpages/xenial/man1/purge-old-kernels.1.html – Breaker222 Aug 24 '17 at 18:51
0

"I prefer a "user-friendly" way to work with my computer instead of using cryptic terminal-commands"

rm-kernels

rm-kernels fits your "user friendly" requirement. It's a bash script you can quickly create. As described in Ask Ubuntu answer: How to selectively purge old kernels all at once