Ubuntu – Can’t install i386 packages on Ubuntu 18.04

command line

I am using the version Ubuntu 18.04.4 trying to add i386. I Have tried to install it via the command:

echo "foreign-architecture i386" > /etc/dpkg/dpkg.cfg.d/multiarch

And I get the eror

bash: /etc/dpkg/dpkg.cfg.d/multiarch: Permission denied

I already tried to use the methods:

  • echo "foreign-architecture i386" > /etc/dpkg/dpkg.cfg.d/multiarch


  • sudo dpkg --foreign-architecture i386

I simply get no output out of any of these. I have already tried to use the command:

sudo dpkg --add-architecture i386

It puts the output:

dpkg: error: configuration error: /etc/dpkg/dpkg.cfg.d/architectures:1: unknown option 'foreign-architecture'

I have tried to check if it is already installed or not via the command:

sudo dpkg --print-foreign-architectures

which I get the same bug with the previously mentioned command. I have tried to purge it with the command:

sudo apt-get purge ".:i386"

Which returned the eror code of:

E: Sub-process dpkg --set-selections returned an error code (2)
E: Couldn't record the approved state changes as dpkg selection states

These are the references of pages I have used but couldn't get any answers from:

Thanks in advance.

Best Answer

First remove the disturbing file

sudo rm /etc/dpkg/dpkg.cfg.d/multiarch    

Then you can add it with

sudo dpkg --add-architecture i386