Skip to content

fix(deb): reject local .deb built for an incompatible architecture - #2118

Open
SzymonPaczos wants to merge 1 commit into
ubuntu:mainfrom
SzymonPaczos:fix/local-deb-architecture-check
Open

fix(deb): reject local .deb built for an incompatible architecture#2118
SzymonPaczos wants to merge 1 commit into
ubuntu:mainfrom
SzymonPaczos:fix/local-deb-architecture-check

Conversation

@SzymonPaczos

@SzymonPaczos SzymonPaczos commented May 22, 2026

Copy link
Copy Markdown

Local .deb files for a foreign CPU architecture (e.g. an amd64 .deb opened
on arm64) leave the install button on an indefinite spinner: PackageKit fails
internally, but the error is only logged. The errorStream listener in
store_app.dart only handles SnapdException, and activeTransactionId is
never cleared after waitTransaction throws.

This PR validates the package architecture in LocalDebModel.build() before
any InstallFiles call and shows a dedicated error screen.

  • the package architecture comes from PackageKit.GetDetailsLocal (works in
    the snap sandbox, where dpkg-deb subprocess is denied by the profile,
    verified at runtime)
  • compatibility is checked against a static CPU-capability table
    (amd64 → {amd64, i386}, arm64 → {arm64, armhf, armel}, ...) so the check
    works identically inside and outside the snap. dpkg --print-foreign-architectures
    is denied in the snap too, which would otherwise falsely block legitimate
    multiarch installs (e.g. an i386 .deb on amd64 with multiarch enabled).
  • only blocks installs the CPU physically cannot execute; everything else is
    left to PackageKit, mirroring the SNAP_ARCH-first pattern from fix(packagekit): check arch compatibility in resolve #1486.

Known limitation: an i386 .deb on amd64 with multiarch not enabled is still
allowed through (same behaviour as today; detecting it would need
snap-sandbox access to multiarch config).

Tested locally on arm64; flutter test passes.

Related: #1485 (repo-resolve variant, fixed in #1486), #1679, #1681. cc @d-loose

Opening a local .deb built for a foreign CPU architecture left App
Center on an indefinite spinner: the PackageKit transaction failed
but the error was never surfaced to the user.

Validate the package architecture in LocalDebModel.build() before
starting an install transaction, and show a dedicated error screen
when the system's CPU cannot execute the package's architecture.
The architecture comes from PackageKit's GetDetailsLocal; the
compatibility check uses a static CPU-capability table so it works
inside the strictly-confined snap, where dpkg cannot be executed.

Related: ubuntu#1485, ubuntu#1679
@SzymonPaczos
SzymonPaczos force-pushed the fix/local-deb-architecture-check branch from 79b9872 to 1b2a4d5 Compare May 22, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant