1. SFTP session failed to allocate. ash: /usr/libexec/sftp-server: not found

1
2
3
4
5
6
7
opkg update

opkg install openssh-sftp-server

apk update

apk add openssh-sftp-server

2. apk install 命令失败了 ,代码为 99。ERROR: /tmp/upload.apk: UNTRUSTED signature

1
apk add --allow-untrusted 

3. 中文界面

1

4. 无法执行 opkg install 命令:SyntaxError: Unexpected end of JSON input

5. rm: can't remove '/etc/openclash/GeoIP.dat': Read-only file system

根据你提供的 mount 信息,根文件系统 /OverlayFS 结构,且以 只读(ro) 模式挂载。这与 /etc/openclash/ 目录的操作直接相关,因为 OverlayFS 的只读特性会影响到所有子目录(包括 /etc/openclash/)。以下是具体分析和解决方案:


关键原因分析

  1. OverlayFS 结构
    • 你的系统根目录 / 由 OverlayFS 挂载,底层是 只读的 SquashFS(嵌入式系统常见设计),上层可写目录为 /overlay/upper/overlay/work
    • 所有对根目录的修改(如删除、新增文件)必须通过 OverlayFS 的上层目录(即 /overlay)实现,直接操作 /etc 等路径无效(因为它们是只读的)。
  2. 错误本质
    • 当你尝试删除 /etc/openclash/GeoIP.dat 时,实际是尝试修改底层只读文件系统,导致 Read-only file system 错误。
    • 即使目录权限设为 0777,也无法绕过 OverlayFS 的只读限制。

解决方案

1. 通过 OverlayFS 上层目录操作

OverlayFS 的可写层位于 /overlay/upper,你需要通过此路径间接操作文件:

1
2
3
4
5
6
7
8
# 查看文件在 OverlayFS 中的真实路径
find /overlay/upper/etc/openclash/ -name GeoIP.dat

# 如果文件存在,直接删除
rm -f /overlay/upper/etc/openclash/GeoIP.dat

# 重启 OpenClash 服务使更改生效(可选)
/etc/init.d/openclash restart

2. 临时重新挂载根目录为读写模式

(仅适用于非嵌入式系统,OpenWrt/ImmortalWrt 可能不支持)

1
2
3
4
5
6
7
8
# 尝试重新挂载根目录为读写
mount -o remount,rw /

# 删除文件
rm -f /etc/openclash/GeoIP.dat

# 恢复只读模式(可选)
mount -o remount,ro /
注意:大多数 OpenWrt 系统的根分区是 SquashFS,此操作可能失败。

3. 通过软件包管理删除文件

如果 GeoIP.dat 属于某个软件包(如 openclash),直接卸载软件包:

1
2
3
4
5
# 查找文件所属的包
opkg search GeoIP.dat

# 卸载对应包(假设包名为 openclash)
opkg remove openclash --force-removal-of-dependent-packages

4. 覆盖文件而非删除

如果你希望保留目录结构但清空文件内容:

1
echo "" > /overlay/upper/etc/openclash/GeoIP.dat


验证操作是否成功

删除或修改后,检查文件是否从系统中消失:

1
2
3
4
5
# 检查文件是否存在
ls -l /etc/openclash/GeoIP.dat

# 查看 OverlayFS 上层目录
ls -l /overlay/upper/etc/openclash/GeoIP.dat


永久性解决方案

若需长期避免此问题: 1. 将文件添加到 OverlayFS 排除列表
编辑 /etc/sysupgrade.conf,添加一行 /etc/openclash/GeoIP.dat,这样系统升级时不会恢复该文件。 2. 使用自定义脚本
在系统启动时自动删除或覆盖文件(通过 /etc/rc.local)。


总结

  • 不要直接操作 /etc/openclash/,而是通过 /overlay/upper/etc/openclash/ 修改。
  • OverlayFS 的设计决定了底层只读文件的不可变性,权限设置 (0777) 在此场景下无效。
  • 优先使用软件包管理或 OverlayFS 上层目录操作文件。

6. 彻底重装 OpenClash

如果以上无效,备份配置后彻底重装:

1
2
3
4
5
# 卸载
opkg remove luci-app-openclash

# 重新安装(确保软件源配置正确)
opkg install --force-overwrite /tmp/luci-app-openclash_xxx_all.ipk
## 7. 解决 VMware 中无法拖拽文件、复制粘贴的问题

1. sudo apt-get install open-vm-tools open-vm-tools-desktop

2. GNOME 桌面环境(KDE 桌面环境没有)

Ubuntu

1
sudo nano /etc/gdm3/custom.conf

Debian

1
sudo nano /etc/gdm3/daemon.conf

找到 #WaylandEnable=false 这行,去掉前面的 # 号,使其变成 WaylandEnable=false,然后保存文件。

1
2
3
4
sudo reboot

echo $XDG_SESSION_TYPE
显示 x11 就成功!

8. Debian/Ubuntu 配置 清华源

1
sudo nano /etc/apt/sources.list

复制粘贴一下内容,全选覆盖原内容!

1
2
3
4
5
6
7
8
9
10
11
12
13
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware

# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware

9. 不是 sudoers

1
2
3
4
5
su root

sudo visudo

找到 root (ALL:ALL) ALL 这行,然后另起一行,{用户名} (ALL:ALL) ALL,然后保存文件。

[up主专用,视频内嵌代码贴在这]