Running 32 bit binaries on x86_64


I need to work with some proprietary program compiled as a 32 bit executable and I’m not sure how to run it.

I’ve replaced the interpreter using the patchelf command, however now I get a “corrupted shared library” error instead of a “file not found error”.

Can someone point me to relevant documentation or examples?


For examples, you could look at It contains many games that were packaged. Games are good examples of binary blobs that need patching, and some of them are 32 bits.

In particular, have a look at vuizvui/default.nix at master · openlab-aux/vuizvui · GitHub and

Thanks, the example are on the spot.

Now the problem I’m facing is the need to run the program (an installer) as root. Since I’d like to create a package I tried with fakechroot however it fails with

ERROR: object '' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored. 

it tried without success with:

let fakechroot32 = import <nixos/pkgs/tools/system/fakechroot> {
stdenv_32bit.mkDerivation rec {
	nativeBuildInputs = [ glibc_multi fakechroot32 utillinux ];

Do you have more suggestions?

I would try writing a normal derivation as if everything is 32-bit then
use pkgsi686Linux.callPackage to call it.

Or try pkgs.i686Linux.libfakechroot.

1 Like

the trick is to use callPackage_i686:

let fakechroot32 = callPackage_i686 <nixos/pkgs/tools/system/fakechroot> {};

stdenv_32bit is a confusing name. On a 64-bit system it’s a stdenv that is run in 64-bit mode and can produce both 32-bit and 64-bit binaries.