swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.45k stars 1.1k forks source link

Freeze during startup - Waiting for 'CanGraphical' on seat seat0 #5824

Open yellowsquid opened 3 years ago

yellowsquid commented 3 years ago

Please fill out the following:

00:00:00.012 [sway/server.c:43] Preparing Wayland server initialzation
00:00:00.027 [INFO] [backend/session/logins.c:839] Waiting for 'CanGraphical' on seat seat0

This issue is not present on kernel 5.9.8-zen1-1-zen. I am only trying LTS to see if would mitigate a different bug I was having.

This issue also appears if you start sway using systemd.

emersion commented 3 years ago

Can you confirm you have a card in /dev/dri?

emersion commented 3 years ago

Side note, https://github.com/swaywm/wlroots/pull/2465 should improve the situation a little by timing out after 10s.

emersion commented 3 years ago

Btw, these aren't debug logs. Start Sway with sway -d >sway.log 2>&1. Also don't strip out things you think aren't important.

yellowsquid commented 3 years ago

Here's the full output.

00:00:00.000 [sway/main.c:326] Sway version 1.5.1
00:00:00.004 [sway/main.c:153] Linux hostname 5.4.77-1-lts #1 SMP Tue, 10 Nov 2020 22:42:03 +0000 x86_64 GNU/Linux
00:00:00.004 [sway/main.c:169] Contents of /etc/os-release:
00:00:00.004 [sway/main.c:153] NAME="Arch Linux"
00:00:00.004 [sway/main.c:153] PRETTY_NAME="Arch Linux"
00:00:00.004 [sway/main.c:153] ID=arch
00:00:00.004 [sway/main.c:153] BUILD_ID=rolling
00:00:00.004 [sway/main.c:153] ANSI_COLOR="38;2;23;147;209"
00:00:00.004 [sway/main.c:153] HOME_URL="https://www.archlinux.org/"
00:00:00.004 [sway/main.c:153] DOCUMENTATION_URL="https://wiki.archlinux.org/"
00:00:00.004 [sway/main.c:153] SUPPORT_URL="https://bbs.archlinux.org/"
00:00:00.004 [sway/main.c:153] BUG_REPORT_URL="https://bugs.archlinux.org/"
00:00:00.004 [sway/main.c:153] LOGO=archlinux
00:00:00.004 [sway/main.c:141] LD_LIBRARY_PATH=(null)
00:00:00.004 [sway/main.c:141] LD_PRELOAD=(null)
00:00:00.004 [sway/main.c:141] PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/user/.local/bin
00:00:00.004 [sway/main.c:141] SWAYSOCK=(null)
00:00:00.005 [sway/server.c:43] Preparing Wayland server initialization
00:00:00.014 [INFO] [backend/session/logind.c:839] Waiting for 'CanGraphical' on seat seat0

I haven't been able to check /dev/dri on LTS because I've needed to use the system. On zen I have this output:

> ls /dev/dri
by-path
card0
renderD128
emersion commented 3 years ago

Can you try swaywm/wlroots#2465?

yellowsquid commented 3 years ago

It'll probably be at least a day before I next have the chance, especially if I have to build from source. I'll let you know the result as soon as I can.

emersion commented 3 years ago

See https://github.com/swaywm/sway/wiki/Development-Setup#compiling-as-a-subproject

yellowsquid commented 3 years ago

Can you confirm you have a card in /dev/dri?

I had to quickly reboot, so I went into LTS, and this directory didn't even exist! I guess that means its a kernel problem then. I knew this device was new, but I didn't realise it was so new that driver support only appeared in the last few kernel releases.

In that case, I'd expect Sway to give an error instead of hang. I'll try the wlroots patch when I get the chance to see if it fails any faster.

yellowsquid commented 3 years ago

Can you try swaywm/wlroots#2465?

After cherry-picking those commits onto 0.12.0, I can confirm that sway no longer freezes. Instead, after 10 seconds, it exits (because the kernel itself cannot recognise my graphics card).

00:00:00.000 [sway/main.c:326] Sway version 1.5.1
00:00:00.007 [sway/main.c:153] Linux hostname 5.4.78-1-lts #1 SMP Wed, 18 Nov 2020 19:51:49 +0000 x86_64 GNU/Linux
00:00:00.007 [sway/main.c:169] Contents of /etc/os-release:
00:00:00.007 [sway/main.c:153] NAME="Arch Linux"
00:00:00.007 [sway/main.c:153] PRETTY_NAME="Arch Linux"
00:00:00.007 [sway/main.c:153] ID=arch
00:00:00.007 [sway/main.c:153] BUILD_ID=rolling
00:00:00.007 [sway/main.c:153] ANSI_COLOR="38;2;23;147;209"
00:00:00.007 [sway/main.c:153] HOME_URL="https://www.archlinux.org/"
00:00:00.007 [sway/main.c:153] DOCUMENTATION_URL="https://wiki.archlinux.org/"
00:00:00.007 [sway/main.c:153] SUPPORT_URL="https://bbs.archlinux.org/"
00:00:00.007 [sway/main.c:153] BUG_REPORT_URL="https://bugs.archlinux.org/"
00:00:00.007 [sway/main.c:153] LOGO=archlinux
00:00:00.007 [sway/main.c:141] LD_LIBRARY_PATH=(null)
00:00:00.007 [sway/main.c:141] LD_PRELOAD=(null)
00:00:00.007 [sway/main.c:141] PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/user/.local/bin
00:00:00.007 [sway/main.c:141] SWAYSOCK=(null)
00:00:00.007 [sway/server.c:43] Preparing Wayland server initialization
00:00:00.007 [INFO] [backend/session/logind.c:572] Selecting session from XDG_SESSION_ID: 1
00:00:00.021 [INFO] [backend/session/logind.c:706] Successfully loaded logind session
00:00:00.022 [INFO] [backend/session/session.c:362] Waiting for a DRM card device
00:00:10.032 [INFO] [backend/backend.c:157] Found 0 GPUs
00:00:10.032 [ERROR] [backend/backend.c:303] Failed to open any DRM device
00:00:10.042 [sway/server.c:49] Unable to create backend
lovesegfault commented 3 years ago

I just finished building a new PC and have hit this too. I'm on kernel 5.11.5, sway 1.5.1, and my GPU is an RX 6800 XT.

When starting sway it freezes for about three minutes, until it finally starts up with no problems:

00:00:00.000 [sway/main.c:326] Sway version 1.5.1
00:00:00.002 [sway/main.c:153] Linux hegel 5.11.5 #1-NixOS SMP Tue Mar 9 10:21:23 UTC 2021 x86_64 GNU/Linux
00:00:00.002 [sway/main.c:169] Contents of /etc/os-release:
00:00:00.002 [sway/main.c:153] NAME=NixOS
00:00:00.002 [sway/main.c:153] ID=nixos
00:00:00.002 [sway/main.c:153] VERSION="21.05.20210312.d7bae4c (Okapi)"
00:00:00.002 [sway/main.c:153] VERSION_CODENAME=okapi
00:00:00.002 [sway/main.c:153] VERSION_ID="21.05.20210312.d7bae4c"
00:00:00.002 [sway/main.c:153] PRETTY_NAME="NixOS 21.05 (Okapi)"
00:00:00.002 [sway/main.c:153] LOGO="nix-snowflake"
00:00:00.002 [sway/main.c:153] HOME_URL="https://nixos.org/"
00:00:00.002 [sway/main.c:153] DOCUMENTATION_URL="https://nixos.org/learn.html"
00:00:00.002 [sway/main.c:153] SUPPORT_URL="https://nixos.org/community.html"
00:00:00.002 [sway/main.c:153] BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
00:00:00.002 [sway/main.c:141] LD_LIBRARY_PATH=(null)
00:00:00.002 [sway/main.c:141] LD_PRELOAD=(null)
00:00:00.002 [sway/main.c:141] PATH=/run/wrappers/bin:/home/bemeurer/.nix-profile/bin:/etc/profiles/per-user/bemeurer/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin
00:00:00.002 [sway/main.c:141] SWAYSOCK=(null)
00:00:00.002 [sway/server.c:43] Preparing Wayland server initialization
00:00:00.072 [INFO] [backend/session/logind.c:839] Waiting for 'CanGraphical' on seat seat0
00:02:51.510 [INFO] [backend/session/logind.c:853] Successfully loaded logind session
00:02:51.512 [INFO] [backend/backend.c:157] Found 1 GPUs
00:02:51.512 [INFO] [backend/drm/backend.c:138] Initializing DRM backend for /dev/dri/card0 (amdgpu)
00:02:51.512 [DEBUG] [backend/drm/drm.c:70] Using atomic DRM interface
00:02:51.512 [INFO] [backend/drm/drm.c:255] Found 6 DRM CRTCs
00:02:51.512 [INFO] [backend/drm/drm.c:176] Found 13 DRM planes
00:02:51.648 [INFO] [render/egl.c:297] Using EGL 1.5
...

Notice in the timestamps how long it stays frozen for. @emersion Should I attempt the same patch or is this a new/different issue?

emersion commented 3 years ago

Please try Sway/wlroots master. Open a new issue if it doesn't work.

lovesegfault commented 3 years ago

It didn't work, will open an issue in the AM :)