I'm new to Linux so I might need some help in ELI5 language. I'm out of disk space. I see lots of old kernels that I don't need anymore, but I can't seem to delete them.
When I try this:
sudo apt clean && sudo apt autoclean && sudo apt autoremove -y
I get this:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 107 not upgraded.
Many kernels still remain afterwards. When I try to remove them manually, using this command:
sudo apt-get autoremove linux-image-4.4.0-31-generic
When I do this manually instead, I get this:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
linux-image-5.15.0-41-generic*
0 upgraded, 0 newly installed, 1 to remove and 107 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 260814 files and directories currently installed.)
Purging configuration files for linux-image-5.15.0-41-generic (5.15.0-41.44~20.04.1) ...
rmdir: failed to remove '/lib/modules/5.15.0-41-generic': Directory not empty
I don't think that it is true that the directory is empty though, because just this one specific directory is taking up 1.6gb. See screenshot of that here.
Can someone help me figure out how to remove these old kernels? It looks like they are taking up a lot of space, and I only have 2 GB left!