Ubuntu – Why does the 64-bit system look for 32-bit repos

aptmultiarch

I've got a 64-bit 12.10 install on my Laptop. When running apt-get update, it downloads package lists for 32-bit packages (as well as source and 64-bit package lists). Why does it look for 32-bit package lists on a 64-bit system? I've included one of the items it tries to find below.

http://us.archive.ubuntu.com/ubuntu/dists/quantal-backports/multiverse/binary-i386/Packages

Best Answer

Confusing, isn't it? Let me explain a bit.

Why?

  • 32-bit software runs fine on a 64-bit kernel with 64-bit capable hardware.
  • Some software still relies on specific 32-bit libraries. This is not nice, but sometimes we don't have the power to change this.
  • 32-bit software has to be available to the system to satisfy the dependencies, so it uses the 32-bit repositories as well.

I'm from early 2011. What happened?

In 64-bit versions of Ubuntu before 11.10, some set of common 32-bit libraries were packaged in a single ia32-libs package represented to APT/Dpkg as being 64-bit and in such a location in the repository. If you happen to need a single library for an application, it would depend on the 150+ MB of 32-bit libraries1. Clearly, this is not a nice design.

Multiple architectures?

The new idea was to introduce so-called "Multiarch" capabilities to APT/Dpkg and the tools around it. This was presented in several blueprints on Launchpad, here is one of them. Oneiric (11.10) became the first release that supported Multiarch.

How does it work?

You can tell Dpkg what architectures your system is capable running. On my 12.04 64-bit installation, this is here:

$ cat /etc/dpkg/dpkg.cfg.d/multiarch 
foreign-architecture i386

It opens the whole world of i386 packages, with amd64 still being the default:

$ apt-cache show libqt4-core                   | grep -E "^(Filename|Architecture)"
Architecture: amd64
Filename: pool/universe/q/qt4-x11/libqt4-core_4.8.1-0ubuntu4.3_amd64.deb

$ apt-cache show libqt4-core:i386              | grep -E "^(Filename|Architecture)"
Architecture: i386
Filename: pool/universe/q/qt4-x11/libqt4-core_4.8.1-0ubuntu4.3_i386.deb

The above example shows that Multiarch enables package maintainers to simply make their packages depend on libqt4-core:i386 for example, and makes it possible to install any 32-bit library/package (and thus to install any package that depends on any 32-bit library/package), rather than a preselected set.

ia32-libs compatibility

In case you were used to install the ia32-libs package as a convenience package to install a common set of basic 32-bit libraries, you can now use ia32-libs-multiarch Install ia32-libs-multiarch. This is a simple metapackage depending on the same (or at least very similar) set of libraries, but it will be installed with the power of Multiarch.

Further related readings

1 For Lucid (10.04) the ia32-libs package install size is 155,812.0 kB.