Skip to content

Instantly share code, notes, and snippets.

@ThinGuy
Last active October 3, 2024 12:40
Show Gist options
  • Save ThinGuy/21e7b3bb4b63404ad87541cd0ffebf09 to your computer and use it in GitHub Desktop.
Save ThinGuy/21e7b3bb4b63404ad87541cd0ffebf09 to your computer and use it in GitHub Desktop.
Fix apt architecture error messages: "...doesn't support architecture 'i386'"
# To prevent unsuppoorted architecture error messages from apt on Ubuntu 24.04 (Noble Numbat)
# with the new apt sources format
# Example error messages on `apt update` after a fresh install:
# N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'https://packages.microsoft.com/repos/edge stable InRelease' doesn't support architecture 'i386'
# N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'https://dl.google.com/linux/chrome/deb stable InRelease' doesn't support architecture 'i386'
#################################################
### SINGLE-ARCH (i.e. fix arch-related error) ###
#################################################
# Example for X86_64 (Keeping amd64, removing i386)
[[ $(dpkg --print-foreign-architectures) =~ i386 ]] && { sudo dpkg --remove-architecture i386; }
sudo sed -r -i '/^Arch/d;s/URIs:/Architectures: amd64\n&/g' /etc/apt/sources.list.d/*.sources
# Example for ARM64 (Keeping arm64, removing armhf)
[[ $(dpkg --print-foreign-architectures) =~ armhf ]] && { sudo dpkg --remove-architecture armhf; }
sudo sed -r -i '/^Arch/d;s/URIs:/Architectures: arm64\n&/g' /etc/apt/sources.list.d/*.sources
#################################################
### MULTI-ARCH (i.e. for cross compiling) ###
#################################################
# Supported Debian architecture names by Ubuntu release:
#
# Ubuntu 16.04 (Xenial Xerus): amd64, i386, arm64, armhf, powerpc, ppc64el, s390x
# Ubuntu 18.04 (Bionic Beaver): amd64, i386, arm64, armhf, ppc64el, s390x
# Ubuntu 20.04 (Focal Fossa): amd64, i386, arm64, armhf, ppc64el, riscv64, s390x
# Ubuntu 22.04 (Jammy Jellyfish): amd64, i386, arm64, armhf, ppc64el, riscv64, s390x
# Ubuntu 24.04 (Noble Numbat): amd64, i386, arm64, armhf, ppc64el, riscv64, s390x
# Ubuntu 24.10 (Oracular Oriole): amd64, arm64, i386, ppc64el, riscv64, s390x
# First add the architectures desired
for A in amd64 arm64 riscv64 do;
[[ $(dpkg --print-foreign-architectures) =~ ${A} ]] || { sudo dpkg --add-architecture ${A}; }
done
# NOTE: Use space-separated debian machine architecture names for multi arch
sudo sed -r -i '/^Arch/d;s/URIs:/Architectures:\x20amd64\x20arm64\x20riscv64\n&/g' /etc/apt/sources.list.d/*.sources
@ThinGuy
Copy link
Author

ThinGuy commented Sep 25, 2024

You can't change them, you can only remove them.

sudo apt purge ".*:i386"

Then you should be able to remove the i386 architecture.

@drjvtlkr
Copy link

drjvtlkr commented Oct 3, 2024

Hey Craig, thank you for your response, but I had resolved this issue a while back. I did make use of the same command to move ahead . Thanks again🙌🏻.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment