dpkg
is the base command to handle Debian packages, including things like installing, analyzing dependencies, etc. But it cannot resolve unmet dependencies that are missing in your system so it may lead to errors during installation.
You can actually read about a recent example here on the forums of such issue: Failed to install veracrypt
apt
will create a dependency list before attempting to install the package and install those dependencies first. It also works the other way around when removing packages by flagging whatever dependencies are no longer being used, although it won't remove them by default, that's what the apt autoremove
command is for.
Note that it still uses dpkg
for installing packages, you can think of apt
as the "frontend" and dpkg
the "backend" in terms of how closely they work in regard to the user. So these two tools are usually working together.