46

Over the time I installed many i386 packages, which I no longer need. How can I clean up the system and stay only with the amd64 packages?

Ankit
  • 6,989
yossile
  • 5,828

7 Answers7

44

The other automated solutions are dangerous and not always working (1), so here another way

sudo aptitude purge `dpkg --get-selections | grep ":i386" | awk '{print $1}'`

or

sudo apt-get purge `dpkg --get-selections | grep ":i386" | awk '{print $1}'`

(Try to use always and only one of the tools. Since aptitude is better when having dependency trouble, I prefer that.)

Good idea to also

dpkg --remove-architecture i386

and maybe

dpkg --print-foreign-architectures

(1) The other commands also lists packages having only i386 in their name (although they are for 64bit architecture), the regular expression didn't work and dpkg shows packages which are already removed, but still have configuration files left (dpkg -l shows "rc" instead of "ii" as status).

PythoNic
  • 706
24

I blitzed all my 32bit packages like this:

sudo apt-get remove `dpkg --get-selections | grep i386 | awk '{print $1}'`
RickyB
  • 476
19

If they are not in your way, I would leave them where they are.

If you insist on deletion, use dpkg -l | grep i386 to create a list of i386-packages. You can delete these after careful checking with something like sudo apt-get purge <package-name>.

Pablo Bianchi
  • 17,371
Henk
  • 388
16

The debian's multiarch guide mentions this command: apt-get purge ".*:<arch>", which would look like this for i386:

sudo apt-get purge ".*:i386"

You can then remove the architecture from dpkg:

sudo dpkg --remove-architecture i386
Francisco
  • 263
  • 2
  • 6
10

In case anyone is wondering, there's a much more sane and graceful way to do this. The last previous answer hopes to do the same thing, but that search fails since architectures are not actually part of package names, except in special cases.

as root (or with sudo) run:

aptitude remove ~i~ri386

If you don't use aptitude over apt-get already, do. It's really excellent. You can find a list of aptitude's search terms here.

Patrick
  • 101
6

There is another way of lower risk:

sudo apt-get remove "^.*:i386$"

This will specifically match only packages ending with ":i386", which is the standard naming convention for all i386 architecture Debian packages.

Pablo Bianchi
  • 17,371
kevinarpe
  • 181
  • 1
  • 4
0
  1. List the package list:
    sudo dpkg --list | grep :i386

  2. Remove :i386 packages one by one:
    sudo dpkg --purge --force-all package-name

  3. As for an example:
    sudo dpkg --purge --force-all libc6:i386

  4. Then remove the architecture:
    sudo dpkg --remove-architecture i386

  5. Run update and upgrade:
    sudo apt update && sudo apt upgrade -y


    This worked for me.