Bug 433333 - [systemd] Enabling systemdBoot breaks 'startkde'
Summary: [systemd] Enabling systemdBoot breaks 'startkde'
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: generic-crash (show other bugs)
Version: 5.21.0
Platform: Neon Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-20 14:37 UTC by The Feren OS Dev
Modified: 2021-03-03 16:29 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.21.3


Attachments
xsession-errors (4.11 KB, text/plain)
2021-02-20 14:37 UTC, The Feren OS Dev
Details
journalctl --user (39.93 KB, text/plain)
2021-02-20 15:18 UTC, The Feren OS Dev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description The Feren OS Dev 2021-02-20 14:37:50 UTC
Created attachment 135977 [details]
xsession-errors

SUMMARY
Enabling systemdBoot via 'kwriteconfig5 --file startkderc --group General --key systemdBoot true' completely breaks startplasma-x11 with a 'startkde' error occuring every time you log in from that point onwards until you disable systemdBoot.

STEPS TO REPRODUCE
1. Run 'writeconfig5 --file startkderc --group General --key systemdBoot true'
2. Log out
3. Log in again

OBSERVED RESULT
startkde: Could not start Plasma session. appears in an X11 dialog, closing that logs you out. KWin and co. don't start.

EXPECTED RESULT
The Desktop works fine.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: KDE neon 5.21.0
(available in About System)
KDE Plasma Version: 5.21.0
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
No useful information in the .xsession-errors file, except for the message in the X11 dialog.

Running it via manual startx /usr/bin/startplasma-x11 causes it to yield the same 'startkde: Starting up...' and 'startkde: Could not start Plasma session.' output as in the .xsession-errors log.

The plasma-plasmashell.service service seems to be disabled but enabling it does nothing to change the situation.
Furthermore, systemctl --user status plasma-plasmashell.service shows that it never attempted to run the service.

Disabling systemdBoot in the config file resolves the issue.
Comment 1 David Edmundson 2021-02-20 14:48:01 UTC
Can I have the results of "journalctl --user" after logging in
Comment 2 The Feren OS Dev 2021-02-20 15:18:29 UTC
Created attachment 135981 [details]
journalctl --user
Comment 3 David Edmundson 2021-02-20 18:36:53 UTC
Neither show a lot. I've made a MR to add some more debug for future.

Can you run:
"qdbus org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager.StartUnit plasma-workspace@x11.target fail"


from konsole. It can be called whilst systemdBoot is disabled.
Comment 4 The Feren OS Dev 2021-02-20 20:07:30 UTC
Error: org.freedesktop.systemd1.NoSuchUnit
Unit xdg-desktop-autostart.target not found.
Comment 5 David Edmundson 2021-02-20 23:05:05 UTC
Can I see your ~/.config/startkderc please?
Comment 6 David Edmundson 2021-02-20 23:24:07 UTC
I do have

 xdg-desktop-autostart.target

in Requires rather than Wants, which is what makes it fatal if not found

What puzzles me is we have a check for xdg-desktop-portal, and we should opt-out of the systemd boot if it's not available (unless forced)
Comment 7 The Feren OS Dev 2021-02-21 01:21:44 UTC
(In reply to David Edmundson from comment #5)
> Can I see your ~/.config/startkderc please?

There is none, nor is there one in /etc/xdg and co.

Upon applying the setting, this is local startkderc:
[General]
systemdBoot=true
Comment 8 David Edmundson 2021-02-21 13:33:40 UTC
Urgh, found it.

bool hasSystemdService(QString)

doesn't work as intended.

In the correct case:

qdbus --literal org.freedesktop.systemd1 /org/freedesktop/systemd1  org.freedesktop.systemd1.Manager.ListUnitsByNames xdg-desktop-autostart.target

I get a blob as expected:
[Argument: a(ssssssouso) {[Argument: (ssssssouso) "xdg-desktop-autostart.target", "Startup of XDG autostart applications", "loaded", "active", "active", "", [ObjectPath: /org/freedesktop/systemd1/unit/xdg_2ddesktop_2dautostart_2etarget], 0, "", [ObjectPath: /]]}]

------

In testing I had used a random string:

qdbus --literal org.freedesktop.systemd1 /org/freedesktop/systemd1  org.freedesktop.systemd1.Manager.ListUnitsByNames randomMissingService       
[Argument: a(ssssssouso) {}]

which returns an empty array. In this function I test for an empty array, thinking that was a nice quick and safe solution.

------

In practice, if something is well formed, what I get is:

qdbus --literal org.freedesktop.systemd1 /org/freedesktop/systemd1  org.freedesktop.systemd1.Manager.ListUnitsByNames randomMissingService.service
[Argument: a(ssssssouso) {[Argument: (ssssssouso) "randomMissingService.service", "randomMissingService.service", "not-found", "inactive", "dead", "", [ObjectPath: /org/freedesktop/systemd1/unit/randomMissingService_2eservice], 0, "", [ObjectPath: /]]}]
Comment 9 Bug Janitor Service 2021-02-22 19:00:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/663
Comment 10 Bug Janitor Service 2021-03-03 14:27:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/688
Comment 11 hchain 2021-03-03 16:01:54 UTC
Git commit 1c7e3064d88d13fb4a03aba41bd6d5ac7ca832e7 by Henri Chain, on behalf of David Edmundson.
Committed on 03/03/2021 at 14:41.
Pushed by davidedmundson into branch 'master'.

Fix query of StartPlasma::hasSystemdService

ListUnitByNames did not quite work as the author (me) expected. Whilst a
search for "adsfasf" yeilded an empty list a well-formed name like
"asdfasdf.service" would return a result to say that service was not
loaded.

This means our runtime detection of xdg-autostart-generator failed.

By using ListUnitFilesByPatterns we can filter on the status in the
query, meaning this code works again. We also can query the case of it
being available but explicitly disabled.

M  +3    -3    startkde/startplasma.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/1c7e3064d88d13fb4a03aba41bd6d5ac7ca832e7
Comment 12 David Edmundson 2021-03-03 16:02:50 UTC
Git commit bbe0f91070ac7235066b28e57f9971ac1a4f821e by David Edmundson.
Committed on 03/03/2021 at 16:02.
Pushed by davidedmundson into branch 'Plasma/5.21'.

Fix query of StartPlasma::hasSystemdService

ListUnitByNames did not quite work as the author (me) expected. Whilst a
search for "adsfasf" yeilded an empty list a well-formed name like
"asdfasdf.service" would return a result to say that service was not
loaded.

This means our runtime detection of xdg-autostart-generator failed.

By using ListUnitFilesByPatterns we can filter on the status in the
query, meaning this code works again. We also can query the case of it
being available but explicitly disabled.


(cherry picked from commit 1c7e3064d88d13fb4a03aba41bd6d5ac7ca832e7)

M  +3    -3    startkde/startplasma.cpp

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