Get Architecture Variant of Installed Packages using dpkg

Get Architecture Variant of Installed Packages using dpkg

Debian-based systems (Ubuntu, Linux Mint, Kali, etc.) use dpkg to handle package installation and metadata, including CPU architecture details. On modern systems, this mechanism is extended with x86-64 microarchitecture levels, allowing the installation of optimized package builds for compatible CPUs. For example, Ubuntu supports the x86-64-v3 microarchitecture level, enabling newer processors to use performance-optimized binaries. This tutorial explains how to get architecture variant of installed packages using dpkg.

The following command lists installed packages along with their architecture and architecture variant:

dpkg-query -W -f='${Package}|${Architecture}|${Architecture-Variant}\n' | awk -F'|' '{printf "%-40s %-8s %s\n",$1,$2,($3?$3:"-")}'

Example output with x86-64-v3 (amd64v3) enabled:

apt                     amd64    amd64v3
base-files              amd64    amd64v3
base-passwd             amd64    amd64v3
bash                    amd64    amd64v3
bsdutils                amd64    amd64v3
coreutils               all      -
coreutils-from-uutils   all      -
dash                    amd64    amd64v3

This output shows that several core system packages are installed using the amd64v3 variant, while architecture-independent packages (all) do not have a variant.

Example output without architecture variant:

apt                     amd64    -
base-files              amd64    -
base-passwd             amd64    -
bash                    amd64    -
bsdutils                amd64    -
coreutils               all      -
coreutils-from-uutils   all      -
dash                    amd64    -

This output indicates that all packages are installed using the standard amd64 architecture.

It is important to note that dpkg -l does not display architecture variant information. Even on systems where amd64v3 (or other variants) packages are installed, dpkg -l will only show the base architecture. To view the architecture variant, dpkg-query must be used instead, as shown in this tutorial.

Leave a Comment

Cancel reply

Your email address will not be published.