由于缺乏官方支持,用户可通过启用 FreeBSD 的 Linux 兼容层并在本地创建包装脚本以“欺骗”Zed 编辑器,从而使其 Linux 版远程服务器正常运行 1。具体操作包括设置 linux_enable=YES、安装 linux_base-rl9,以及在 ~/.local/bin/uname 中配置脚本,当检测到 Zed 查询平台时返回 'Linux x86_64',其余情况则透传至真实命令 1。尽管该方案可行,但必须配合特定的内核补丁才能解决底层兼容性缺陷,否则会导致文件列表为空或数据静默丢失 1。
导致此问题的根源在于 2026年2月的一次 NFS 修复(提交 110f2567cb51)改变了 Linux 兼容层中 linux_getdents() 和 linux_getdents64() 函数的缓冲区大小计算逻辑,使得原生批次可能超出调用者缓冲区 1。若未应用修复,将引发 'Invalid argument (os error 22)' 错误或静默丢失文件 1。为此,开发者需应用 FreeBSD 内核补丁 ec6629628cb (D60760),其修复逻辑规定:若 args->count >= DEV_BSIZE,则缓冲区长度设为 min(args->count, MAXBSIZE),仅在数值较小时进行 roundup 操作 1。目前该补丁已合并至 FreeBSD main、stable/15 及 releng/15.2 分支,并预计随 15.2-RELEASE 版本正式发布 1。
Running the Linux version of Zed’s remote server on FreeBSD requires a specific workaround that involves spoofing system information and applying a critical kernel patch. While Zed lacks an official FreeBSD remote server, users can enable the operating system's Linux compatibility layer by configuring sysrc linux_enable=YES and installing the linux_base-rl9 package 1. To make the editor function correctly within this environment, a wrapper script must be created at ~/.local/bin/uname. This script intercepts queries from Zed regarding the platform, returning 'Linux x86_64' when asked, while passing other commands through to the real uname utility 1.
However, this configuration alone is insufficient without addressing an underlying bug in FreeBSD’s Linux compatibility layer. The setup relies on a specific kernel fix, identified as commit ec6629628cb (D60760), to prevent issues such as empty file lists or silent data loss 1. Without this patch, users may encounter errors described as 'Invalid argument (os error 22)' 1. The root cause traces back to a February 2026 NFS update (commit 110f2567cb51) that altered buffer size calculations in linux_getdents() and linux_getdents64(), allowing native batches to potentially exceed the caller's buffer 1. The correction adjusts the logic so that if args->count is greater than or equal to DEV_BSIZE, buflen is set to the minimum of args->count and MAXBSIZE; otherwise, it proceeds with rounding up 1.
The required kernel patch has been merged into the FreeBSD main, stable/15, and releng/15.2 branches 1. It is expected to be included in the upcoming 15.2-RELEASE 1. Beyond these technical hurdles for remote development, Zed also offers earlier access to certain privacy features compared to competitors; unlike VS Code, which uses the chat.disableAIFeatures setting, Zed provides a toggle in Settings or allows users to set "disable_ai": true to disable AI capabilities 1.
评论
还没有评论,欢迎留下第一条。