Package dbus is not configured yet

While attempting to upgrade (sudo apt-get upgrade) Ubuntu 12.04, I had a pair of packages that would throw the following apt-get install errors for the dbus dependency:

dpkg: error processing dbus (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of accountsservice:
 accountsservice depends on dbus; however:
  Package dbus is not configured yet.
dpkg: error processing accountsservice (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 dbus
 accountsservice
E: Sub-process /usr/bin/dpkg returned an error code (1)

Solution 1:

The solutions provided for similar issues of dpkg returning an error is to use:

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

Both did not resolve the issue and produced the same error output. In some cases, aptitude may be a better option to use than apt-get. The solution is to use aptitude install -f:

aptitude install -f

Explanation: As a special case, aptitude install with no arguments will act on any stored/pending actions. When the -f option is given, aptitude will be more aggressive when attempting to fix the dependencies of broken packages, even if it means ignoring the actions requested on the command line.