解決kde/flameshot/spectacle on x11 截屏錯亂問題

現象:

截屏截不到應用,一進入截圖頁面應用就跳轉,要麼跳轉到其他應用,要不跳轉到已經關閉的應用。不管是flameshot或者spectacle 都是這樣,其他用戶發現的這個問題參考:

原因以及解決建議:

原因: x11 使用了 intel的驅動導致的。
建議: 卸載intel的驅動,使用其他驅動代替。

解決過程:

卸載xf86-video-intel並確保目錄/etc/X11/xorg.conf.d/沒有關於intel的配置

sudo pacman -Rns xf86-video-intel
ls -l /etc/X11/xorg.conf.d/  # 檢查此目錄沒有關於intel的配置

卸載後重啓卡開機界面黑屏了。切換到tty2,按ctl+alt+f2 手動啓動x:

startx

根據報錯日誌查看,/var/log、Xorg.0.log 發現日誌提示 Failed to load driver intel,推測應該是X的配置中是用了intel的驅動,然後由被卸載了導致的,查看配置文件 /etc/X11/xorg.conf

...
Section "Device"
    Identifier     "Device0"
    Driver         "intel"
    VendorName     "Intel Corporation"
    BusID          "PCI:0:2:0"
EndSection
...

X的配置文件中顯示顯卡設備用的是intel的Driver。

https://wiki.archlinux.org/title/Intel_graphics#Installation 中看到:

  1. 安裝了mesa 這個包就有驅動了
  2. 一般不推薦使用xf86-video-intel可以使用modesetting 這個驅動代替。

一個可行的方法是把"Device"中的"Driver"改成"modesetting",我是重新生成了一下X的配置文件:

sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
sudo systemctl stop sddm  # 必須在x停止的情況下才能重新生成配置文件,通過停掉sddm 關閉X
sudo xorg -configure # 生成配置文件到 /root/xorg.conf.new
sudo mv /root/xorg.conf.new /etc/X11/xorg.conf

檢查新生成的文件:

....
Section "Device"
        Identifier  "Card0"
        Driver      "modesetting"
        BusID       "PCI:0:2:0"
EndSection
...

新的配置文件已經不在使用intel驅動了,重啓。
重啓發現磁盤clean日誌之後直接就黑屏了,再切換到tty2,查看系統日誌:

jounalctl -f 

日誌中提示是關於nouveau的錯誤。查看當前是否加載了這個模塊:

lsmod |grep nouveau

由於不打算使用nvidia顯卡,直接屏蔽這個驅動,添加配置文件 /etc/modprobe.d/blacklist_nouveau.conf,內容:

blacklist nouveau
options nouveau modeset=0

重啓,正常啓動,也不在加載nouveau模塊,flameshot功能正常了。

參考:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章