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.

muru
  • 197,895
  • 55
  • 485
  • 740
GothicMonster
  • 471
  • 1
  • 4
  • 3
  • 2
    Have you tried the sudo command of "sudo apt-get --purge remove " and then try re-installing from the CLI? – daslinkard Apr 17 '12 at 01: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 01:56
  • Did you try sudo apt-get install -f <package> ? – Jeff Welling Apr 17 '12 at 02: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 02:01
  • Try the solution from this guy...

    http://askubuntu.com/questions/122699/how-to-remove-package-in-bad-state-software-center-freezes-no-synaptic

    – Lie Aug 02 '14 at 20:13
  • i cant find the line "linux-headers-3.0.0-19" There are Tooo Many Lines Is There any easy way to spot the line – Swaroop BigBoy Jul 25 '15 at 02:50

2 Answers2

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.

Videonauth
  • 33,355
  • 17
  • 105
  • 120
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
    
user.dz
  • 48,105