OpenBSD manual page server

Manual Page Search Parameters

COMPAT_LINUX(8) System Manager's Manual COMPAT_LINUX(8)

compat_linuxsetup for running Linux binaries under emulation

OpenBSD supports running Linux binaries. This only applies to i386 systems and the ELF binary format. Most programs should work, including the ones that use the Linux SVGAlib. Additionally, OSS audio is emulated, so Linux binaries can access the native audio transparently. Programs that will not work include those that use i386-specific calls, such as enabling virtual 8086 mode.

The Linux compatibility feature is active for kernels compiled with the COMPAT_LINUX option and kern.emul.linux sysctl(8) enabled.

A lot of programs are dynamically linked. This means that the Linux shared libraries that the programs depend on and the runtime linker are also needed. Additionally, a "shadow root" directory for Linux binaries on the OpenBSD system will have to be created. This directory is named /emul/linux. Any file operations done by Linux programs run under OpenBSD will look in this directory first. So, if a Linux program opens, for example, /etc/passwd, OpenBSD will first try to open /emul/linux/etc/passwd, and if that does not exist open the `real' /etc/passwd file. It is recommended that Linux packages that include configuration files, etc., be installed under /emul/linux, to avoid naming conflicts with possible OpenBSD counterparts. Shared libraries should also be installed in the shadow tree.

Run pkg_add(1) to install the fedora_base package from the emulators category. The fedora_base package contains the shared libraries, binaries, and other related files necessary to run Linux applications.

SVGAlib binaries require some extra care. The pcvt virtual console driver has to be in the kernel for them to work, and some symbolic links in the /emul/linux/dev directory will have to be created, namely:

/emul/linux/dev/console -> /dev/tty
/emul/linux/dev/mouse -> whatever device the mouse is connected to
/emul/linux/dev/ttyS0 -> /dev/tty00
/emul/linux/dev/ttyS1 -> /dev/tty01

Be warned: the first link mentioned here makes SVGAlib binaries work, but may confuse others, so it may be necessary to remove it again at some point.

Only the DSP device is emulated, the following link should be created:

/emul/linux/dev/dsp -> /dev/audio

CD-ROM support requires a link to the CD-ROM device, similar to:

/emul/linux/dev/cdrom -> /dev/cd0a (first CD-ROM)

Many Linux binaries expect /proc to have procfs mounted on it. Some binaries will require it to be mounted using the -o linux option.

compat_linux is incomplete and currently only supported on the i386.

February 17, 2014 OpenBSD-5.6