Back to lessons

Linux Survival Basics

Spot Foreign-Architecture Packages

Package dependency output is confusing and you need to see whether the host has non-native architecture packages installed.

Command

dpkg-query -W -f='${Architecture}\t${Package}\n' | awk '$1 != "amd64" && $1 != "all"'

What changed

Nothing changes. dpkg-query prints package architectures and awk filters non-native rows.

Danger

safe

When to use it

Use when debugging multiarch dependency issues, legacy runtime support, or unexpected i386 packages on amd64 servers.

When not to use it

Do not assume foreign architecture packages are wrong; some applications require them.

Undo or recovery

No undo needed because the command is read-only.

Expected output

Foreign-architecture package rows such as i386 zlib1g:i386.

demo script

Disposable terminal steps

  1. dpkg-query -W -f='${Architecture}\t${Package}\n' | sort
  2. dpkg-query -W -f='${Architecture}\t${Package}\n' | awk '$1 != "amd64" && $1 != "all"'

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ dpkg-query -W -f='${Architecture}\t${Package}\n' | sort
amd64	base-files
amd64	bash
amd64	curl
amd64	libc6
amd64	linux-image-6.8.0-60-generic
amd64	nginx
amd64	openssl
amd64	python3
amd64	zlib1g
i386	zlib1g:i386
::exit-code::0
$ dpkg-query -W -f='${Architecture}\t${Package}\n' | awk '$1 != "amd64" && $1 != "all"'
i386	zlib1g:i386
::exit-code::0

YouTube Short

Find foreign arch packages.

On amd64 systems, i386 packages can be legitimate, but they explain dependency surprises. List them before changing apt settings.

LinkedIn hook

One unexpected architecture can explain confusing dependency output.

Question: Have foreign-architecture packages ever explained a dependency puzzle for you?

experiments

A/B tests to run

Metric: average_view_duration

A: Find unexpected i386 packages.

B: Dependency puzzle? Check architecture.