Linux binary compatibility, commonly referred to as Linuxulator, is a mechanism to run unmodified Linux binaries under FreeBSD. It does not involve virtual machines or emulation; instead, it provides the binaries with kernel interfaces identical to those provided by a real Linux kernel. Technically it's similar to the way 32-bit FreeBSD binaries run on top of 64-bit FreeBSD kernel.

There are two main ways to use Linuxulator. First, documented in the FreeBSD Handbook, uses Linux applications provided as FreeBSD ports and packages, to be installed using pkg(8). Second, described at LinuxJails, provides a full Ubuntu userspace. The former is more user-friendly, but provides a limited number of available applications. The latter is more cumbersome, but is handy when doing development work. Both can be used at the same time.

Current state

The list of currently tested applications can be found at LinuxApps. For Steam, it's suggested to use the linux-steam-utils package; status of games tested with it can be found here.

Development efforts

The goal is to implement as many Linux syscalls as possible, except for ones that are obsolete, and ones that are only used for management purposes. We are currently claiming compatibility with Linux 2.6.32 (3.10.0 in 13-CURRENT, which is also the version provided by CentOS 7). Newer distros might break due to glibc 2.24 requiring kernel 3.2 (fixed in 13-CURRENT, see r351783). Some of the syscalls are not yet implemented.

Test equipment

LTP

Very easy to set up:

  1. Install devel/linux-ltp port, or linux-c7-ltp package
  2. cd into /compat/linux/opt/ltp and initiate a full LTP test run with "./runltp -p -l/var/tmp/results-log -o/var/tmp/results-output -C/var/tmp/results-failed -d/tmp"

Keep an eye on /compat/linux/tmp between tests and clean it up. You should also run "ipcs" and remove some leftover (compare before and after each run).

Current LTP results can be found here. Results for some of the older releases can be found here.

Debugging

FreeBSD's truss(1) and ktrace(1) can trace Linux binaries and decode the syscall names, but they don't support decoding Linux arguments into human-readable form. Linux strace(1) does, though - it can be installed from devel/linux-c7-strace port, or the linux-c7-strace package.

Linux core dumps are, from what I understand, not functional yet.

Missing stuff

The canonical list of unimplemented syscalls can be found at sys/amd64/linux/linux_dummy.c. The ones marked UNIMPLEMENTED() are not supposed to be ever supported, usually because they have been obsoleted upstream. The list below is somewhat stale.

The syscalls(2) manual is a list of all syscalls <= linux-2.6-mainline including references to the linux kernel version each syscall first appeared. This document is part of the Linux man-pages project maintained by Michael Kerrisk. Note that in Linux, there are differences in syscalls supported by each architecture, there's a website tracking this.

Syscalls

syscall

status

add_key

not started

adjtimex

not started

capget

not started

create_module

will not be implemented

fadvise64(_64)

not started, used by gnu-sort, ...

fstatfs64

not started

futex

in RELENG_8_0+, problems when swapping out/mmaping etc., no support for clockrt (FUTEX_CLOCK_REALTIME [op=265]), additional patches available

inotify_add_watch

not started

inotify_init

not started

inotify_rm_watch

not started

io_cancel

not started

io_destroy

not started

io_getevents

not started

io_setup

not started

io_submit

not started

ioprio_get

not started

ioprio_set

not started

keyctl

not started, used by sshd, cron, ...

lookup_dcookie

implemented in RELENG_8_0+

mbind

not started

prctl

partially implemented

quotactl

not started

readahead

implemented in RELENG_8_0+

remap_file_pages

not started

sendfile

implemented in 13-CURRENT, r357577

sendfile64

implemented in 13-CURRENT, r357577

setfsgid

not started

setfsuid

not started

set_mempolicy

not started

swapoff

not started

sysfs

not started

syslog

not started

unshare

not started

vhangup

not started

xattr

In Review

ioctl

type

status

used by

0x541c ('T',28)

not implemented

consoletype

0x5801 ('X',1)

not implemented

quake4.x86

0x6d02 ('m',2)

not implemented

dd

0x8905 ('M',5)

not implemented

ltp-20090930 (sockioctl01)

0x8910 ('M',16)

not implemented

quake4.x86, opera 11

0x8914 ('M',20)

not implemented

ltp-20090930 (sockioctl01)

futex operators and flags

operator

status

FUTEX_WAIT

implemented

FUTEX_WAKE

implemented

FUTEX_FD

abandoned in 2006; removed in 2008 (2.6.26)

FUTEX_REQUEUE

?

FUTEX_CMP_REQUEUE

implemented

FUTEX_WAKE_OP

implemented

FUTEX_LOCK_PI

unimplemented

FUTEX_UNLOCK_PI

unimplemented

FUTEX_TRYLOCK_PI

unimplemented

FUTEX_WAIT_BITSET

implemented in 9.0 (r218117)

FUTEX_WAKE_BITSET

implemented in 9.0 (r218117)

FUTEX_WAIT_REQUEUE_PI

unimplemented

FUTEX_CMP_REQUEUE_PI

unimplemented

FUTEX_PRIVATE_FLAG

ignored

FUTEX_CLOCK_REALTIME

ignored

PRs

There's an umbrella ticket for tracking Linuxulator-related PRs: 247219

TODO

Bugs

A note to users: Feel free to read the following list of things to fix, but do not make conclusions out of it. The linux compatibility environment runs just fine. There are some broken edge cases which don't affect the daily use. The following list is only meaningful for developers. Just because something is marked as a bug, it doesn't mean it doesn't work. It may be the case that some obscure error condition does not return the expected error value, or that a seldomly used feature is not implemented.


CategoryProject

Linuxulator (last edited 2020-07-27 18:26:54 by EdMaste)