Bug 483066 - logout no longer works after disabling systemd boot
Summary: logout no longer works after disabling systemd boot
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Session Management (show other bugs)
Version: 6.0.0
Platform: Neon Linux
: HI major
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-03-10 03:54 UTC by S. Christian Collins
Modified: 2024-03-25 21:54 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description S. Christian Collins 2024-03-10 03:54:38 UTC
SUMMARY
Some of my startup scripts/applications fail to start with systemd boot enabled, so I have disabled it by creating "~/.config/startkderc" containing:

  [General]
  systemdBoot=false

This worked without issue in Plasma 5, but in Plasma 6, disabling systemd boot causes logout to no longer work. Under X11, logging out stalls at a black screen with a mouse cursor. Under Wayland, logging out appears to do nothing. After trying to log out in Wayland, the shutdown and restart buttons will now also do nothing for the rest of the session.

STEPS TO REPRODUCE
1. Disable systemd boot. Here's a quick command to create/edit `startkderc`:

     kwriteconfig5 --file startkderc --group General --key systemdBoot false

2. Restart and log into the desktop.
3. Click on the plasma menu, then choose "Log Out", and confirm on the following logout screen.

OBSERVED RESULT
Stuck on black screen with mouse cursor (X11) or nothing appears to happen, with shutdown, restart buttons becoming broken for the rest of the session (Wayland).

EXPECTED RESULT
The user should be logged out and back at the SDDM login screen.

SOFTWARE/OS VERSIONS
Linux: KDE neon User Edition 6.0
KDE Plasma Version: 6.0.0
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2

ADDITIONAL INFORMATION
Bug confirmed on three separate KDE neon installs (1 desktop, 1 laptop, 1 VirtualBox).
Comment 1 Nate Graham 2024-03-13 15:46:49 UTC
Can reproduce all of those issues on Wayland, Did not test X11.
Comment 2 David Edmundson 2024-03-13 17:21:44 UTC
Found it: 

```
    auto msg = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.systemd1"),
                                              QStringLiteral("/org/freedesktop/systemd1"),
                                              QStringLiteral("org.freedesktop.systemd1.Manager"),
                                              QStringLiteral("StopUnit"));
    msg << QStringLiteral("graphical-session.target") << QStringLiteral("fail");
    QDBusReply<QDBusObjectPath> reply = QDBusConnection::sessionBus().call(msg);

    if (!reply.isValid()) { 
                      do the legacy path
```


If systemd is available, but we're not using the systemd boot, that DBus call is perfectly legit so it doesn't fail. It just does nothing. So we never enter the legacy path.

We'll need to find a way to distinguish those two
Comment 3 Bug Janitor Service 2024-03-18 09:01:53 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4095
Comment 4 David Edmundson 2024-03-22 14:08:36 UTC
Git commit 41629e86035e341bb4dea662236aefdc274e7c30 by David Edmundson.
Committed on 22/03/2024 at 13:49.
Pushed by davidedmundson into branch 'master'.

plasma-shutdown: Correclty detect if we're using the legacy session

We need different shutdown paths for the systemd and legacy boot. The
current code worked by making the systemd call to end the session and
checking the return status.

This worked for handling the situation where systemd is not installed.
It does not capture the case where the systemd boot is explicitly
disabled. The call successfully does nothing.

Instead replace with an explicit check that our target is activated.

Also change to end the plasma-workspace.target as that's semantically
more correct given it's the one we started. This is bound to the
graphical-session so it ends up being the same thing.

M  +29   -6    startkde/plasma-shutdown/shutdown.cpp
M  +1    -0    startkde/plasma-shutdown/shutdown.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/41629e86035e341bb4dea662236aefdc274e7c30
Comment 5 Nate Graham 2024-03-25 21:45:48 UTC
Git commit b0c3c66fc04a7743c6c61d54e1d825349de5d8b6 by Nate Graham, on behalf of David Edmundson.
Committed on 25/03/2024 at 21:25.
Pushed by ngraham into branch 'Plasma/6.0'.

plasma-shutdown: Correclty detect if we're using the legacy session

We need different shutdown paths for the systemd and legacy boot. The
current code worked by making the systemd call to end the session and
checking the return status.

This worked for handling the situation where systemd is not installed.
It does not capture the case where the systemd boot is explicitly
disabled. The call successfully does nothing.

Instead replace with an explicit check that our target is activated.

Also change to end the plasma-workspace.target as that's semantically
more correct given it's the one we started. This is bound to the
graphical-session so it ends up being the same thing.


(cherry picked from commit 41629e86035e341bb4dea662236aefdc274e7c30)

M  +29   -6    startkde/plasma-shutdown/shutdown.cpp
M  +1    -0    startkde/plasma-shutdown/shutdown.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/b0c3c66fc04a7743c6c61d54e1d825349de5d8b6