3

I've inherited an Ubuntu 12.04 server where package management is completely messed up. Any aptitude command fails with errors like this one (for every installed package, as far as I can tell):

dpkg: dependency problems prevent configuration of grub-common: grub-common depends on libdevmapper1.02.1 (>= 2:1.02.36); however: Package libdevmapper1.02.1 is not configured yet. 

There are dozens of unresolved dependencies, and trying to resolve them leads to further unresolved dependencies. In addition, there are dozens of other errors I can't even find anywhere (and won't describe). I can't spend more hours trying to fix this.

Is there any possible way to "reset" aptitude and start with a clean slate, without actually removing currently installed and configured packages?

5
  • 2
    At this point, you should just reinstall. Commented May 10, 2015 at 12:29
  • What happens when you try to configure the package(s) it says are not configured yet? Commented May 10, 2015 at 14:16
  • aptitude install perhaps, (with no further arguments) so as to give the packaging system an opportunity to complete the outstanding installation tasks. Commented May 10, 2015 at 14:19
  • @HåkanLindqvist: just more strange configuration issues. Already tried aptitude install. I suppose reinstall is the best option here. Commented May 11, 2015 at 10:33
  • I could not install VLC on Ubuntu 16.04 with aptitude without removing Unity and 300 packages according to aptitude. apt-get remove aptitude followed by an install did not help. As a workaround I used apt-get to install VLC which worked. Aptitude really needs a reset command. Commented Sep 9, 2017 at 14:35

2 Answers 2

10

If you find aptitude state completely messed up, you can try (as root):

# rm -f /var/lib/aptitude/pkgstates* 

And then restart it. That should clear aptitude's idea of what needs to be (re)installed/upgraded and then you can Update from there.

This happens to me periodically if I change the sources list or alter the release Pins in preferences and it gets into a package resolution disaster (or runs forever trying to find an upgrade path).

4
  • Still useful for Ubuntu 21.10, after checking with apt-get and dpkg that my system was not broken. Commented Jan 12, 2022 at 19:21
  • If removing pkgstates helps you, it would indicate to me that you're regularly managing packages with apt, apt-get or any of the UI package managers instead of aptitude. Going aptitude all the way should hardly ever display such issues and if it does, it'll only be for a small number of packages that have been installed/uninstalled outside of Aptitude. And that's kinda expected with Aptitude's separate state-keeping. If you're not using Aptitude's TUI, there's no good reason to use Aptitude at all. And if you're using Aptitude's TUI, you should try to avoid apt / apt-get. Commented Apr 15, 2023 at 13:19
  • I would expect a huge problematic aptitude state after upgrading your system with any tool that's not Aptitude. So if you like Aptitude, I suggest to always upgrade your system with aptitude and to not let the GUI tools or do-release-upgrade do it. Commented Apr 15, 2023 at 13:25
  • Interesting @blubberdiblub, do-release-upgrade did not break things, but the initial issue arose lately, i.e. with Xubuntu 23.10. Not sure what was the trigger though. Commented Nov 26, 2023 at 16:29
4

Try running:

 # dpkg --configure --pending # dpkg --configure -a # apt-get -f install 

If that doesn't help, and you are unable to resolve further conflicts/problems on your own or get someone whos more experienced with dpkg at the helm, or just backup /etc and reinstall.

1
  • None of that resolves the configuration/dependency nightmare. I guess backup and reinstall is the way to go here. Commented May 11, 2015 at 10:35

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.