E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). appeared after a local .deb was installed with dpkg -i while the package it depends on was missing. Run apt-get -f install -y with no package names: apt downloads the missing dependency and finishes configuring the package.

Next time install local files through apt, as apt-get install -y ./file.deb, which fetched the dependency in the same step in the test.

The error

First dpkg -i unpacked the package and stopped short of configuring it:

$ cd /tmp && dpkg -i fix10-dep_1.0_all.deb
Selecting previously unselected package fix10-dep.
(Reading database ... 4454 files and directories currently installed.)
Preparing to unpack fix10-dep_1.0_all.deb ...
Unpacking fix10-dep (1.0) ...
dpkg: dependency problems prevent configuration of fix10-dep:
 fix10-dep depends on jq; however:
  Package jq is not installed.

dpkg: error processing package fix10-dep (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 fix10-dep
exit code: 1

Then an unrelated install refused to run:

$ apt-get install -y file
Reading package lists...
Building dependency tree...
Reading state information...
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 file : Depends: libmagic1t64 (= 1:5.45-3build1) but it is not going to be installed
 fix10-dep : Depends: jq but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
exit code: 100

Why it happens

dpkg -i installs the file you give it and nothing else. The control file said Depends: jq, jq was not installed, so dpkg left fix10-dep unpacked but unconfigured (iU in dpkg -l) and returned 1. From then on apt saw a package whose dependency was missing and refused the next install, listing fix10-dep under The following packages have unmet dependencies. That line is where to look for the package that broke the state.

The fix

$ apt-get -f install -y
Reading package lists...
Building dependency tree...
Reading state information...
Correcting dependencies... Done
The following additional packages will be installed:
  jq libjq1 libonig5
The following NEW packages will be installed:
  jq libjq1 libonig5
0 upgraded, 3 newly installed, 0 to remove and 13 not upgraded.
1 not fully installed or removed.
...
Setting up jq (1.7.1-3ubuntu0.24.04.2) ...
Setting up fix10-dep (1.0) ...
postinst of fix10-dep 1.0
Processing triggers for libc-bin (2.39-0ubuntu8.9) ...
exit code: 0
$ dpkg -l fix10-dep jq | tail -2
ii  fix10-dep      1.0                    all          test package for a fixes post
ii  jq             1.7.1-3ubuntu0.24.04.2 amd64        lightweight and flexible command-line JSON processor
exit code: 0

With no package names, apt installed jq and its two libraries and configured fix10-dep; after that apt-get install -y file returned 0. Read the plan it prints before you let it run: here it added three packages and removed none.

The better habit: after purging both packages, installing the file with apt-get install -y ./fix10-dep_1.0_all.deb listed jq, libjq1 and libonig5 as additional packages and set all four up in one run, exit code 0.

How it was reproduced

The capture was made in an ubuntu:24.04 container (Ubuntu 24.04.5 LTS, apt 2.8.3, dpkg 1.22.6) on Docker Engine 29.9.3, standing in for Ubuntu in WSL. As root, a tiny package fix10-dep with Depends: jq was built with dpkg-deb --build, jq was purged, the file was installed with dpkg -i, and apt-get install -y file was attempted before and after apt-get -f install -y.

Frequently asked

How do I fix 'Unmet dependencies. Try apt --fix-broken install with no packages'?
Run apt-get -f install -y with no package names. In the test it installed the missing jq and configured the waiting package, and the next install returned 0.
What does 'dpkg: dependency problems prevent configuration' mean?
dpkg -i unpacked the package but a dependency named in its control file was not installed, so the package was left unconfigured with status iU.
Should I install a .deb file with dpkg -i or apt?
In the test apt-get install -y ./file.deb fetched the dependency and configured everything in one run, while dpkg -i left the package unconfigured.

More decoded errors in the Fixes category. When the failure is a package script rather than a dependency, see Sub-process /usr/bin/dpkg returned an error code (1).