~kennylevinsen/seatd#25: 
libseat/logind: "timeout waiting session to become active" in wlroots

Hello

I'm encountering the following sway log when starting from a systemd unit (pasted below), and sway does not start, on seatd 0.9.0 (arch package 0.9.0-1) (and 0.9.1); reverting to 0.8.0 workaround the issue, see bisect below).

Nov 01 07:43:07 framework sway[1123]: 00:00:00.004 [INFO] [sway/main.c:332] Starting sway version 1.10-c93ff730 (Nov  1 2024, branch 'HEAD')
Nov 01 07:43:07 framework sway[1123]: 00:00:00.004 [DEBUG] [sway/server.c:218] Initializing Wayland server
Nov 01 07:43:07 framework sway[1123]: 00:00:00.004 [INFO] [wlr] [libseat] [libseat/backend/seatd.c:64] Could not connect to socket /run/seatd.sock: No such fil>
Nov 01 07:43:07 framework sway[1123]: 00:00:00.004 [INFO] [wlr] [libseat] [libseat/libseat.c:76] Backend 'seatd' failed to open seat, skipping
Nov 01 07:43:07 framework sway[1123]: 00:00:00.005 [INFO] [wlr] [libseat] [libseat/libseat.c:73] Seat opened with backend 'logind'
Nov 01 07:43:07 framework sway[1123]: 00:00:00.006 [INFO] [wlr] [backend/session/session.c:108] Successfully loaded libseat session
Nov 01 07:43:07 framework sway[1123]: 00:00:00.006 [INFO] [wlr] [backend/backend.c:84] Waiting for a session to become active
Nov 01 07:43:17 framework sway[1123]: 00:00:10.016 [ERROR] [wlr] [backend/backend.c:105] Timeout waiting session to become active
Nov 01 07:43:17 framework sway[1123]: 00:00:10.016 [ERROR] [wlr] [backend/backend.c:407] Failed to start a DRM session
Nov 01 07:43:17 framework sway[1123]: 00:00:10.016 [ERROR] [sway/server.c:228] Unable to create backend

(If there is a way to have more debug info from wlroots / libseat, I can add it) This also happens on sway 1.9 and wlroots 0.17, but I've performed all the bisects on sway 1.10 / wlroots 0.18 I also see the same logs from wlroots ("Timeout waiting...") when using cage. I haven't tested with other wlroots compositor or with other wayland implementation.

For comparison, the logs of a working version:

... (identical)
Nov 01 07:46:47 framework sway[2563]: 00:00:00.063 [INFO] [wlr] [libseat] [libseat/libseat.c:73] Seat opened with backend 'logind'
Nov 01 07:46:47 framework sway[2563]: 00:00:00.063 [INFO] [wlr] [backend/session/session.c:108] Successfully loaded libseat session
Nov 01 07:46:47 framework sway[2563]: 00:00:00.069 [INFO] [wlr] [backend/backend.c:256] Found 1 GPUs
Nov 01 07:46:47 framework sway[2563]: 00:00:00.069 [INFO] [wlr] [backend/drm/backend.c:185] Initializing DRM backend for /dev/dri/card1 (amdgpu)
Nov 01 07:46:47 framework sway[2563]: 00:00:00.069 [DEBUG] [wlr] [backend/drm/drm.c:111] Using atomic DRM interface
Nov 01 07:46:47 framework sway[2563]: 00:00:00.069 [DEBUG] [wlr] [backend/drm/drm.c:131] ADDFB2 modifiers supported
...

#The systemd unit:

# /etc/systemd/system/wayland-login@.service.d/override.conf
# Debug / bisect convenience stuff
# I used both LD_* because I'm not sure which one works 
[Service]
Environment=LD_PRELOAD=/home/max/contribs/seatd/build/libseat.so.1
Environment=LD_LIBRARY_PATH=/home/max/contribs/seatd/build/
ExecStart=
ExecStart=/home/max/contribs/sway/build/sway/sway -d
Restart=no

# /etc/systemd/system/wayland-login@.service (working setup before
# upgrade to seatd 0.9.0)
[Unit]
Description=Direct Wayland login for user %i
After=systemd-user-sessions.service
Conflicts=getty@tty7.service xlogin@.service

[Service]
Type=simple
User=%i
WorkingDirectory=~
TTYPath=/dev/tty7
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
StandardError=journal
StandardOutput=journal
PAMName=login
Environment=XDG_CURRENT_DESKTOP=sway
ExecStart=/usr/bin/sway
Restart=on-success
UtmpIdentifier=tty7
UtmpMode=user

[Install]
WantedBy=graphical.target

#Steps to reproduce

Copy the above unit in /etc/systemd/system From a tty over than tty7, run systemctl start wayland-login@<existing user on the system>.service Then check journalctl -u wayland-login@<user>.service

# git bisect results
# bad: [566ffeb032af42865dc1210e48cec08368059bb9] Bump version to 0.9.1
# good: [3e9ef69f14f630a719dd464f3c90a7932f1c8296] Bump version to 0.8.0
git bisect start '0.9.1' '0.8.0'
# bad: [c070b5a6fb029e8594cb3c19da588c1104a238fb] seat: Merge close_client with remove_client
git bisect bad c070b5a6fb029e8594cb3c19da588c1104a238fb
# good: [01d058387b0b0c306ee93f61c7e2315d29af3088] systemd: protect system clock
git bisect good 01d058387b0b0c306ee93f61c7e2315d29af3088
# bad: [5be64d637611f8eefae36bc708b82063ce764083] libseat/seatd: Dispatch utility cleanup
git bisect bad 5be64d637611f8eefae36bc708b82063ce764083
# good: [546022237cba6af31db327a27ecd5cf319df26a5] systemd: restrict access to devices
git bisect good 546022237cba6af31db327a27ecd5cf319df26a5
# skip: [436c65029324e10cd2f41a372e8428c2fa6275c0] libseat/seatd: Error on unexpected response
git bisect skip 436c65029324e10cd2f41a372e8428c2fa6275c0
# good: [78c927d0bf962edc714301b8fdca4527ccf27f49] connection: Add overflow edge-case test
git bisect good 78c927d0bf962edc714301b8fdca4527ccf27f49
# only skipped commits left to test
# possible first bad commit: [5be64d637611f8eefae36bc708b82063ce764083] libseat/seatd: Dispatch utility cleanup
# possible first bad commit: [436c65029324e10cd2f41a372e8428c2fa6275c0] libseat/seatd: Error on unexpected response

#Other packages version:

linux 6.11.5.arch1-1 systemd 256.7-1

I can provide other info if needed Thanks !

-- Max Gautier

Status
RESOLVED CLOSED
Submitter
~mgautier
Assigned to
No-one
Submitted
6 months ago
Updated
6 months ago
Labels
No labels applied.

~mgautier 6 months ago*

Ok, submitting by email was a mistake T_T (can't edit that to be more readable apparently ?)

~kennylevinsen 6 months ago

You are likely seeing the effect of 0a86b9785ab22124144c05d572d5dd8b24fcf57e ("logind: Skip session activation"). This change means that libseat will no longer initiate a switch to the logind session (in this case, a VT switch to VT 7), allowing sessions to be started in the background. This was a usecase weston needed.

If you want to run on an inactive tty, you will need to switch to it (maybe ExecStartPre=chvt 7?). Alternatively pick a VT that is already active (tty1 for example) - ensure that the existing getty (e.g., getty@tty1.service) is in both Conflicts= and After= of the systemd service to make it go away when sway starts.

Ok, submitting by email was a mistake T_T (can't edit that to be more readable apparently ?)

Fixed it for you.

~mgautier 6 months ago

With those hints, I noticed that if I manually switch to tty7 on boot (Ctrl+alt+f7), sway start without problems (I hadn't thought of testing that, I confess^).

ExecStartPre=+chvt 7 works (As does ExecStartPost, btw ; and the ``+ is necessary to have the necessary privileges for vt switch). I've also added the After=getty@tty7.service, it makes sense after re-reading the Conflicts= section in systemd.unit (did not test if that makes a difference, though, getty@tty7 being disabled by default on my distribution).

Thanks a lot !

~kennylevinsen REPORTED CLOSED 6 months ago

Register here or Log in to comment, or comment via email.