<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>488032</bug_id>
          
          <creation_ts>2024-06-04 17:52:09 +0000</creation_ts>
          <short_desc>Plasma session gets killed during 6.0 -&gt; 6.1 upgrades</short_desc>
          <delta_ts>2024-06-07 16:49:43 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Plasma</classification>
          <product>plasmashell</product>
          <component>general</component>
          <version>git-stable-Plasma/6.1</version>
          <rep_platform>Other</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>regression</keywords>
          <priority>VHI</priority>
          <bug_severity>crash</bug_severity>
          <target_milestone>1.0</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Fabian Vogt">fabian</reporter>
          <assigned_to name="David Edmundson">kde</assigned_to>
          <cc>heiko.becker</cc>
    
    <cc>kde</cc>
    
    <cc>kde</cc>
    
    <cc>nate</cc>
    
    <cc>plasma-bugs-null</cc>
          
          <cf_commitlink>https://invent.kde.org/plasma/plasma-workspace/-/commit/c0624a8bddc2843a1652ea96e6bd1ab231becc8a</cf_commitlink>
          <cf_versionfixedin>6.1</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2324543</commentid>
    <comment_count>0</comment_count>
    <who name="Fabian Vogt">fabian</who>
    <bug_when>2024-06-04 17:52:09 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2324562</commentid>
    <comment_count>1</comment_count>
    <who name="David Edmundson">kde</who>
    <bug_when>2024-06-04 19:28:07 +0000</bug_when>
    <thetext>Thanks for the investigation, I bet that was a pain.

&gt; 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&apos;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 &apos;org.kde.startplasma&apos;, which obviously wasn&apos;t the case during the last boot.

If so I can just delete from waiter.cpp

```
        if (!sessionBus.interface()-&gt;isServiceRegistered(mService)) {
            qCDebug(LOG_PLASMA) &lt;&lt; &quot;WaitForName: Service&quot; &lt;&lt; mService &lt;&lt; &quot;is not yet registered&quot;;
            return false;
        }
```

and say &quot;watch for deregistration, but if the service doesn&apos;t exist, carry on&quot;. 
That would fix this issue, and fix the bug this was trying to fix in the first place.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2324567</commentid>
    <comment_count>2</comment_count>
    <who name="Fabian Vogt">fabian</who>
    <bug_when>2024-06-04 19:46:43 +0000</bug_when>
    <thetext>(In reply to David Edmundson from comment #1)
&gt; Thanks for the investigation, I bet that was a pain.
&gt; 
&gt; &gt; This notices that plasma-workspace.target is active but the new plasma-sentinel.service is not, so it tries to rectify the situation:
&gt; 
&gt; I *think* that&apos;s not quite the whole story. 
&gt; 
&gt; I think the new target will bring up plasma-sentinel.service, but
&gt; plasma-sentinel.service will exit immediately if startplasma does not own
&gt; the DBus name &apos;org.kde.startplasma&apos;, which obviously wasn&apos;t the case during
&gt; 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&apos;t show any sign of such an attempt.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2324635</commentid>
    <comment_count>3</comment_count>
    <who name="David Edmundson">kde</who>
    <bug_when>2024-06-05 06:03:11 +0000</bug_when>
    <thetext>I ran systemctl --user edit plasma-workspace.target and BindsTo=plasma-krunner can cause an immediate restart, even if it&apos;s &apos;Wanted&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2324943</commentid>
    <comment_count>4</comment_count>
    <who name="Bug Janitor Service">bug-janitor</who>
    <bug_when>2024-06-06 08:45:20 +0000</bug_when>
    <thetext>A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4421</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2325280</commentid>
    <comment_count>5</comment_count>
    <who name="Bug Janitor Service">bug-janitor</who>
    <bug_when>2024-06-07 07:59:02 +0000</bug_when>
    <thetext>A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4425</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2325321</commentid>
    <comment_count>6</comment_count>
    <who name="David Edmundson">kde</who>
    <bug_when>2024-06-07 11:42:59 +0000</bug_when>
    <thetext>Git commit dcd7080d7f04906ba2998e02779072a3ed9aaa66 by David Edmundson.
Committed on 07/06/2024 at 11:21.
Pushed by davidedmundson into branch &apos;master&apos;.

Revert &quot;startkde: Close systemd session when startplasma exits&quot;

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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2325474</commentid>
    <comment_count>7</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2024-06-07 16:49:43 +0000</bug_when>
    <thetext>Git commit c0624a8bddc2843a1652ea96e6bd1ab231becc8a by Nate Graham, on behalf of David Edmundson.
Committed on 07/06/2024 at 16:29.
Pushed by ngraham into branch &apos;Plasma/6.1&apos;.

Revert &quot;startkde: Close systemd session when startplasma exits&quot;

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</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>