How to fix dpkg: error: --add-architecture needs exactly one argument in APT
The dpkg --add-architecture command failed because extra arguments were passed. This error occurs when trying to add a foreign architecture to your system for multiarch support, but additional unexpected options like --root are included. Fix it by passing only the architecture name as a single argument.
Quick fix
Fixes dpkg: error: --add-architecture needs exactly one argument
# Examples of INCORRECT syntax that cause this error:
dpkg --add-architecture i386 --root / # Extra flag
dpkg --add-architecture i386 arm64 # Multiple architectures
dpkg --add-architecture "i386" extra # Extra argument- Check the current syntax you are using
- Use the correct dpkg --add-architecture syntax
- If adding multiple architectures, run separate commands
- Update package lists after adding the architecture
# Examples of INCORRECT syntax that cause this error:dpkg --add-architecture i386 --root / # Extra flagdpkg --add-architecture i386 arm64 # Multiple architecturesdpkg --add-architecture "i386" extra # Extra argumentdpkg: error: --add-architecture needs exactly one argument
What this error means
The dpkg --add-architecture command is used to enable multiarch support on Debian and Ubuntu systems, allowing you to install packages from different architectures (e.g., 32-bit packages on a 64-bit system). This command is very strict about its arguments and accepts exactly one parameter: the architecture name (like i386, arm64, or armhf). When dpkg detects that you've passed more than one argument or unexpected options to --add-architecture, it rejects the command and displays this error. This is a safety mechanism to prevent misconfiguration of your system's multiarch settings.
Typical symptoms
- Command fails when running dpkg --add-architecture with additional flags
- Error message explicitly states "needs exactly one argument"
- Unable to enable multiarch support on the system
- apt-get update or apt-get install fails when trying to use foreign architecture packages
- Wrapper scripts or automation tools fail when setting up multiarch
Common causes
- Passing multiple architecture names: dpkg --add-architecture i386 arm64 (should be separate commands)
- Including additional dpkg options with --add-architecture: dpkg --add-architecture i386 --root /
- Using --add-architecture with unsupported flags like --force or --no-warn
- Spacing or quoting issues causing the argument to be split incorrectly
- Calling dpkg --add-architecture from an automated script that appends extra parameters
How to fix "dpkg: error: --add-architecture needs exactly one argument"
First, review the exact command you ran that produced the error. Look for any extra flags or arguments after the architecture name.
# Examples of INCORRECT syntax that cause this error:
dpkg --add-architecture i386 --root / # Extra flag
dpkg --add-architecture i386 arm64 # Multiple architectures
dpkg --add-architecture "i386" extra # Extra argumentThe --add-architecture command takes exactly one argument: the architecture name. Remove any additional flags or arguments.
# Correct syntax:
sudo dpkg --add-architecture i386
sudo dpkg --add-architecture arm64
sudo dpkg --add-architecture armhfCommon valid architecture names:
- i386 - 32-bit x86
- amd64 - 64-bit x86 (usually the default)
- arm64 - 64-bit ARM
- armhf - 32-bit ARM with hardware floating point
- armel - 32-bit ARM with soft floating point
- ppc64el - 64-bit PowerPC (little-endian)
If you need to enable support for multiple foreign architectures, run dpkg --add-architecture once for each architecture:
sudo dpkg --add-architecture i386
sudo dpkg --add-architecture arm64
sudo apt-get updateDo not attempt to pass multiple architectures in one command.
After successfully adding the architecture, update your package lists so apt is aware of packages available for the new architecture:
sudo apt-get updateYou can now install packages for that architecture using the syntax package:architecture. For example:
sudo apt-get install libc6:i386 # Install 32-bit libc6
sudo apt-get install wine:i386 # Install 32-bit WineConfirm that the architecture is now registered on your system:
# View your system's native architecture:
dpkg --print-architecture
# View all foreign architectures you've added:
dpkg --print-foreign-architecturesThe architecture you added should appear in the output of the second command.
Advanced notes
If your version of dpkg does not support the --add-architecture option (found on very old Ubuntu versions prior to 12.04 LTS or Debian versions before the multiarch implementation), you can manually configure multiarch by creating a configuration file:
sudo sh -c "echo 'foreign-architecture i386' > /etc/dpkg/dpkg.cfg.d/multiarch"
sudo apt-get updateThis manual approach bypasses the dpkg command and directly configures the system.
To remove a foreign architecture later if you no longer need it, use: sudo dpkg --remove-architecture i386 (replacing i386 with your architecture). Note that all packages of that architecture must be removed first, or dpkg will report "currently in use by the database".
Frequently asked questions
- What does "dpkg: error: --add-architecture needs exactly one argument" mean?
- , 32-bit packages on a 64-bit system). This command is very strict about its arguments and accepts exactly one parameter: the architecture name (like i386, arm64, or armhf). When dpkg detects that you've passed more than one argument or unexpected options to --add-architecture, it rejects the command and displays this error.
- How do I fix "dpkg: error: --add-architecture needs exactly one argument"?
- The dpkg --add-architecture command failed because extra arguments were passed. This error occurs when trying to add a foreign architecture to your system for multiarch support, but additional unexpected options like --root are included. Fix it by passing only the architecture name as a single argument.
- What causes "dpkg: error: --add-architecture needs exactly one argument"?
- Passing multiple architecture names: dpkg --add-architecture i386 arm64 (should be separate commands) Including additional dpkg options with --add-architecture: dpkg --add-architecture i386 --root / Using --add-architecture with unsupported flags like --force or --no-warn
- Is the "dpkg: error: --add-architecture needs exactly one argument" error serious?
- It is a low-severity error โ more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- ๐APT Official Documentation
- ๐Debian Wiki: Multiarch HOWTO(Official Docs)
- ๐Debian Wiki: Multiarch Implementation(Official Docs)
- ๐Snapcraft Issue #4298(GitHub)