74
$ apt-get install -f -o 'Dpkg::Options::=--force-confmiss --force-all --force-confnew --overwrite-conffiles' --reinstall at-spi2-core
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 kde-workspace-bin : Depends: qdbus but it is not going to be installed
 libqt4-dbus : Depends: qdbus (= 4:4.8.5+git192-g085f851+dfsg-2ubuntu4) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

I don't quite understand "but it is not going to be installed". Why doesn't it install it then?

apt-get -f install does not help, it does nothing:

$ apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Albert
  • 2,817

11 Answers11

43

This worked for me.

$ sudo apt-get install <missing-package-1> <missing-package-2> ...

I don't know why this is necessary, but manually installing the problematic packages worked.

After installing the first round of unmet dependencies, another one popped up, but I repeated the process and it sorted itself out after two cycles.

funroll
  • 539
24

As this question also didn't help, I found on this LinuxQuestions thread a hint that helped me:

Do you have a mixed /etc/apt/sources.list? It appears that you're trying to install one package from a newer repository but that it doesn't have access to a repository with the newer dependencies.

tueftl
  • 341
  • 2
  • 3
11

I ran into this issue and solved it by running:

sudo apt-get update
sudo apt-get upgrade

Then when I ran the original "apt-get install" command succeeded.

samt1903
  • 119
4

Nothing above worked for me but following procedure saved me

sudo dpkg --configure -a 

this will list the broken packages and

sudo dpkg -r librrd4 

{librrd4 and libpng12 were my broken pakages solved the problem

raghu
  • 156
2

I had a similar issue while trying to install another package. Using aptitude instead of apt-get helped solve the issue for me. Refer this answer: https://askubuntu.com/a/1379008/413845

lordvcs
  • 186
1

After an attempted dist-upgrade, I ended up with:

 You might want to run 'apt --fix-broken install' to correct these. The
 following packages have unmet dependencies:  acl : Depends: libacl1 (=
 2.3.1-3) but 2.2.53-4 is to be installed  libc-bin : Depends: libc6 (< 2.29) but 2.36-9+rpt2+deb12u8 is to be installed  libc-dev-bin : Depends: libc6 (< 2.29) but 2.36-9+rpt2+deb12u8 is to be installed 
 libc6-dbg : Depends: libc6 (= 2.28-10+rpt2+rpi1+deb10u2) but
 2.36-9+rpt2+deb12u8 is to be installed  libc6-dev : Depends: libc6 (= 2.28-10+rpt2+rpi1+deb10u2) but 2.36-9+rpt2+deb12u8 is to be installed  libnih1 : Depends: libc6 (< 2.29) but 2.36-9+rpt2+deb12u8 is to be
 installed  locales : Depends: libc-bin (> 2.36) but
 2.28-10+rpt2+rpi1+deb10u2 is to be installed  openssh-server : Depends: openssh-client (= 1:9.2p1-2+deb12u3) but 1:7.9p1-10+deb10u4
 is to be installed
                   Depends: runit-helper (>= 2.14.0~) but it is not going to be installed
                   Depends: libcrypt1 (>= 1:4.1.0) but it is not going to be installed
                   Depends: libselinux1 (>= 3.1~) but 2.8-1+b1 is to be installed
                   Depends: libssl3 (>= 3.0.13) but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install'
 with no packages (or specify a solution).

And as for may others apt --fix-broken install did not work. As it is a headless system, removing openssh-server was not an option and I knew messing up libc6 would probably brick the system. So I pulled good old dpkg out of the toolbox. All the .deb files for the upgrade were stored in /var/cache/apt/archives, so I went to that directory and did

 dpkg --install openssh-server_1%3a9.2p1-2+deb12u3_armhf.deb openssh-client_1%3a9.2p1-2+deb12u3_armhf.deb  runit-helper_2.15.2_all.deb libc6_2.36-9+rpt2+deb12u8_armhf.deb 

The filenames are as found in the archives directory. This installed those packages but listed a few other missing dependencies, so I reran the command with those dependencies added. After a few iterations, I seemingly had gotten things working, trying an apt dist-upgrade told me there were still some dependency problems, so I had to a few more dpkg --installs, but in the end, apt could take over again.

Warning: doing wrong things with dpkg can really mess up your system, be sure you really install those versions that are needed.

1

I also had the same issue while installing Guake; it showed unmet dependencies with Python. Even trying to reinstall python using sudo apt-get install --reinstall python did nothing.

Finally,

Step-1: I had to remove and install python again using:

Note: Uninstalling python leads to removing many other dependencies which may break the installed Ubuntu, so be careful while uninstalling python

sudo apt-get purge python

sudo apt-get install python

Step-2: Install the original package (in my case it was guake)

sudo apt-get install guake

This installed all necessary dependencies.

Try the same procedure w/ your packages and it should work for you too.

0

I had similar problems with cups-filters on raspberrypi caused by realvnc-vnc-server. It was due to foomatic-filters being deprecated. I couldn't install or uninstall anything so what worked for me was to delete the apt cache for cups-filters.

sudo rm /var/cache/apt/archives/cups-filters*

Then the install worked as suggested by @funroll

sudo apt install cups cup-filters

0

In my case it needed the version of the package from focal, but it wanted to install the version from focal-updates. On theory it can be fixed by running apt-install pkg_name_here=older_specific_version_here. In my specific case that wasn't acceptable because i had many packages depending on the newer version of one of the nested dependencies which it wanted to remove along the downgrade, so i said no.

Lyubomir
  • 191
0

Get your broken/missing dependencies using

sudo dpkg --configure -a 

Once you have it, try installing them manually.

0

In addition to the other answers, remember to run sudo apt update before running things like apt-get install -f or sudo apt --fix-missing install, otherwise you might get an error because apt cannot find the newest packages which are required.

MyrionSC2
  • 101