Kwin_wayland fails to open /dev/dri/card0 on first login attempt, works on second attempt

inxi -Fazy output:

System:
  Kernel: 6.6.1-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
    clocksource: hpet available: acpi_pm
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-6.6-x86_64
    root=UUID=4975ae68-a74d-4e60-8d1f-502a5a9e84f5 rw rootflags=subvol=@
    udev.log_priority=info initcall_blacklist=simpledrm_platform_driver_init
    amdgpu.modeset=1 nvidi-drm.modeset=1
  Desktop: KDE Plasma v: 5.27.9 tk: Qt v: 5.15.11 wm: kwin_wayland vt: 1
    dm: SDDM Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: ASUSTeK product: ASUS TUF Gaming A15 FA506IHRB_FA506IHRB
    v: 1.0 serial: <superuser required>
  Mobo: ASUSTeK model: FA506IHRB v: 1.0 serial: <superuser required>
    UEFI: American Megatrends v: FA506IHRB.307 date: 12/28/2022
Battery:
  ID-1: BAT1 charge: 53.2 Wh (64.5%) condition: 82.5/90.2 Wh (91.4%)
    volts: 15.8 min: 15.9 model: ASUS A32-K55 type: Li-ion serial: N/A
    status: not charging
CPU:
  Info: model: AMD Ryzen 5 4600H with Radeon Graphics bits: 64 type: MT MCP
    arch: Zen 2 gen: 3 level: v3 note: check built: 2020-22
    process: TSMC n7 (7nm) family: 0x17 (23) model-id: 0x60 (96) stepping: 1
    microcode: 0x8600106
  Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
    L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 3 MiB desc: 6x512 KiB L3: 8 MiB
    desc: 2x4 MiB
  Speed (MHz): avg: 850 high: 1812 min/max: 400/4006 scaling:
    driver: amd-pstate-epp governor: powersave cores: 1: 400 2: 1397 3: 1397
    4: 1397 5: 400 6: 400 7: 1812 8: 400 9: 400 10: 400 11: 1397 12: 400
    bogomips: 71899
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed mitigation: untrained return thunk; SMT enabled with STIBP
    protection
  Type: spec_rstack_overflow mitigation: safe RET
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, STIBP:
    always-on, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: NVIDIA TU117M [GeForce GTX 1650 Mobile / Max-Q] vendor: ASUSTeK
    driver: nvidia v: 535.129.03 alternate: nouveau,nvidia_drm non-free: 545.xx+
    status: current (as of 2023-11; EOL~2026-12-xx) arch: Turing code: TUxxx
    process: TSMC 12nm FF built: 2018-2022 pcie: gen: 1 speed: 2.5 GT/s
    lanes: 8 link-max: gen: 4 speed: 16 GT/s lanes: 16 ports: active: none
    empty: DP-1 bus-ID: 01:00.0 chip-ID: 10de:1f9d class-ID: 0300
  Device-2: AMD Renoir vendor: ASUSTeK driver: amdgpu v: kernel arch: GCN-5
    code: Vega process: GF 14nm built: 2017-20 pcie: gen: 3 speed: 8 GT/s
    lanes: 16 link-max: gen: 4 speed: 16 GT/s ports: active: eDP-1
    empty: HDMI-A-1 bus-ID: 06:00.0 chip-ID: 1002:1636 class-ID: 0300
    temp: 30.0 C
  Device-3: Sonix USB2.0 HD UVC WebCam driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-4:2 chip-ID: 322e:202c
    class-ID: 0e02
  Display: wayland server: X.org v: 1.21.1.9 with: Xwayland v: 23.2.2
    compositor: kwin_wayland driver: X: loaded: amdgpu,nvidia
    unloaded: modesetting alternate: fbdev,nouveau,nv,vesa dri: radeonsi
    gpu: nvidia,amdgpu display-ID: 0
  Monitor-1: eDP-1 res: 1920x1080 size: N/A modes: N/A
  API: EGL v: 1.5 hw: drv: nvidia drv: amd radeonsi platforms: device: 0
    drv: nvidia device: 1 drv: radeonsi device: 3 drv: swrast gbm:
    drv: kms_swrast surfaceless: drv: nvidia wayland: drv: radeonsi x11:
    drv: radeonsi inactive: device-2
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: amd mesa v: 23.1.9-manjaro1.1
    glx-v: 1.4 direct-render: yes renderer: AMD Radeon Graphics (renoir LLVM
    16.0.6 DRM 3.54 6.6.1-1-MANJARO) device-ID: 1002:1636 memory: 500 MiB
    unified: no display-ID: :1.0
  API: Vulkan v: 1.3.269 layers: 1 device: 0 type: discrete-gpu
    name: NVIDIA GeForce GTX 1650 driver: nvidia v: 535.129.03
    device-ID: 10de:1f9d surfaces: xcb,xlib,wayland device: 1
    type: integrated-gpu name: AMD Radeon Graphics (RADV RENOIR)
    driver: mesa radv v: 23.1.9-manjaro1.1 device-ID: 1002:1636
    surfaces: xcb,xlib,wayland
Audio:
  Device-1: NVIDIA vendor: ASUSTeK driver: snd_hda_intel v: kernel pcie: gen: 1
    speed: 2.5 GT/s lanes: 8 link-max: gen: 4 speed: 16 GT/s lanes: 16
    bus-ID: 01:00.1 chip-ID: 10de:10fa class-ID: 0403
  Device-2: AMD Renoir Radeon High Definition Audio vendor: ASUSTeK
    driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
    link-max: gen: 4 speed: 16 GT/s bus-ID: 06:00.1 chip-ID: 1002:1637
    class-ID: 0403
  Device-3: AMD ACP/ACP3X/ACP6x Audio Coprocessor driver: N/A
    alternate: snd_pci_acp3x, snd_rn_pci_acp3x, snd_pci_acp5x, snd_pci_acp6x,
    snd_acp_pci, snd_rpl_pci_acp6x, snd_pci_ps, snd_sof_amd_renoir,
    snd_sof_amd_rembrandt, snd_sof_amd_vangogh pcie: gen: 3 speed: 8 GT/s
    lanes: 16 link-max: gen: 4 speed: 16 GT/s bus-ID: 06:00.5
    chip-ID: 1022:15e2 class-ID: 0480
  Device-4: AMD Family 17h/19h HD Audio vendor: ASUSTeK driver: snd_hda_intel
    v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16 link-max: gen: 4
    speed: 16 GT/s bus-ID: 06:00.6 chip-ID: 1022:15e3 class-ID: 0403
  API: ALSA v: k6.6.1-1-MANJARO status: kernel-api
    tools: alsactl,alsamixer,amixer
  Server-1: PipeWire v: 0.3.85 status: active with: 1: pipewire-pulse
    status: active 2: pipewire-media-session status: active 3: pipewire-alsa
    type: plugin 4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: ASUSTeK driver: r8169 v: kernel modules: r8168 pcie: gen: 1
    speed: 2.5 GT/s lanes: 1 port: e000 bus-ID: 02:00.0 chip-ID: 10ec:8168
    class-ID: 0200
  IF: enp2s0 state: down mac: <filter>
  Device-2: MEDIATEK MT7921 802.11ax PCI Express Wireless Network Adapter
    vendor: AzureWave driver: mt7921e v: kernel pcie: gen: 2 speed: 5 GT/s
    lanes: 1 bus-ID: 03:00.0 chip-ID: 14c3:7961 class-ID: 0280
  IF: wlp3s0 state: up mac: <filter>
Bluetooth:
  Device-1: IMC Networks Wireless_Device driver: btusb v: 0.8 type: USB
    rev: 2.1 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 3-3:2 chip-ID: 13d3:3563
    class-ID: e001 serial: <filter>
  Report: rfkill ID: hci0 rfk-id: 0 state: up address: see --recommends
Drives:
  Local Storage: total: 953.88 GiB used: 414.91 GiB (43.5%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Silicon Power
    model: SPCC M.2 PCIe SSD size: 476.94 GiB block-size: physical: 512 B
    logical: 512 B speed: 31.6 Gb/s lanes: 4 tech: SSD serial: <filter>
    fw-rev: EDFM20.0 temp: 30.9 C scheme: GPT
  ID-2: /dev/nvme1n1 maj-min: 259:2 vendor: Samsung model: MZVLQ512HBLU-00B00
    size: 476.94 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
    lanes: 4 tech: SSD serial: <filter> fw-rev: FXM7201Q temp: 24.9 C
    scheme: GPT
Partition:
  ID-1: / raw-size: 150 GiB size: 150 GiB (100.00%) used: 103.86 GiB (69.2%)
    fs: btrfs dev: /dev/nvme1n1p2 maj-min: 259:4
  ID-2: /boot/efi raw-size: 512 MiB size: 511 MiB (99.80%)
    used: 27.1 MiB (5.3%) fs: vfat dev: /dev/nvme1n1p1 maj-min: 259:3
  ID-3: /home raw-size: 150 GiB size: 150 GiB (100.00%)
    used: 103.86 GiB (69.2%) fs: btrfs dev: /dev/nvme1n1p2 maj-min: 259:4
  ID-4: /var/log raw-size: 150 GiB size: 150 GiB (100.00%)
    used: 103.86 GiB (69.2%) fs: btrfs dev: /dev/nvme1n1p2 maj-min: 259:4
Swap:
  Alert: No swap data was found.
Sensors:
  System Temperatures: cpu: 40.1 C mobo: 26.0 C gpu: amdgpu temp: 31.0 C
  Fan Speeds (rpm): cpu: 3100
Info:
  Processes: 346 Uptime: 1h 35m wakeups: 0 Memory: total: 16 GiB note: est.
  available: 15.05 GiB used: 3.27 GiB (21.8%) Init: systemd v: 254
  default: graphical tool: systemctl Compilers: gcc: 13.2.1 alt: 12
  clang: 16.0.6 Packages: pm: pacman pkgs: 1315 libs: 353 tools: pamac,yay
  Shell: Zsh v: 5.9 default: Bash v: 5.2.15 running-in: konsole inxi: 3.3.31

Alright, so here’s the story :

I installed Manjaro KDE on my new laptop last month and everything was working fine, until recent few updates.

My laptop has nvidia gtx 1650 gpu and intergreted amdgpu (cpu: ryzen 5 4600h).
The laptop display is connected to intergreted amdgpu. And i could use prime-run if i wanted nvidia gpu acceleration in some app/game, which worked fine.


Now after recent updates, i started getting black screen on login. After reading logs, i determined it was because kwin_wayland was failing to open /dev/dri/card0 (ie. amdgpu) so it was falling back to use /dev/dri/card1 (nvidia), which isn’t connected to laptop screen, hence causing a blackscreen. Problem was wayland specific, x11 version was able to use amdgpu just fine.

i fixed that by setting KWIN_DRM_DEVICES=/dev/dri/card0 via means of profile.d script (assume card0 is amdgpu for now, in reality card numbers are nondeterministic, sometimes amdgpu is card0 sometimes its card1, so i had to create a script to identify the amdgpu card number and set KWIN_DRM_DEVICES accordingly)

now kwin only tries using amdgpu and not nvidia, which is great and thats what i wanted. if it fails to use amdgpu, it simply returns back to sddm login instead of blackscreen, nice.


Now the issue is that it always fails to use amdgpu on first login attempt, returns back to sddm, then i login again, then it works on second login attempt :hushed:
Its not unusable but its an annoying having to login twice to reach desktop.

i get the following error repeated several times, then it returns back to sddm.

Nov 18 20:34:41 asus-tuf-a15 kwin_wayland[922]: No backend specified, automatically choosing drm
Nov 18 20:34:41 asus-tuf-a15 kwin_wayland[922]: kwin_core: Failed to open /dev/dri/card0 device (Device or resource busy)
Nov 18 20:34:41 asus-tuf-a15 kwin_wayland[922]: kwin_wayland_drm: failed to open drm device at "/dev/dri/card0"
Nov 18 20:34:41 asus-tuf-a15 kwin_wayland[922]: kwin_wayland_drm: No suitable DRM devices have been found

what i tried and didnt work:

  • setting nvidia-drm.modeset=1 in kernel parameters
  • setting GRUB_GFXPAYLOAD_LINUX=text in /etc/grub/default
  • adding amd and nvidia modules to mkinitpico.conf for Early KMS
  • downgrading to lts 6.1 kernel and corresponding drivers
  • setting default splash screen theme
  • setting initcall_blacklist=simpledrm_platform_driver_init kernel parameter
  • manually starting plasma session ftom tty instead of sddm

extra notes:

  • by disabling hardware acceleration with nomodset i am able to to login on first attempt without any issue.
  • i dont remember exactly which update started this issue but i started noticing it after 545 driver (which was later rollbacked to 535). problem existed before that as well, but it would only occur like 1/10 logins, after updates its 9/10 times.
  • i am on testing branch

Then do you have a reason why you need to use Wayland? KDE5 + Wayland + Nvidia can be a troublesome enough combination on it’s own even without the additional complication of an AMD igpu. There’s a reason why X11 is the default on KDE installs (GNOME defaults to Wayland).

My point exactly.

If you really do need Wayland and aren’t set on KDE then try GNOME. Otherwise, good luck!

i use wayland because:

  • mainly touchpad gestures (i can use fusuma on x11 but its not on par)
  • faster and smoother ui animations

i use kde because:

  • gnome makes me feel suffocated
  • i like kde, feels like fresh air

OK. I also strongly dislike GNOME but not everyone agrees.

If you can live with X11 for a few months then KDE 6 is due to be released February 2024 and that fixes many Wayland issues which can not or will not ever be fixed in KDE 5. Although do be warned that new major releases of KDE do have a bit of a reputation for not being totally stable on initial release. :upside_down_face:

The issue seems to have resolved by itself, probably after 545 driver update the second time.

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.