47

When 'Update Manager' starts running, it tells me that I need to do a 'Partial Upgrade', when I start doing the upgrade, it tells me

Remove package in bad state 

The package 'linux-headers-3.0.0-19' is in an inconsistent state 
and needs to be reinstalled, but no archive can be found for it. 
Do you want to remove this package now to continue?"

When I click 'Yes' the program just closes. I have tried to go into the software center and reinstall the linux-headers-3.0.0-19 ubuntu software center just freezes.

Right now I cannot run 'Synaptic', or remove any software.

6
  • 2
    Have you tried the sudo command of "sudo apt-get --purge remove <package>" and then try re-installing from the CLI? – daslinkard Apr 17 '12 at 1:52
  • I tried it, the command sent back this response: "E: The package linux-headers-3.0.0-19 needs to be reinstalled, but I can't find an archive for it." – GothicMonster Apr 17 '12 at 1:56
  • Did you try sudo apt-get install -f <package> ? – Jeff Welling Apr 17 '12 at 2:00
  • I got the same message "E: The package linux-headers-3.0.0-19 needs to be reinstalled, but I can't find an archive for it." – GothicMonster Apr 17 '12 at 2:01
  • Try the solution from this guy... askubuntu.com/questions/122699/… – Lie Aug 2 '14 at 20:13
57

Try this, I hope it works:

  1. Make a backup of /var/lib/dpkg/status:

    sudo cp /var/lib/dpkg/status /var/lib/dpkg/status.bkup
    
  2. Open /var/lib/dpkg/status:

    sudo nano /var/lib/dpkg/status
    
  3. Search through the file for any reference to that package name (i.e. linux-headers-3.0.0-19) and CAREFULLY delete that entry. Don't delete anything else. Save the file and quit.

  4. Do sudo apt-get update.

This should probably solve the problem.

3
  • It works! I got Software Center couldn't be open when installing openfire and your solution works! – emeraldhieu Dec 17 '12 at 9:11
  • gedit did not to open /var/lib/dpkg/status because of some special characters. Instead, editing it with nano worked fine. Already on two occasions it solved a nagging problem with the libreoffice-base package for me. – Serge Stroobandt Aug 17 '14 at 16:07
  • 1
    it is still works on 16.04 – Mert Öksüz Sep 21 '16 at 6:38
43
  • If you get nowhere with any of the other offerings I've used this in the past

    dpkg --remove --force-remove-reinstreq
    

    From the dpkg manual

    remove-reinstreq: Remove a package, even if it's broken

  • So run:

    sudo dpkg --remove --force-remove-reinstreq  linux-headers-3.0.0-19
    

Not the answer you're looking for? Browse other questions tagged or ask your own question.