LinuxCommandLibrary

linux32

Run 32-bit programs on a 64-bit system

TLDR

View documentation for the original command

$ tldr setarch
copy

SYNOPSIS

linux32 command [arguments...]

PARAMETERS

command
    The executable program or script to be run with a 32-bit personality.

[arguments...]
    Optional arguments that will be passed directly to the command.

DESCRIPTION

The linux32 command facilitates the execution of a specified program as if it were running on a 32-bit x86 (i386/i686) Linux environment, even when the host operating system is natively 64-bit (x86-64). This crucial compatibility utility achieves its function by modifying the 'personality' of the current process before invoking the target command. The kernel's personality mechanism adjusts how system calls are interpreted, how the kernel perceives the process's architecture, and ensures that the invoked program operates within a 32-bit Application Binary Interface (ABI).

This command is invaluable for ensuring backward compatibility with legacy 32-bit applications, binaries, or libraries that may not function correctly or at all in a pure 64-bit environment. Such applications often rely on specific 32-bit system call behaviors or library paths that differ from their 64-bit counterparts. While linux32 provides a convenient wrapper, its core functionality is frequently implemented via the more general setarch i386 or setarch i686 command, which allows more granular control over execution domain parameters. For successful execution, appropriate 32-bit user-space libraries must be installed on the 64-bit system.

CAVEATS

Running 32-bit programs on a 64-bit system with linux32 typically requires the installation of corresponding 32-bit user-space libraries (e.g., libc6-i386, ia32-libs packages on some distributions). Without these, 32-bit binaries will fail due to missing shared libraries. Not all 32-bit applications are guaranteed to run perfectly; some may have deeper dependencies or assumptions that personality changes alone cannot resolve. linux32 is often a symbolic link or script wrapper for setarch i386 or setarch i686, meaning its behavior aligns with that underlying command.

32-BIT LIBRARY REQUIREMENTS

For linux32 to successfully execute a program, the target 64-bit Linux system must have the necessary 32-bit user-space libraries installed. These libraries, such as the 32-bit version of glibc (libc.so.6), are crucial for resolving shared library dependencies of 32-bit executables. Most modern distributions provide multi-arch capabilities that allow the simultaneous installation of both 32-bit and 64-bit libraries.

UNDERLYING KERNEL MECHANISM

The core of linux32's functionality relies on the Linux kernel's personality(2) system call. This system call allows a process to change its execution domain, effectively telling the kernel to treat subsequent system calls and certain process behaviors as if they originated from a different architecture (e.g., PER_LINUX32 for 32-bit Linux ABI). While linux32 provides a simple interface, setarch offers more generalized control over these personality settings.

HISTORY

The development of linux32 is intrinsically linked to the transition of Linux systems from 32-bit to 64-bit x86 architectures. As 64-bit kernels became standard, maintaining backward compatibility with a vast ecosystem of existing 32-bit applications became a necessity. The kernel's personality system call, introduced early in the x86-64 era, provided the foundational mechanism for a process to declare its desired ABI. Commands like setarch expose this functionality to users. linux32 emerged as a convenient, specialized wrapper or alias, simplifying the process of launching 32-bit programs without requiring users to remember the specific setarch architecture flags (e.g., i386 or i686), thus making compatibility more accessible.

SEE ALSO

setarch(8), personality(2), arch(1), uname(1)

Copied to clipboard