dpkg --add-architecture fails when using package-repositories
Metadata
Current evaluation
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.
Suggested action: —
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 |
|---|---|---|---|---|
| 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Root cause identified as incorrect dpkg argument order. Fix directed to candidate channel pending other architecture fixes. Issue closed. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1989012 package-repositories assumes architecture | snapcraft (launchpad) | open | snapcraft 7.1.3 incorrectly assumes architecture in package-repositories, hardcoding it in generated .sources files instead of omitting the field when not specified. | |
| #4298 pkg: error: --add-architecture takes exactly one argument | snapcraft | closed | Closed as a duplicate of #4289. The failure stemmed from incorrect dpkg argument ordering, requiring --add-architecture before --root. Resolved by correcting the command sequence in the installer. |