Bug 451447

Summary: User logout script(s) skipped when performing offline updates with restart option
Product: [Applications] Discover Reporter: Sadi <sadiyumusak>
Component: Updates (offline)Assignee: Dan Leinir Turthra Jensen <leinir>
Status: RESOLVED FIXED    
Severity: normal CC: aleixpol, nate
Priority: NOR    
Version First Reported In: 5.24.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Sadi 2022-03-13 12:54:17 UTC
SUMMARY
***
Discover offline updates with restart option enabled skips user logout script(s), which can be important for the user, like checking something that will be lost when computer is restarted.
***

STEPS TO REPRODUCE
1. Use a logout script, e.g. containing a yesno kdialog. 
2. Tick the restart option box at the bottom of Updates window.
3. Perform the updates. 

OBSERVED RESULT
Computer restarts without executing the user logout script. 

EXPECTED RESULT
The user logout script should be executed as in other cases of performing restart (qdbus org.kde.ksmserver /KSMServer logout 0 1 3) 

SOFTWARE/OS VERSIONS
Operating System: KDE neon 5.24
KDE Plasma Version: 5.24.3
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.3
Comment 1 Nate Graham 2022-03-25 14:55:51 UTC
Looks like this is because the DiscoverObject::rebootNow() function does the following:

    auto method = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.login1"),
                                                 QStringLiteral("/org/freedesktop/login1"),
                                                 QStringLiteral("org.freedesktop.login1.Manager"),
                                                 QStringLiteral("Reboot"));

Notably it bypasses ksmserver and just uses the freedesktop thing, which is why logout scripts would be skipped. Should be a relatively easy fix. Would you be interested in submitting a merge request to change it to the other dbus call that you mentioned?
Comment 2 Sadi 2022-03-25 17:19:35 UTC
(In reply to Nate Graham from comment #1)

I wish I could with my elementary scripting skills (nowhere close to programming) .
I could only find that block in file "/master/discover/DiscoverObject.cpp" but I have no idea how and where exactly the command "qdbus org.kde.ksmserver /KSMServer logout 0 1 3" should replace the freedesktop thing.
Comment 3 Nate Graham 2025-09-18 20:48:58 UTC
It does it interactively now, which goes through ksmserver, which fixes the issue.