← Back to issue list

dpkg --add-architecture fails when using package-repositories

View original Github issue

Metadata

Project
snapcraft
Number
#4289
Type
issue
State
closed
Author
ghost
Labels
—
Created
Updated
Closed

Current evaluation

Fixed in craft-archives 1.1.3 via canonical/craft-archives#96 (06b1ca2), reordering dpkg options so --root precedes --add-architecture; rolled out via Snapcraft candidate.

Resolution: closed resolved

Reason: craft-archives PR #96, commit 06b1ca2, corrected dpkg argument ordering and architecture compatibility handling; Snapcraft commit 586a9fe92 consumed the fix, and the issue was closed after candidate validation.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description Recently we were trying to snap up lutris after a break but now snapcraft build fails both with remote and the online(using launchpad as a back-end) , giving out this particular error. ``` dpkg: error: --add-architecture takes exactly one argument Type dpkg --help for help about installing and deinstalling packages [*]; Use 'apt' or 'aptitude' for user-friendly package management; Type dpkg -Dhelp for a list of dpkg debug flag values; Type dpkg --force-help for a list of forcing options; Type dpkg-deb --help for help about manipulating *.deb files; Options marked [*] produce a lot of output - pipe it through 'less' or 'more' ! Starting Snapcraft 7.5.0 Logging execution to '/root/.local/state/snapcraft/log/snapcraft-20230723-071633.938937.log' Running on amd64 for amd64 Initializing parts lifecycle Installing package repositories... Command '['dpkg', '--add-architecture', 'i386', '--root', '/']' returned non-zero exit status 2. ``` This was not the case earlier with us having success previously in building the lutris snap. Full build-log --> https://launchpadlibrarian.net/678501471/buildlog_snap_ubuntu_jammy_amd64_lutris_BUILDING.txt.gz ### To Reproduce 1) Clone or fetch lutris snap yaml from launchpad. 2) Do a snapcraft remote-build or ask launchpad to build. 3) Face the error in seconds. ### Environment In remote builds ; --> Lubuntu Rest was on launchpad side so cant be sure. ### snapcraft.yaml ```shell name: lutris base: core22 adopt-info: lutris grade: stable confinement: strict compression: lzo architectures: - build-on: amd64 environment: PYTHONPATH: ${SNAP}/usr/lib/python3/dist-packages:$PYTHONPATH assumes: - snapd2.54 - command-chain package-repositories: - type: apt architectures: [i386,amd64] key-id: F6ECB3762474EDA9D21B7022871920D1991BC93C key-server: keyserver.ubuntu.com formats: [deb] components: [main, multiverse, universe, restricted] suites: [jammy] url: https://archive.ubuntu.com/ubuntu #lint: #ignore: #- library: #- lib/i386-linux-gnu/** #- usr/lib/i386-linux-gnu/** #- lib32/** #- usr/lib32/** layout: /usr/share/libdrm: bind: $SNAP/graphics/usr/share/libdrm /usr/share/drirc.d: symlink: $SNAP/graphics/usr/share/drirc.d /usr/share/X11/XErrorDB: symlink: $SNAP/graphics/usr/share/X11/XErrorDB /usr/share/X11/locale: symlink: $SNAP/graphics/usr/share/X11/locale /usr/share/zenity: bind: $SNAP/usr/share/zenity apps: lutris: command-chain: - bin/migrate-config - bin/graphics-core22-wrapper command: usr/bin/lutris extensions: [gnome] environment: TMPDIR: $XDG_RUNTIME_DIR APPIMAGE_EXTRACT_AND_RUN: 1 common-id: net.lutris.Lutris desktop: usr/share/applications/net.lutris.Lutris.desktop plugs: - home - shmem - audio-playback - network - network-bind - network-status - joystick - audio-record - process-control - bluez - browser-support - unity7 - removable-media - optical-drive - screen-inhibit-control - hardware-observe - mount-observe - system-observe - physical-memory-observe - upower-observe - raw-usb plugs: graphics-core22: interface: content target: $SNAP/graphics default-provider: mesa-core22 shmem: interface: shared-memory private: true lutris-user-config: interface: personal-files read: - $HOME/.config/lutris - $HOME/.local/share/lutris slots: lutris: interface: dbus bus: session name: net.lutris.Lutris parts: migrate-script: plugin: dump source: . stage-packages: - zenity override-pull: | craftctl default chmod +x migrate-config stage: - bin/migrate-config - usr/bin/zenity - usr/share/zenity organize: migrate-config: bin/migrate-config lutris: source: https://github.com/lutris/lutris.git source-tag: v0.5.13 source-depth: 1 after: [lutris-runtime] plugin: meson parse-info: [usr/share/metainfo/net.lutris.Lutris.metainfo.xml] meson-parameters: - --prefix=/snap/lutris/current/usr override-pull: | craftctl default craftctl set version=$(git describe --tags --abbrev=0 | cut -c 2-) override-build: | craftctl default # WORKAROUND: Use python from search path, the path detected by meson doesn't exist when running the Snap sed -e '1c#!/usr/bin/env python3' -i ${CRAFT_PART_INSTALL}/snap/lutris/current/usr/bin/lutris organize: snap/lutris/current/usr: usr lutris-runtime: plugin: nil stage-packages: - cabextract - curl - fluid-soundfont-gs - psmisc - python3-dbus - python3-gi - python3-pil - python3-requests - python3-setproctitle - python3-yaml - python3-distro - python3-cairo - python3-lxml - python3-evdev - python3-magic - unzip - xterm - pciutils - xz-utils - mesa-utils - vulkan-tools prime: - -usr/lib/*/libatk-1.0.so* - -usr/lib/*/libcairo-gobject.so* - -usr/lib/*/libcairo.so* - -usr/lib/*/libgdk-3.so* - -usr/lib/*/libgdk_pixbuf-2.0.so* - -usr/lib/*/libgtk-3.so* - -usr/lib/*/libharfbuzz.so* - -usr/lib/*/libpango-1.0.so* - -usr/lib/*/libpangocairo-1.0.so* - -usr/lib/*/libpangoft2-1.0.so* - -usr/lib/*/libpixman-1.so* - -usr/lib/*/libwayland-client.so* - -usr/lib/*/libwayland-cursor.so* - -usr/lib/*/libwayland-egl.so* stage: - -lib/ld-linux.so.2 - -usr/bin/cpp-7 - -usr/lib/*/libjavascript* - -usr/lib/*/libwebkit* - -usr/share/doc/cpp/README.Debian - -usr/share/man/man1/cpp-7.1.gz graphics-core22: after: [lutris] source: https://github.com/MirServer/graphics-core22.git # ext:updatesnap # version-format: # ignore: true plugin: dump override-prime: | craftctl default ${CRAFT_PART_SRC}/bin/graphics-core22-cleanup mesa-core22 nvidia-core22 prime: - bin/graphics-core22-wrapper cleanup: after: [graphics-core22] plugin: nil build-snaps: [core22, gtk-common-themes, gnome-42-2204] override-prime: | set -eux for snap in "core22" "gtk-common-themes" "gnome-42-2204"; do cd "/snap/$snap/current" && find . -type f,l -name *.so.* -exec rm -f "$CRAFT_PRIME/{}" \; done ``` In non-remote builds we do use lint part only disabled it for remote-builds. ### Relevant log output --> https://launchpadlibrarian.net/678501471/buildlog_snap_ubuntu_jammy_amd64_lutris_BUILDING.txt.gz ### Additional context This error recently occurs no such errors were faced earlier i.e June and before.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed in craft-archives 1.1.3 via canonical/craft-archives#96 (06b1ca2), reordering dpkg options so --root precedes --add-architecture; rolled out via Snapcraft candidate.
stealth/space-bunny-alpha — closed resolved Fixed in craft-archives 1.1.3 via canonical/craft-archives#96 (06b1ca2), reordering dpkg options so --root precedes --add-architecture; rolled out via Snapcraft candidate.
stealth/space-bunny-alpha — closed resolved Fixed in craft-archives 1.1.3 via canonical/craft-archives#96 (06b1ca2), reordering dpkg options so --root precedes --add-architecture; rolled out via Snapcraft candidate.
stealth/space-bunny-alpha — closed resolved Fixed in Snapcraft’s candidate channel by placing --root before --add-architecture, avoiding dpkg’s “takes exactly one argument” error.
qwen/qwen3.6-35b-a3b — — Fixed in Snapcraft candidate channel. --root was incorrectly placed before --add-architecture. Maintainers confirmed the argument order bug and directed users to the candidate channel for the fix, pending release after other architecture issues resolve.
qwen/qwen3.6-35b-a3b — — Fixed by correcting the dpkg command argument order so --add-architecture precedes --root. The change was merged and released in a newer Snapcraft version, resolving the multi-architecture package repository build failure.
qwen/qwen3.6-35b-a3b — — Fixed in Snapcraft by correcting the dpkg argument order so --add-architecture precedes --root. Resolved and released via the candidate channel.
qwen3.6-35b-a3b-mtp-q6 — — A dpkg argument ordering bug caused snapcraft builds to fail with package-repositories. Maintainers confirmed the cause and directed users to a candidate release that fixes the order. The issue was closed as resolved in the updated Snapcraft version.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/craft-archives#96 (confidence 99%)

    Merged as commit 06b1ca2 and released in craft-archives 1.1.3.

  • Related To: canonical/snapcraft#4298 (confidence 98%)

    Reported the same dpkg architecture-option failure and was closed as a duplicate.

Related issues

Issue Project State Summary Similarity
#4298 pkg: error: --add-architecture takes exactly one argument snapcraft closed Duplicate of #4289; the underlying dpkg architecture regression was fixed in craft-archives 1.1.3 via PR #96 (commit 06b1ca2).
81%
#1973213 package-repositories with i386 doesn't enable the arch snapcraft (launchpad) closed Fixed by merged PR canonical/snapcraft#3740: package-repository architectures now run dpkg --add-architecture. Merge commit: 7b848f76d.
76%
#314 Replace dpkg-architecure calls in tests snapcraft merged PR #314 (sergiusens) merged, replacing tests' direct dpkg-architecture invocations with Snapcraft architecture helpers so the dependency is captured in snapcraft.yaml. Fixes LP bug #1544340.
73%
#2592 docker/bin/snapcraft-wrapper: use dpkg for architecture snapcraft closed PR #2592 was closed unmerged after its requested dpkg-based architecture change remained unfinished; the author questioned whether overriding SNAP_ARCH made it unnecessary.
73%
#4303 requirements: bump craft-archives snapcraft merged Merged #4303, bumping craft-archives to 1.1.3 to correct dpkg argument ordering and enable only compatible repository architectures; fixes #4289 and #4298.
72%
#96 sources: only add "compatible" architectures craft-archives merged Merged as craft-archives commit 06b1ca2: fixes dpkg --add-architecture argument order and only adds host-compatible archs (amd64→i386, arm64→armhf). Shipped in 1.1.3, whose changelog was added in #97.
71%
#1989012 package-repositories assumes architecture snapcraft (launchpad) open Snapcraft 7.1.3 injects Architectures: arm64 into an APT source when package-repositories omits architectures; the report is old, untriaged, and may be superseded by later craft-archives handling.
70%