Linux® Binary Compatibility allows users to run many Linux applications on MidnightBSD without modification. Originally, MidnightBSD only supported 32bit executables, but MidnightBSD 1.0 introduced 64bit compatibility.
Not all Linux applications will work on MidnightBSD. For example, any apps that use i386™ specific calls, such as enabling virtual 8086 mode, or that make use of newer Linux system calls that have not been implemented yet.
Currently, we emulate a Linux 2.6.32 kernel. Older releases supported older kernels such as 2.6.16 or 2.4.x. It is possible to use a newer userland from popular distros on older kernels due to glibc backward compatibility.
To enable Linux compatibility, you will need to first load a kernel module for either 32bit or 64bit support. The latter only works on amd64.32bit:
To make this permanent, you can add it to /etc/rc.conf as linux_enable="YES", or possibly just add the kernel module to /boot/loader.conf as linux_load="YES"
You must also install a userland for linux apps. This is the native libraries that come with Linux distros. For recent releases, use this:
mport install linux_base-c7
Older releases used linux_base-fc4. This is also in mports in emulators/
Linux files live in /compat/linux and you can add your own linux compiled libraries in that environment.
Elf binaries sometimes need to be marked as Linux to run properly. If you get an error about unknown elf type then simply do this
brandelf -t Linux my-linux-elf-binary
If you need to use RPMs to install packages, first install the archivers/rpm4 port or mport install rpm4. Then run this
rpm2cpio < /path/to/linux.archive.rpm | cpio -id
You may also need to setup the resolver. Add a file /compat/linux/etc/host.conf with the following:
order hosts, bind multi on