# 12.2.配置 Linux 二进制兼容层

在默认情况下，[linux(4)](https://man.freebsd.org/cgi/man.cgi?query=linux\&sektion=4\&format=html) 二进制兼容性并未启用。

要在启动时启用 Linux ABI，可执行以下命令：

```sh
# sysrc linux_enable="YES"
```

启用之后，无需重启即可通过以下命令启动：

```sh
# service linux start
```

这就足以让静态链接的 Linux 二进制文件运行。

该 Linux 服务会加载所需的内核模块，并挂载 Linux 应用程序所期望的文件系统到 `/compat/linux`。它们的启动方式与原生 FreeBSD 二进制文件相同；其行为几乎与原生进程无异，并可按常规方式进行跟踪与调试。

可以通过以下命令查看 `/compat/linux` 当前的内容：

```sh
# ls -l /compat/linux/
```

输出应类似于以下内容：

```sh
total 1
dr-xr-xr-x  13 root  wheel  512 Apr 11 19:12 dev
dr-xr-xr-x   1 root  wheel    0 Apr 11 21:03 proc
dr-xr-xr-x   1 root  wheel    0 Apr 11 21:03 sys
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://handbook.bsdcn.org/di-12-zhang-linux-er-jin-zhi-jian-rong-ceng/12.2.-pei-zhi-linux-er-jin-zhi-jian-rong-ceng.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
