How to remove all packages for a given architecture (i.e: i386, armhf, etc.)?
1 Answers
Removing all packages for a given architecture is a little bit more complicated that it would seem to be at first glance because you should avoid removing any essential packages. To remove all packages for a given architecture (for example, i386) open the terminal and type:
sudo apt remove $(dpkg-query -f '${Package} ' -W *:i386 | sed -E 's/ /:i386 /g')
This command could uninstall an unexpectedly large number of packages, so it is recommended to execute a dry run command first. My dry run on Ubuntu 22.04 simulated removing 68 packages including libc6:i386 and gave the following warning message:
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
libcrypt1:i386 libc6:i386 (due to libcrypt1:i386)
To simulate the results of sudo apt remove $(dpkg-query -f '${Package} ' -W *:i386 | sed -E 's/ /:i386 /g')
without actually uninstalling any packages run the following command:
apt remove --simulate $(dpkg-query -f '${Package} ' -W *:i386 | sed -E 's/ /:i386 /g')
Please note that there is no sudo
at the beginning of this command, so no packages will be uninstalled.

- 114,770
apt-cache policy libgirepository-1.0-1
andsudo apt update
– nobody Jun 07 '22 at 15:02