LINUX(4)

πŸ’– LINUX(4) πŸ’–

okay bestie so this is the linux page from the Kernel Interfaces Manual β€” yes the whole vibe is "how do I run Linux stuff on FreeBSD without a whole virtual machine, because who has the RAM for that" 🌸


✨ NAME ✨

linux β€” Linux ABI support 🐧


🌈 SYNOPSIS 🌈

so to compile support for this ABI into an i386 kernel, you drop this line into your kernel configuration file:

options COMPAT_LINUX

and for an amd64 kernel you use this one instead:

options COMPAT_LINUX32

OR, if you'd rather load the ABI as a module at boot time, you put this line into loader.conf(5):

linux_load="YES"

πŸ‘‘ DESCRIPTION πŸ‘‘

The linux module gives you limited Linux ABI (application binary interface) compatibility, which means you can run a whole bunch of unmodified Linux applications and libraries without needing virtualization or emulation. no cap, it's just vibes ✨

some of the facilities it provides are:

  • An image activator for correctly branded elf(5) executable images
  • Special signal handling for activated images
  • Linux to native system call translation
  • Linux-specific system calls
okay important note bestie: dynamically linked Linux executables are gonna need a suitable environment in /compat/linux. That includes native Linux shared libraries, and Linux-specific virtual filesystems. 🫢

to set that whole thing up, install the emulators/linux_base-c7 port or the linux_base-c7 package, and add this line to the rc.conf(5) file:

linux_enable="YES"

and if you want to avoid mounting Linux-specific filesystems at startup, also add this line:

linux_mounts_enable="NO"

πŸ”₯ SYSCTL VARIABLES πŸ”₯

the following variables are available as both sysctl(8) variables and loader(8) tunables:

  • compat.linux.debug β€” enables debugging messages. Set it to 0 to silence them. Defaults to 1. 🀫
  • compat.linux.default_openfiles β€” the default soft openfiles resource limit for Linux applications. Set it to -1 to disable the limit entirely. Defaults to 1024.
  • compat.linux.emul_path β€” path to the Linux run-time environment. Defaults to /compat/linux. πŸ“
  • compat.linux.osname β€” the Linux kernel operating system name.
  • compat.linux.osrelease β€” the Linux kernel operating system release. ngl, changing this to something else is discouraged on non-development systems, because it may change the way Linux programs work. Recent versions of GNU libc are known to use different syscalls depending on the value of this sysctl. πŸ‘€
  • compat.linux.oss_version β€” the Linux Open Sound System version. πŸ”Š
  • compat.linux.preserve_vstatus β€” when set to 1, it prevents Linux applications from resetting the termios(4) VSTATUS setting. From a user perspective, this makes SIGINFO work for Linux executables. Defaults to 0.

πŸŽ€ FILES πŸŽ€

  • /compat/linux β€” minimal Linux run-time environment
  • /compat/linux/dev β€” device file system, see devfs(5)
  • /compat/linux/dev/fd β€” file descriptor file system mounted with the linrdlnk option, see fdescfs(5)
  • /compat/linux/dev/shm β€” in-memory file system, see tmpfs(5)
  • /compat/linux/proc β€” Linux process file system, see linprocfs(5)
  • /compat/linux/sys β€” Linux kernel objects file system, see linsysfs(5)

πŸ¦‹ SEE ALSO πŸ¦‹

brandelf(1), pty(4), elf(5), fdescfs(5), linprocfs(5), linsysfs(5), tmpfs(5)


⭐ HISTORY ⭐

Linux ABI support first appeared in FreeBSD 2.1. the way it's been serving looks since forever πŸ’…


πŸ’€ BUGS πŸ’€

Support for some of the Linux-specific system calls and system call arguments is missing. yeah. not everything made it to the group chat, sorry bestie 😭


and that's the whole page!! mwah πŸ’– this one came from Debian, dated July 5, 2020 β€” stay hydrated, back up your rc.conf, and go run some Linux binaries on your FreeBSD box like the icon you are πŸ‘‘βœ¨

πŸ“¦ where this page comes from