Bug 512276

Summary: kwin_wayland attempts to call `Inhibit` method on `org.freedesktop.login1.Seat` D-Bus interface, but this method only exists on `org.freedesktop.login1.Manager` interface. This results in repeated error messages in the journal
Product: [Plasma] kwin Reporter: gitf.zone
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: julien.dlq, kde, nate
Priority: NOR    
Version First Reported In: 6.5.2   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 6.5.4
Sentry Crash Report:

Description gitf.zone 2025-11-18 05:21:59 UTC
## Error Message

```
kwin_wayland[1870]: Failed to delay sleep: Unknown method Inhibit or interface org.freedesktop.login1.Seat.
```

---

## Steps to Reproduce

1. Run KDE Plasma 6.5.2 on Wayland
2. Configure power management with auto-suspend enabled (e.g., 30 minutes)
3. Trigger screen locking or DPMS events
4. Check journal logs

**Actual Result:**
```bash
journalctl -b 0 | grep "Failed to delay sleep"
```

Shows repeated errors:
```
Nov 17 07:26:38 kwin_wayland[1870]: Failed to delay sleep: Unknown method Inhibit or interface org.freedesktop.login1.Seat.
Nov 17 20:32:42 kwin_wayland[1870]: Failed to delay sleep: Unknown method Inhibit or interface org.freedesktop.login1.Seat.
Nov 17 20:44:51 kwin_wayland[1870]: Failed to delay sleep: Unknown method Inhibit or interface org.freedesktop.login1.Seat.
```

**Expected Result:**
kwin_wayland should call `Inhibit` on the Manager interface instead:
```
org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Inhibit
```

---

## Technical Analysis

### D-Bus Interface Verification

Using `busctl introspect` to check available methods:

**Seat interface** (`/org/freedesktop/login1/seat/seat0`):
```bash
busctl introspect org.freedesktop.login1 /org/freedesktop/login1/seat/seat0 org.freedesktop.login1.Seat
```

Methods available:
- ActivateSession
- SwitchTo
- SwitchToNext
- SwitchToPrevious
- Terminate

**NO `Inhibit` method exists on Seat interface.**

**Manager interface** (`/org/freedesktop/login1`):
```bash
busctl introspect org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager | grep Inhibit
```

Methods available:
- **Inhibit** (signature: ssss -> h)
- ListInhibitors

**The `Inhibit` method EXISTS on Manager interface.**

---

## Root Cause

kwin_wayland is calling:
```
org.freedesktop.login1.Seat.Inhibit
```

But should be calling:
```
org.freedesktop.login1.Manager.Inhibit
```

According to systemd-logind documentation, sleep inhibitors must be created via the Manager interface, not Seat interface.

---

## Impact

**Severity:** Low to Medium

- **User-visible impact:** Error messages in journal logs
- **Functional impact:** kwin cannot create sleep delay inhibitor, preventing proper coordination between screen locking and system suspend
- **Workaround exists:** System remains stable with D-Bus policy configuration (see below)

In some configurations, this can lead to system freezes if D-Bus policy blocks the incorrect method call entirely (returning "policy denied" instead of "unknown method").

---

## Context and History

This issue was discovered during troubleshooting of system freezes during auto-suspend. Initial error was:
```
Failed to delay sleep: Sender is not authorized to send message
```

After adding D-Bus policy to allow `Seat.Inhibit`:
```xml
<allow send_destination="org.freedesktop.login1"
       send_interface="org.freedesktop.login1.Seat"
       send_member="Inhibit"/>
```

The error changed to:
```
Failed to delay sleep: Unknown method Inhibit or interface org.freedesktop.login1.Seat.
```

This confirms kwin is calling the wrong interface.

---

## Expected Fix

kwin_wayland should be updated to call:
```cpp
QDBusInterface("org.freedesktop.login1",
               "/org/freedesktop/login1",
               "org.freedesktop.login1.Manager")
    .call("Inhibit", "sleep", "Screen Locker", "Ensuring screen gets locked", "delay");
```

Instead of calling Inhibit on the Seat object.

---

## Reproducibility

**Always reproducible** on:
- KDE Plasma 6.5.2 (Wayland)
- Arch Linux (up to date as of 2025-11-17)
- systemd 258.2

---
Comment 1 David Edmundson 2025-11-18 22:24:30 UTC
indeed
Comment 2 Bug Janitor Service 2025-11-18 22:27:10 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/8454
Comment 3 Vlad Zahorodnii 2025-11-20 08:51:28 UTC
Git commit 385357e4a227f6623788a4d6b894cf3d62d6c7c8 by Vlad Zahorodnii, on behalf of David Edmundson.
Committed on 20/11/2025 at 08:51.
Pushed by vladz into branch 'master'.

Use correct DBus interface for inhibiting sleep

This is used to play a small animation before idle shutdown.

M  +2    -2    src/core/session_consolekit.cpp
M  +2    -2    src/core/session_logind.cpp

https://invent.kde.org/plasma/kwin/-/commit/385357e4a227f6623788a4d6b894cf3d62d6c7c8
Comment 4 Vlad Zahorodnii 2025-11-20 14:09:28 UTC
Git commit 0dd26bc3e013492eb92fe934cfd49636cf9219a3 by Vlad Zahorodnii.
Committed on 20/11/2025 at 14:09.
Pushed by vladz into branch 'Plasma/6.5'.

Use correct DBus interface for inhibiting sleep

This is used to play a small animation before idle shutdown.


(cherry picked from commit 385357e4a227f6623788a4d6b894cf3d62d6c7c8)

Co-authored-by: David Edmundson <kde@davidedmundson.co.uk>

M  +2    -2    src/core/session_consolekit.cpp
M  +2    -2    src/core/session_logind.cpp

https://invent.kde.org/plasma/kwin/-/commit/0dd26bc3e013492eb92fe934cfd49636cf9219a3