在 Ubuntu 上调试 compton(或已更名为 picom) 的报错,通常可以按下面步骤系统排查。
很多 Ubuntu 版本已经用 picom 替代 compton:
which compton
which picom
picom → 用 picomcompton → 继续用 compton下文以 compton 为例,picom 同理。
不要直接后台启动,先前台运行:
compton --config ~/.config/compton.conf
或:
compton -b --config ~/.config/compton.conf
如果已经后台运行,先杀掉:
pkill compton
观察终端输出,常见错误包括:
开启详细日志:
compton --show-all-errors --log-level trace
或写入日志文件:
compton --log-file /tmp/compton.log
然后查看:
cat /tmp/compton.log
报错类似:
parse error: ...
解决:
~/.config/compton.confcp /usr/share/doc/compton/examples/compton.sample.conf ~/.config/compton.conf
或(picom):
cp /usr/share/doc/picom/examples/picom.sample.conf ~/.config/picom.conf
报错:
Failed to initialize backend
尝试指定 backend:
compton --backend xrender
或:
compton --backend glx
在配置文件中:
backend = "xrender";
常见缺失:
修复:
sudo apt update
sudo apt install compton libconfig9 libgl1-mesa-dri
如果你在:
compton 可能不工作。
检查会话:
echo $XDG_SESSION_TYPE
wayland → compton 不支持x11 → 正常backend = "xrender";
opacity-rule = [ "90:class_g = 'Firefox'" ];
shadow = false;
fade = false;
如果你用 i3 / Openbox:
exec compton --config ~/.config/compton.conf
调试时改成:
exec compton --config ~/.config/compton.conf --show-all-errors
请提供以下信息,我可以精准帮你:
compton --version这样能更快定位问题。