When trying to install aptitude with apt this error is thrown:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 aptitude : Depends: libapt-pkg5.0 (>= 1.1) but it is not going to be installed

E: Unable to correct problems, you have held broken packages.

However, when I attempt to install libapt-pkg5.0 it shows this:

Reading package lists... Done
Building dependency tree
Reading state information... Done
libapt-pkg5.0 is already the newest version (1.8.0~alpha3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I am on Debian 9.6.

  • 2
    Your installed version of libapt-pkg5.0 comes from unstable; are you sure you’re using Debian 9.6? – Stephen Kitt Jan 26 '19 at 18:02
  • Just checked, it appears I am using 9.7. I frequently get errors like this, how can I install the stable versions of all packages? My sources.list only has stable right now, but I did have to use unstable at some point. – xcqforeva Jan 26 '19 at 18:13

You installed an ex- testing/unstable package on your Debian 9 (stretch) system, which was not supposed to be done.

You can force a downgrade to stable by appending /stable to the blocking package. But take note that downgrading packages is not supported. Downgrading parts of the packaging management system is thus dangerous: if something goes wrong, you might lose access to the apt-get command.

This can be used multiple times with multiples packages in the same line if there are multiple related dependencies to solve at once (in case you upgraded all of apt's related packages). By the way, 1.8.0~alpha3 has still the recent Debian vulnerability since it was fixed for buster in 1.8.0~alpha3.1. This combined with the risk of a failure leads to:

apt-get -o Acquire::http::AllowRedirect=false update
apt-get -o Acquire::http::AllowRedirect=false -o APT::Clean-Installed=false install libapt-pkg5.0/stable

You'll probably have to add other related packages ( apt/stable and possibly others) on the last line. This command should tell what packages have this same version 1.8.0~alpha3, so would probably need to be added in the command above:

dpkg -l|awk '/^.i/ && $3 == "1.8.0~alpha3"'

After any such downgrade, it's prudent to reinstall again the same package(s) in a 2nd command:

apt-get --reinstall install libapt-pkg5.0

In the really unexpected case where this downgrade broke the apt-get command, you still have the dpkg command available and packages still in /var/cache/apt/archives/ to save you.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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