Linux 上解决 Electron 软件 sandbox 权限报错

系统更新到 Ubuntu 24.04 后,发现很多基于 Electron 的软件无法正常运行,通常是由于 AppArmor 限制了软件的权限。

报错信息通常为:

1
The SUID sandbox helper binary was found, but is not configured correctly.

解决办法

anytype 为例,假设所有版本的 AppImage 文件都放在 /path/to/anytype 目录下。

/etc/apparmor.d/ 目录下创建 anytype 文件,内容如下:

1
2
3
4
5
6
7
8
abi <abi/4.0>,
include <tunables/global>

profile anytype /path/to/anytype/*.* flags=(default_allow) {
userns,

include if exists <local/anytype>
}

然后重启 AppArmor 服务:

1
sudo systemctl reload apparmor

参考资料

Mastodon