LINUX(4)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1, nixpkgs unstable

πŸ’– LINUX(4) β€” linux ABI support πŸ’–

Ok bestie, welcome to LINUX(4) from the Kernel Interfaces Manual β€” this is the page for linux, aka Linux ABI support. It’s giving β€œrun Linux apps on FreeBSD” energy and honestly? Iconic. πŸ¦‹

🌸 NAME 🌸

linux β€” Linux ABI support

✨ SYNOPSIS ✨

To enable the Linux ABI at boot time, place the following line in rc.conf(5):

linux_enable="YES"

πŸ¦‹ DESCRIPTION πŸ¦‹

The linux kernel module provides limited Linux ABI (application binary interface) compatibility, making it possible to run many unmodified Linux applications without the need for virtualization or emulation. Some of the facilities provided are:

  • Linux to native system call translation
  • Linux-specific system calls
  • Special signal handling for Linux processes
  • Path translation mechanism
  • Linux-specific virtual file systems

The path translation mechanism makes Linux processes look up file paths under emul_path (defaulting to /compat/linux) before /. For example, when a Linux process attempts to open /etc/passwd, it will first access /compat/linux/etc/passwd, falling back to /etc/passwd if the compat path does not exist. This is used to make sure Linux processes load Linux shared libraries instead of their similarly-named FreeBSD counterparts, and also to provide alternative versions of certain other files and virtual file systems.

To install Linux shared libraries and system files into /compat/linux, either use the emulators/linux_base-c7 port or package, or debootstrap(8) installed from sysutils/debootstrap.

To avoid mounting Linux-specific filesystems at startup, add the following line to the rc.conf(5) file:

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 to 0 to silence them. Defaults to 3. A setting of 1 prints debug messages and tells you about unimplemented stuff (only once). Setting it to 2 is like 1, but it also prints messages about implemented-but-not-tested stuff (only once). Setting it to 3 or higher is like 2, but with no rate limiting of messages. 🫢
  • compat.linux.default_openfiles β€” default soft openfiles resource limit for Linux applications. Set to -1 to disable the limit. Defaults to 1024.
  • compat.linux.emul_path β€” path to the Linux run-time environment. Defaults to /compat/linux.
  • compat.linux.osname β€” Linux kernel operating system name. Defaults to "Linux".
  • compat.linux.osrelease β€” Linux kernel operating system release. Changing this to something else is discouraged on non-development systems, because it may change the way Linux programs work. Some versions of GNU libc are known to use different syscalls depending on the value of this sysctl. 😬
  • compat.linux.oss_version β€” Linux Open Sound System version. Defaults to 198144.
  • 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 1.
  • compat.linux.setid_allowed β€” enables handling of set-user-ID and set-group-ID mode bits for the new process image file when image is to be executed under Linux ABI. When set to 0, new Linux images always use credentials of the program that issued the execve(2) call, regardless of the image file mode. This might be reasonable or even required, because FreeBSD does not emulate the Linux environment completely, and missed features may result in security vulnerabilities. Defaults to 1. πŸ”
  • compat.linux32.emulate_i386 β€” in the x86_64 (amd64) world, enables the real i386 Linuxulator behavior. For example, when set to 0, Linux uname -m will return "x86_64" even if uname itself is a i386 Linux executable. When set to 1, Linux i386 uname -m will return "i686". Defaults to 0.

πŸŽ€ FILES πŸŽ€

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

🌈 SEE ALSO 🌈

⭐ HISTORY ⭐

  • Linux ABI support first appeared for i386 in FreeBSD 2.1.
  • Support for amd64 binaries first appeared in FreeBSD 10.3.
  • Support for arm64 binaries first appeared in FreeBSD 12.0.

πŸ’€ BUGS πŸ’€

Support for some of the Linux-specific system calls and system call arguments is missing. 😭 no cap.


And that’s the whole LINUX(4) page, bestie!! 🫢 Footer deets: Debian, May 19, 2024 β€” bye!! πŸ’–βœ¨

πŸ“¦ where this page comes from