5

My computer has rather low disk space. For this reason every so often I need to run sudo apt autoremove to remove old kernels and headers and stuff.

Not that long ago, I noticed that it has kept 4.4.0.77 as well as 4.4.0.78. I have run autoremove twice since noticing, but it still is there. I only use the latest kernel, and I don't think any of my software depends on that particular version, but when I tried to remove it, it wanted to remove linux-image-generic. That sounds important, so I didn't, but why does it depend on an outdated kernel version?

  • I highly doubt that linux-image-generic depended on the second most recent kernel image version on your system. Could you please edit your question to include the output of dpkg-query -l linux-image-\* | grep ^ii? Thanks. – David Foerster May 22 '17 at 22:15
  • @DavidFoerster I have allready specified why I think linux-image-generic depends on it. – Mark Gardner May 24 '17 at 9:25
  • I don't see an explanation as to why you believe it is that way, just a statement that you do. I'd also like to confirm that you're not mistaken since this situation is pretty hard to believe and would require further investigation anyway. The output of dpkg-query -Wf '${Status;1} ${Package}\n' linux-image-\* | sed -ne 's/^i //p' | xargs apt-cache policy would be even better suited to that. – David Foerster May 24 '17 at 9:27
  • @DavidFoerster but when I tried to remove it, it wanted to remove linux-image-generic. – Mark Gardner May 25 '17 at 4:59
  • Oh, it seems we meant different levels of explanation. I'd consider that an observation, not an explanation. There are other plausible explanations for this observation am I'm asking for more information to look into them. – David Foerster May 25 '17 at 9:08
12

Ubuntu does not need two kernels. It keeps one "backup" kernel in case you can't boot with the latest one.

You can safely remove the older kernel if you are sure you won't need it.

And you probably tried to remove the latest one if linux-image-generic was to be removed. It depends on the latest kernel only.

  • As long as the other packages (linux-image-generic, linux-cloud-tools, etc.) have the exact same version number, this is fine. They generally should, if the apt-get remove command was well enough specified. – Zeiss Ikon May 22 '17 at 17:45
0

Ubuntu keeps all the previous kernels by defaults. You can safely remove them by issuing sudo apt autoremove without any arguments. It will then show you the list of "cached" packages and ask if you want to remove them. You do.

  • Maybe you mean sudo apt-get autoremove? – Geppettvs D'Constanzo Jun 2 '17 at 18:26
  • @GeppettvsD'Constanzo nope :) apt (it's been a while now) is now an alias to most apt-* functions ; try it! – yPhil Jun 2 '17 at 18:43
  • Your command is returning E: Invalid operation autoremove in a terminal. I am using 14.04 LTS. So I guess I don't have such alias in my system. Maybe in newer versions? Thank you! – Geppettvs D'Constanzo Jun 2 '17 at 22:20

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.