0

Every time I try to install a package like using the command below

sudo apt install git

I get the output

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: The package linux-headers-5.15.0-58 needs to be reinstalled, but I can't find an archive for it.

I am currently on Ubuntu 22.04.1 LTS. I've been trying to fix it with commands from this post: Ubuntu won't update: "The package linux-modules-5.19.0-32-generic needs to be reinstalled", but I can't find an archive for it. Obviously, the issue in that thread is from a different version.I have also tried other commands from this thread: Linux-Headers Reinstall

Any ideas on how to fix this error?

Ekos
  • 1
  • You've not mentioned what OS/release you're actually using; I see reference for it for focal (20.04), is what what you're using? https://packages.ubuntu.com/search?keywords=linux-headers-5.15.0-58&searchon=names&suite=all§ion=all as 5.15 is used by multiple releases. I'd start with sudo apt update & check all lines of output are there, no warnings/errors & no missing lines etc.. ie. check your sources after you work out what OS/release you're using (we're limited to details you tell us) – guiverc Sep 02 '23 at 13:14
  • Attempts to fetch updates through sudo apt update work but using sudo apt upgrade does not and results in the same package error. – Ekos Sep 02 '23 at 13:42
  • You have two options: You can 1) Download the correct package from launchpad.net, reinstall it, then remove with full automatic cleanup using apt, or 2) Force-uninstall the package, and clean up all the installed files manually. Both methods work if done properly. Your link does the easy part of #2 (it skips the cleanup). It's unclear what problem you are encountering since the question does not include complete input/output of whatever you tried. – user535733 Sep 02 '23 at 14:49
  • Don't comment on your own question. Edit your question instead to add information and answer questions. Comments are intended to help you refine and improve your question until it is answerable. Then somebody will answer it. – user535733 Sep 02 '23 at 14:50

0 Answers0