| COMPAT_LINUX(8) | System Manager's Manual | COMPAT_LINUX(8) | 
compat_linux —
The Linux compatibility feature is active for kernels compiled
    with the COMPAT_LINUX option enabled. If support for
    Linux a.out executables is desired, the EXEC_AOUT
    option should be enabled in addition to option
    COMPAT_LINUX. Similarly, if support for Linux 32-bit
    and/or 64-bit ELF executables is desired, the
    EXEC_ELF32 and/or EXEC_ELF64
    options (respectively) should be enabled in addition to
    COMPAT_LINUX. If sound support is desired,
    COMPAT_OSSAUDIO should be enabled.
A lot of programs are dynamically linked. This means that you will also need the Linux shared libraries that the program depends on, and the runtime linker. Also, you will need to create a “shadow root” directory for Linux binaries on your NetBSD system. This directory is named /emul/linux or /emul/linux32 for 32-bit emulation on 64-bit systems. Any file operations done by Linux programs run under NetBSD will look in this directory first. So, if a Linux program opens, for example, /etc/passwd, NetBSD 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 you install Linux packages that include configuration files, etc under /emul/linux, to avoid naming conflicts with possible NetBSD counterparts. Shared libraries should also be installed in the shadow tree. Filenames that start "/../" are only looked up in the real root.
Generally, you will need to look for the shared libraries that Linux binaries depend on only the first few times that you install a Linux program on your NetBSD system. After a while, you will have a sufficient set of Linux shared libraries on your system to be able to run newly imported Linux binaries without any extra work.
$ readelf -d ./runner | grep Shared 0x00000001 (NEEDED) Shared library: [libstdc++.so.6] 0x00000001 (NEEDED) Shared library: [libz.so.1] 0x00000001 (NEEDED) Shared library: [libXxf86vm.so.1] 0x00000001 (NEEDED) Shared library: [libGL.so.1] 0x00000001 (NEEDED) Shared library: [libopenal.so.1] 0x00000001 (NEEDED) Shared library: [libm.so.6] 0x00000001 (NEEDED) Shared library: [librt.so.1] 0x00000001 (NEEDED) Shared library: [libpthread.so.0] 0x00000001 (NEEDED) Shared library: [libdl.so.2] 0x00000001 (NEEDED) Shared library: [libcrypto.so.1.0.0] 0x00000001 (NEEDED) Shared library: [libXext.so.6] 0x00000001 (NEEDED) Shared library: [libX11.so.6] 0x00000001 (NEEDED) Shared library: [libXrandr.so.2] 0x00000001 (NEEDED) Shared library: [libGLU.so.1] 0x00000001 (NEEDED) Shared library: [libssl.so.1.0.0] 0x00000001 (NEEDED) Shared library: [libgcc_s.so.1] 0x00000001 (NEEDED) Shared library: [libc.so.6]
For x86, you can simply install the openSUSE shared libraries using the pkgsrc/emulators/suse131_* or pkgsrc/emulators/suse131_32_* packages.
For example, an application which requires
    libcrypto.so.1.0.0,
    libXext.so.6, and libGL.so.1
    will require openssl, x11,
    and glx, in addition to the
    base SUSE package.
Otherwise, you may have to obtain shared libraries from another Linux system, and copy them to e.g. /emul/linux/lib64.
Mount procfs on NetBSD using following command:
You can also set up your system so that procfs is mounted automatically on system boot, by putting an entry like the one below to /etc/fstab.
Note: mount_procfs(8) defaults to Linux flavored procfs since NetBSD 5.0. Ensure you do not mount procfs with nolinux.
See mount_procfs(8) for further information.
compat_linux is generally not enabled in
  GENERIC kernels for security reasons, but is available
  as a module. It must be added to
  modules.conf(5) to be
  used. It will not be loaded automatically.
Absolute pathnames pointed to by symbolic links are only looked up in the shadow root when the symbolic link itself was found by an absolute pathname inside the shadow root. This is not consistent.
Linux executables cannot handle directory offset cookies > 32
    bits. Should such an offset occur, you will see the message
    “linux_getdents: dir offset too large for emulated program”.
    Currently, this can only happen on NFS mounted file systems, mounted from
    servers that return offsets with information in the upper 32 bits. These
    errors should rarely happen, but can be avoided by mounting this file system
    with offset translation enabled. See the -X option
    to mount_nfs(8). The
    -2 option to
    mount_nfs(8) will also have
    the desired effect, but is less preferable.
| September 26, 2021 | NetBSD 10.1 |