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. 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.

Setting up shared libraries

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.

Programs using SVGAlib

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. CD-ROM support requires a link to the CD-ROM device, similar to:
/emul/linux/dev/cdrom -> /dev/cd0a (first CD-ROM)


compat_linux is incomplete and currently only supported on the i386.
April 19, 2015 OpenBSD-5.9