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

On August 14, 2009, in Uncategorized, by Dipin Krishna
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:

$ sudo apt-get install ia32-libs

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/

4. Copy the library to the lib32 directory:

$ sudo cp ~/download-directory/usr/lib/gtk-2.0/2.10.0/engines/ /usr/lib32/gtk-2.0/2.10.0/engines/

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:

export GTK_PATH=/usr/lib32/gtk-2.0

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.

Original post:


Leave a Reply