Ghostty 和 Xdroid 同时开着,突然 Ghostty 崩了。重启也打不开,报 FUSE 错误。原因:Xdroid 的音频服务搞坏了 PipeWire,PipeWire 崩溃导致 FUSE 挂载点异常。
崩溃现场 #
那天我同时在用 Ghostty(终端)和 Xdroid(安卓模拟器)。突然 Ghostty 窗口消失了,终端里只剩一个错误:
dlopen(): error loading libfuse.so.2
AppImages require FUSE to run.Ghostty 是 AppImage 格式打包的,需要 FUSE 来挂载内部文件系统。但 FUSE 怎么会突然坏了?
排查 #
FUSE 本身没问题 #
# 检查 FUSE 是否安装
dpkg -l | grep fuse
# fuse3 已安装
# 检查 FUSE 设备
ls -la /dev/fuse
# crw-rw-rw- 1 root root 10, 229 ... /dev/fuseFUSE 库和设备都在。那为什么 Ghostty 说加载不了?
检查 AppImage 的挂载状态 #
# 看看有没有残留的 AppImage 挂载
mount | grep -i appimage发现有一个 Ghostty 的挂载点还存在,但状态异常:
/tmp/.mount_ghosttyXXXXXX on /tmp/.mount_ghosttyYYYYYY type fuse.AppImage (ro,nosuid,nodev,relatime,user_id=1000,group_id=1000)这个挂载点是上次 Ghostty 运行时创建的。正常退出应该自动卸载,但 Ghostty 被异常终止(崩溃),挂载点残留了。
罪魁祸首:Xdroid 搞崩了 PipeWire #
查系统日志:
journalctl --user -u pipewire --since "1 hour ago"发现 PipeWire 在 Ghostty 崩溃前几秒崩了:
pipewire[1234]: segfault at 0x0000000000000010 ...
systemd[1]: pipewire.service: Main process exited, code=killed, status=11/SEGVPipeWire 崩溃的原因是 Xdroid 的音频输出和 PipeWire 的 ALSA 插件冲突。Xdroid 启动时会尝试独占音频设备,和 PipeWire 打起来了。(然鹅设置我选的兼容音频模式)
AppImage 的 FUSE 挂载依赖内核的 FUSE 模块和用户态的 libfuse。PipeWire 崩溃本身不直接影响 FUSE,但它触发了 systemd 的服务重启链——PipeWire 崩溃 → 音频服务重启 → 某些共享库被临时卸载 → AppImage 的 FUSE 调用失败。
修复 #
1. 清理残留的挂载点
# 找到残留挂载点
mount | grep .mount_ghostty
# 卸载
fusermount -u /tmp/.mount_ghosttyXXXXXX
# 如果 fusermount 也失败
sudo umount -l /tmp/.mount_ghosttyXXXXXX2. 重启 PipeWire
systemctl --user restart pipewire pipewire-pulse wireplumber3. 重启 Ghostty
./ghostty.AppImage这次正常启动了。
根本解决 #
为了防止 Xdroid 和 PipeWire 再打架,做了两件事:
1. 限制 Xdroid 的音频访问
在 Xdroid 的配置里把音频输出改成 PulseAudio(走 PipeWire 兼容层),不要直接访问 ALSA 设备。
2. 给 Ghostty AppImage 加 --no-sandbox
虽然这不直接解决 FUSE 问题,但减少了 AppImage 的挂载复杂度:
# 创建启动脚本
cat > ~/bin/ghostty << 'EOF'
#!/bin/bash
# 清理可能的残留挂载
fusermount -u /tmp/.mount_ghostty* 2>/dev/null
exec /path/to/ghostty.AppImage "$@"
EOF
chmod +x ~/bin/ghostty考虑用 --appimage-extract 把 AppImage 解压出来直接运行,绕过 FUSE:
./ghostty.AppImage --appimage-extract
./squashfs-root/AppRun缺点是解压后占用更多磁盘空间,且不会自动更新。
- 使用其他版本的Ghostty(亲测有用)