Developing software in the Real World

Installing 32 bit packages on Ubuntu 14.04

This had me stumped for a bit, so I’ve written it down. If you have a 64 bit version of Ubuntu and want to install a 32-bit package, you simply add :i386 to the end of the package name like this:

$ sudo apt-get install libstdc++6:i386

However, this didn’t initially work for me as apt-get couldn’t find the package:

$ sudo apt-get install libstdc++6:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libstdc++6
E: Couldn't find any package by regex 'libstdc++6'

It turned out that my installation only had the 64 bit architecture configured which you can tell by running:

$ sudo dpkg --print-architecture
amd64
$ sudo dpkg --print-foreign-architectures

Note that there are no foreign architectures, which is the problem.

The solution is to add the i386 architecture first:

$ sudo dpkg --add-architecture i386
$ sudo dpkg --print-foreign-architectures
i386

That’s better! Now we need to run an update:

$ sudo apt-get update

Don’t forget this update! I did and wondered why I still had the problem…

Now the installation of the 32-bit package works:

$ sudo apt-get install libstdc++6:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  gcc-4.8-base:i386 gcc-4.9-base:i386 libc6:i386 libgcc1:i386
Suggested packages:
  glibc-doc:i386 locales:i386
The following NEW packages will be installed:
  gcc-4.8-base:i386 gcc-4.9-base:i386 libc6:i386 libgcc1:i386 libstdc++6:i386
0 upgraded, 5 newly installed, 0 to remove and 1 not upgraded.
Need to get 4,342 kB of archives.
After this operation, 11.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
... lots of lines as the library installs ...

All done!

12 thoughts on “Installing 32 bit packages on Ubuntu 14.04

  1. sudo apt-get install libstdc++6:i386
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    bind9-host : Depends: libbind9-140 (= 1:9.10.3.dfsg.P4-8ubuntu1) but it is not going to be installed
    Depends: libdns162 (= 1:9.10.3.dfsg.P4-8ubuntu1) but it is not going to be installed
    Depends: libisc160 (= 1:9.10.3.dfsg.P4-8ubuntu1) but it is not going to be installed
    Depends: libisccfg140 (= 1:9.10.3.dfsg.P4-8ubuntu1) but it is not going to be installed
    imagemagick : Depends: imagemagick-6.q16 (= 8:6.8.9.9-7ubuntu5.1)
    liblouisutdml-bin : Depends: liblouisutdml6 but it is not going to be installed
    libsane : Depends: libgphoto2-6 (>= 2.5.2) but it is not going to be installed
    libstdc++6:i386 : Depends: gcc-5-base:i386 (= 5.3.1-14ubuntu2) but it is not going to be installed
    shared-mime-info : Depends: libxml2 (>= 2.7.4) but it is not going to be installed
    upower : Depends: libimobiledevice6 (>= 0.9.7) but it is not going to be installed
    Depends: libplist3 (>= 1.11) but it is not going to be installed
    E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

  2. Still helpful with 20.04

    Will add that I removed 32 from the package name as it is implied by i386 at the end.

  3. Thanks, it works. During the process, it hinted as follows:
    You might want to run 'apt –fix-broken install' to correct these.
    I followed this command, then succeeded.

Thoughts? Leave a reply

Your email address will not be published. Required fields are marked *