apt: fixed pkg=<name>=<version> fails if package is not yet installed.

Reported and patch provided by https://github.com/msolo. Closes GH-5625.