I know I can list the .deb's dependencies using dpkg --info, but is there any automated way to check those dependencies against the current system? What I'm interested in, the status: whether the package will be cleanly installed, or will it fail.


According to the manual: dpkg -i --force-bad-path --dry-run foo.deb. However, it doesn't work, a bug was filed about this 10 years ago.

There is a corresponding option in apt-get and aptitude, but that only applies to packages obtained via apt.


Here's a way which is very hackish but does work, sort of.

Make sure you're not root, or you risk overwriting some system files.
Create a temporary directory and change to it.

mkdir root
cp -as /var/lib/dpkg .
rm dpkg/lock dpkg/triggers/Lock
fakeroot dpkg --force-not-root --force-bad-path --admindir=dpkg --instdir=root --log=log -i mypackage.deb

This will unpack the package and then complain about any missing dependencies on stderr. It's likely to return a nonzero status even if there are no missing dependencies because of a failing postinst script.

I haven't tried with a package that has a preinst script, it's possible that dpkg will give up before checking dependencies.

  • Try #3... This time, I tested it (on lenny). – Gilles Aug 5 '10 at 22:11

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.