How to Run 32-bit Apps in 64-bit Linux

Most Linux distributions have 64-bit versions for x86_64 processors, such as the AMD Athlon II or the Intel Xeon. Since these distributions maintain their own package repositories, they usually provide binary packages for all of their supported applications. If you are completely content with your out-of-box Linux installation, you may never need to run a 32-bit program.

Some commercial Linux software, particularly games, only provide 32-bit versions. In these rare cases, you will need to configure your 64-bit machine to run 32-bit software.

Install the 32-bit libraries

Because x86_64 processors are designed over x86 technology, they are still able to support 32-bit programs without any hardware emulation, like what you would need to run x86 programs in a PowerPC or Sparc environment.  In Linux, all you need to do is install the necessary software libraries to run the 32-bit software. Fortunately, many Linux distributions package these libraries for you. In Ubuntu, for example, the package is called ia32-libs. To install it, just open a terminal window and type:

You can also install it graphically from within Synaptic or Kpackagekit on Kubuntu.

Once installed, applications like Skype and games like World of Padman should work without further configuration.

GTK Issues

When running 32-bit programs in a 64-bit environment, Ubuntu still looks for the default GTK engines. This will cause you to receive an error such as this: “wrong ELF class”. This type of error can be particularly annoying in applications like Chromium, the new open source version of the Google Chrome browser.

Ubuntu does actually install the default 32-bit version of the GTK engines in /usr/lib32/gtk-2.0, but what I discovered in my case was that GTK themes like the one I was using, qtcurve, were not found in this directory.  The result was really ugly GTK programs.

The quick solution was to do the following:

1. Find the 32-bit package of the theme you are using.  In my case, I searched ubuntu packages.

2. Download the package and extract its contents like you would a normal compressed file.

3. Find the library file for the theme. For qtcurve it was found at ~/download-directory/usr/lib/gtk-2.0/2.10.0/engines/libqtcurve.so.

4. Copy the library to the lib32 directory:

For Chromium this was all that was required because the Chromium startup script was already configured to look in /usr/lib32/gtk-2.0. If the startup script of the program you are running does not look there but instead looks to /usr/lib/gtk-2.0, you will need to modify the startup script or export an environment variable before starting it by opening a terminal window and typing:

If there is no startup script for the program, you could create one with the above environment variable set.

If All Else Fails

I have found some applications, such as Boxee, refuse to behave nicely in a 64-bit environment under any normal circumstances, even with ia32-libs installed. The only viable alternative besides chucking your 64-bit machine or chucking the software is to run it in a chroot environment. This literally installs an entire 32-bit version of your operating system within a directory on your computer. It will take more space than simply installing a few libraries, but it ensures that all of the 32-bit components, including 3D graphics kernel modules, are installed.

You can read a guide to setting up a 32-bit chroot on Ubuntu Forums.

14 comments

  1. @Alex, you say “just” as if it’s easier, but the instructions involve repartitioning the hard drive and other steps that go well beyond the needs of someone who just wants to run a few 32-bit applications.

    • The whole instruction was to convert 64 bit XEN Debian VM into 32 bit userspace keeping 64 bit up to date kernel.
      32bit userspace saves about 60% of RAM (compared to 64bit). It is an especial issue on a hosted XEN account where $/RAM/Month matters. My hoster allows only 64 bit kernels and very limited rescue image where even /mnt is readonly.

  2. This is an ubuntu/debian only problem.

    RPM-based Redhat/Fedora/SuSE had no problem to switch to lib64 and lib because of their stricter rpm build process. And the package manager often installs both libraries: 64 bit and 32 bit without asking.

    DEB build rules are so loose that it is not trivial to switch to lib64/lib or lib/lib32 by setting a single macro to a new value (like the rpm based distros did).
    This is why 32 bit compat stuff is so complicated on ubuntu …

  3. @dag4th, while that may be true in some cases, it seems not be when it comes to proprietary apps like Skype. Fedora users, for example, still have to manually install i386 packages to get it working.

    As far as Ubuntu being complicated, I don’t see how it is. For most things, you only have to install one package: ia32-libs.

  4. Hello Tavis,

    Just wanted to say thank you for your post. I’ve been looking all over for a way to make Chrome use my QtCurve theme on my 64-bit Kubuntu, and your post finally solved it for me!

    Austin

  5. I believe its not a big problem, since that post has a link back to this post.
    Ultimately what we need is link backs,….

  6. Hi,
    Is there a way to convert a 32bit deb package to a 64bit deb package?
    I have a couple of packages (libmac-dev & libmac2) and I need to install them in my 64bit linux partition, but when I try to, the system replies “Incorrect Architecture ‘i386′”.

    Thanks in advance to your help.
    Regards!

Comments are closed.

Sponsored Stories