APT is stuck - The package linux-headers-5.10.0-10-common needs to be reinstalled, but I can't find an archive for it

The error

I encountered the following error in Debian 11 while doing the usual apt update and apt upgrade:

English: E: The package linux-headers-5.10.0-10-common needs to be reinstalled, but I can't find an archive for it

Swedish: E: Paketet linux-headers-5.10.0-10-common måste installeras om, men jag kan inte hitta något arkiv för det.

The usual commands apt remove, apt upgrade, dpkg --configure -a, aptitude install -f did not help. It was stuck and refused to continue.

This behavior was very shameful because it should absolutely not happen that the user gets stuck like this.


Golden solution

The following made it uninstall with complains:

sudo dpkg --remove --force-all <package>

Example:
sudo dpkg --remove --force-all linux-headers-5.10.0-10-common

Then continue with apt upgrade.

References

https://askubuntu.com/questions/1303046/linux-headers-5-4-0-56-needs-to-be-reinstalled-but-i-cant-find-an-archive-for

This is a personal note. Last updated: 2023-04-09 16:35:59.



GitHub

My

GitLab

My

LinkedIn

My

Klebe.se

Don't forget to pay my friend a visit too. Joakim