温馨提示×

linux compton报错怎么修

小樊
45
2026-09-30 21:50:54
栏目: 智能运维

Compton 已经停止维护,现在多数发行版用的是它的分支 picom。不过先帮你按常见报错来排查。


一、先确认报错内容

请把完整报错信息贴出来,例如:

compton: No compositor running...
X Error of failed request: BadMatch

不同报错修法不一样。


二、最常见问题 & 修复方法

1️⃣ 找不到配置文件

报错类似:

compton: Cannot read configuration file

✅ 解决:

cp /etc/xdg/compton.conf ~/.config/compton.conf

或自己建一个最小配置:

backend = "glx";
vsync = true;

然后:

compton --config ~/.config/compton.conf

2️⃣ 没有显示器 / 不是 X11

报错:

Cannot open display

✅ 检查:

echo $DISPLAY
  • 空 → 你可能在 Wayland(GNOME / KDE 默认)
  • Compton 不支持 Wayland

✅ 解决:

  • 切回 X11(登录时选 Xorg)
  • 或换用:
    • Wayland:自带合成器
    • KDE:kwin
    • GNOME:mutter

3️⃣ backend 不支持(glx / xrender)

报错:

Failed to initialize backend

✅ 改配置:

backend = "xrender";

或

backend = "glx";

测试哪一个能用。


4️⃣ NVIDIA / 驱动问题

✅ 尝试:

backend = "xrender";
vsync = false;

NVIDIA 用户常需要:

compton --backend xrender --vsync none

5️⃣ 已经有一个 compositor 在运行

报错:

Another compositor is already running

✅ 关掉原来的:

killall compton
killall picom

再启动。


6️⃣ 建议直接换 picom(强烈推荐)

sudo apt remove compton
sudo apt install picom
picom &

配置:

mkdir -p ~/.config/picom
cp /etc/xdg/picom.conf ~/.config/picom.conf

三、快速自检清单

  • ✅ 在 X11 下
  • ✅ backend 正确
  • ✅ 只有一个 compositor
  • ✅ 驱动正常
  • ✅ 配置文件存在

如果你愿意,把 具体报错 + 桌面环境(i3 / openbox / KDE / GNOME)+ 显卡 发出来,我可以直接给你一份能用的配置。

0 踩