My dpkg database is hosed!
June 26, 2006 2:41 PM   Subscribe

My Debian package database is a mess! How can I reset its state?

So I made an attempt to use the Debian Backports and it didn't go so well. To cut a long story short, dselect (and aptitude) now want to uninstall about 90% of my installed packages. In dselect, they're marked as:

Installed?: installed
Old mark: remove
Marked for: remove

How can I reset the state of the dpkg database, basically tell it "if it's installed, leave it alone"?

"X" just seems to undo changes you've made in this session, so that's no help. There's also "R" to revert to the state before this list, which doesn't help either.

For what it's worth, synaptic sees all the packages in the correct state.

I'm hoping for a smart solution before I head off into a couple of hours of manually resetting this stuff.
posted by ciaron to Computers & Internet (6 answers total) 1 user marked this as a favorite
Best answer: I suspect you can just hack /var/lib/dpkg/status with your favourite text processing tool; check the Status line just under the Package name and replace it with the desired status ("install ok installed" seems to be what you want).

You will, of course, make backups first; it's been a good few years since I've hacked about with dpkg.
posted by Freaky at 2:52 PM on June 26, 2006

Have you tried removing backports from your sources.list and then apt-get update; apt-get dist-upgrade ?
posted by beerbajay at 3:09 PM on June 26, 2006

(I stopped using dselect after a few of these incidents and just use apt-get directly now)
posted by beerbajay at 3:10 PM on June 26, 2006

You could pin individual packages, but that would be tedious, at best.

When I've done similar things, I've gone with something like what beerbajay suggested - clean up /etc/apt/sources.list, then apt-get update && apt-get upgrade, then apt-get dist-upgrade (answering "no" if it wanted to uninstall anything I use). Rinse and repeat roughly daily until the system is back to some kind of stability.

I have up on dselect years ago. The developers can pry apt-get from my cold, dead hands.
posted by QIbHom at 4:51 PM on June 26, 2006

Does this help?
  1. Start aptitude
  2. Highlight the "Installed Packages" line.
  3. Press "+".
That should hopefully set the action back to "keep/install" for all those packages, though you'll still have to resolve any conflicts that led to this problem...
posted by mbrubeck at 8:52 PM on June 26, 2006

Response by poster: I delved into /var/lib/dpkg/status as Freaky suggested. There were still a couple of conflicts after I modified the status of the affected packages, but those could be sort out by hand afterwards. Thanks everyone!
posted by ciaron at 12:22 AM on June 27, 2006

« Older Timing of home equity loan   |   What can they read to help motivate the teens? Newer »
This thread is closed to new comments.