When troubleshooting a problem with a Debian package installation, an administrator wants to see which version of a package would be installed from the configured repositories. Which command displays the candidate version?
Trap 1: dpkg -l package
dpkg -l lists installed packages and their versions from the local dpkg database, ignoring configured repositories entirely. It is tempting because it reports versions, but it shows what is installed, not the candidate available for upgrade; apt-cache policy or apt list displays the candidate.
Trap 2: apt-show-versions package
apt-show-versions reports installed versions and their distribution status, not the candidate version a repository would supply. It is tempting because it queries APT metadata, but it answers which release a package came from; apt-cache policy or apt list --upgradable shows the candidate.
Trap 3: apt-get -s install package
apt-get -s install simulates installation, showing what would be fetched and changed, but its output does not cleanly present the candidate version field. It is tempting because -s previews actions, yet apt-cache policy or apt list explicitly reports the candidate version from configured repositories.
- A
dpkg -l package
Why it fails: dpkg -l lists installed packages and their versions from the local dpkg database, ignoring configured repositories entirely. It is tempting because it reports versions, but it shows what is installed, not the candidate available for upgrade; apt-cache policy or apt list displays the candidate.
- B
apt-show-versions package
Why it fails: apt-show-versions reports installed versions and their distribution status, not the candidate version a repository would supply. It is tempting because it queries APT metadata, but it answers which release a package came from; apt-cache policy or apt list --upgradable shows the candidate.
- C
apt-get -s install package
Why it fails: apt-get -s install simulates installation, showing what would be fetched and changed, but its output does not cleanly present the candidate version field. It is tempting because -s previews actions, yet apt-cache policy or apt list explicitly reports the candidate version from configured repositories.
- D
apt-cache policy package
apt-cache policy queries the APT cache and prints, for each configured repository, the installed version and the candidate version that would be selected for installation, letting the administrator confirm which version the repositories currently offer.