Bug 488032 - Plasma session gets killed during 6.0 -> 6.1 upgrades
Summary: Plasma session gets killed during 6.0 -> 6.1 upgrades
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: git-stable-Plasma/6.1
Platform: Other Linux
: VHI crash
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-06-04 17:52 UTC by Fabian Vogt
Modified: 2024-06-07 16:49 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Vogt 2024-06-04 17:52:09 UTC
When upgrading from Plasma 6.0 to 6.1 (Beta) while a 6.0 session is active, that session gets killed.

The reason for that plasma-workspace updates and adds some user .service files, including plasma-sentinel.service. To make systemd aware of this, the update triggers a daemon-reload of systemd user instances. This notices that plasma-workspace.target is active but the new plasma-sentinel.service is not, so it tries to rectify the situation:

Jun 04 13:40:37 localhost.localdomain systemd[1639]: plasma-workspace.target: Unit is stopped because bound to inactive unit plasma-sentinel.service.
Jun 04 13:40:37 localhost.localdomain systemd[1639]: plasma-workspace.target: Trying to enqueue job plasma-workspace.target/stop/replace

This is fatal for the session.
Comment 1 David Edmundson 2024-06-04 19:28:07 UTC
Thanks for the investigation, I bet that was a pain.

> This notices that plasma-workspace.target is active but the new plasma-sentinel.service is not, so it tries to rectify the situation:

I *think* that's not quite the whole story. 

I think the new target will bring up plasma-sentinel.service, but plasma-sentinel.service will exit immediately if startplasma does not own the DBus name 'org.kde.startplasma', which obviously wasn't the case during the last boot.

If so I can just delete from waiter.cpp

```
        if (!sessionBus.interface()->isServiceRegistered(mService)) {
            qCDebug(LOG_PLASMA) << "WaitForName: Service" << mService << "is not yet registered";
            return false;
        }
```

and say "watch for deregistration, but if the service doesn't exist, carry on". 
That would fix this issue, and fix the bug this was trying to fix in the first place.
Comment 2 Fabian Vogt 2024-06-04 19:46:43 UTC
(In reply to David Edmundson from comment #1)
> Thanks for the investigation, I bet that was a pain.
> 
> > This notices that plasma-workspace.target is active but the new plasma-sentinel.service is not, so it tries to rectify the situation:
> 
> I *think* that's not quite the whole story. 
> 
> I think the new target will bring up plasma-sentinel.service, but
> plasma-sentinel.service will exit immediately if startplasma does not own
> the DBus name 'org.kde.startplasma', which obviously wasn't the case during
> the last boot.

I had the same thought, but the log does not show any attempt at starting plasma-sentinel.service.
systemctl --user status plasma-sentinel.service also doesn't show any sign of such an attempt.
Comment 3 David Edmundson 2024-06-05 06:03:11 UTC
I ran systemctl --user edit plasma-workspace.target and BindsTo=plasma-krunner can cause an immediate restart, even if it's 'Wanted'
Comment 4 Bug Janitor Service 2024-06-06 08:45:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4421
Comment 5 Bug Janitor Service 2024-06-07 07:59:02 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4425
Comment 6 David Edmundson 2024-06-07 11:42:59 UTC
Git commit dcd7080d7f04906ba2998e02779072a3ed9aaa66 by David Edmundson.
Committed on 07/06/2024 at 11:21.
Pushed by davidedmundson into branch 'master'.

Revert "startkde: Close systemd session when startplasma exits"

This code worked a bit too aggressively; on a live upgrade from 6.0 to 6.1,
systemd will reload and immediately quit the whole session.

This reverts commit 0ff2e9a70ccfa96b82fd6d2ea5a0a8545a5e3a60.

M  +0    -4    startkde/startplasma.cpp
M  +1    -1    startkde/systemd/CMakeLists.txt
D  +0    -10   startkde/systemd/plasma-sentinel.service.in
M  +1    -6    startkde/systemd/plasma-workspace.target
M  +1    -3    startkde/waitforname/waiter.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/dcd7080d7f04906ba2998e02779072a3ed9aaa66
Comment 7 Nate Graham 2024-06-07 16:49:43 UTC
Git commit c0624a8bddc2843a1652ea96e6bd1ab231becc8a by Nate Graham, on behalf of David Edmundson.
Committed on 07/06/2024 at 16:29.
Pushed by ngraham into branch 'Plasma/6.1'.

Revert "startkde: Close systemd session when startplasma exits"

This code worked a bit too aggressively; on a live upgrade from 6.0 to 6.1,
systemd will reload and immediately quit the whole session.

This reverts commit 0ff2e9a70ccfa96b82fd6d2ea5a0a8545a5e3a60.

M  +0    -4    startkde/startplasma.cpp
M  +1    -1    startkde/systemd/CMakeLists.txt
D  +0    -10   startkde/systemd/plasma-sentinel.service.in
M  +1    -6    startkde/systemd/plasma-workspace.target
M  +1    -3    startkde/waitforname/waiter.cpp

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