When updating in Discover, there's an option of: "On completion, automatically: [Restart / Shutdown]". However, using either of those options (I've tested only with Restart, but I assume the same is true for Shutdown) seems to perform a "brute" restart. When clicking to restart in the application launcher (start menu), Plasma nicely closes all apps before it restarts. But when using the same option for the automation in Discover it doesn't seem to do that — instead, it seems to do something such as SIGKILL all processes and proceed to restart, without asking them nicely to shut down themselves first. An example I can give (which just happened to me when using the Restart automation) was that Steam (the gaming app) didn't show "Shutting down Steam..." before it was closed, and Firefox, the next time I started it after rebooting, restored my tabs like if it had recovered from a crash/bad exit (I don't have "Open previous tabs" on start-up enabled). Operating System: Fedora Linux 41 KDE Plasma Version: 6.2.5 KDE Frameworks Version: 6.10.0 Qt Version: 6.8.1 Kernel Version: 6.12.10-200.fc41.x86_64 (64-bit) Graphics Platform: Wayland
Discover calls org.freedesktop.login1 directly. Plasma arguably could take a inhibitor to enforce its shutdown process.
*** Bug 509049 has been marked as a duplicate of this bug. ***
Raising priority and severity given the possibility of data loss here.
Bug or not, I still think a timeout should be added. We can not control every app a user is running on their system, nor should we. We can not guarantee any app would respect a shutdown notice and prompt the user to save their work.
The automatic shutdown/restart feature is optional and not engaged by default. If you turn it on, I think you know what you're getting yourself into: that the system automatically shuts down or restarts after the updates are finished. If you're actively using the system, the feature doesn't really make sense to use, because it will shut down or restart when you're potentially in the middle of doing something. Even with a timer, all that would do is create stress and panic by making you scramble to close everything before the timer runs out.
I think a better idea would be to simply remove this feature instead of fixing it. The user is already informed with a very big on-screen text that he needs to restart the computer in order to apply the updates (on Fedora KDE, at least). Besides that, when going to restart, once again the system shows the "Restart & Install Updates" option too. (All of this is also true for shutdown.) So maybe the option being there is an extra that is not really that necessary...? That's what I think now. Thanks.
> If you turn it on, I think you know what you're getting yourself into: that the system automatically shuts down or restarts after the updates are finished. You're talking to a user who forgets things, sometimes within seconds of doing them.
This diff in Discover fixes the issue: diff --git discover/DiscoverObject.cpp discover/DiscoverObject.cpp index 5623c21fe..f13aefa8b 100644 --- discover/DiscoverObject.cpp +++ discover/DiscoverObject.cpp @@ -670,12 +670,11 @@ void DiscoverObject::promptReboot() void DiscoverObject::rebootNow() { setAboutToReboot(); - auto method = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.login1"), - QStringLiteral("/org/freedesktop/login1"), - QStringLiteral("org.freedesktop.login1.Manager"), - QStringLiteral("Reboot")); - method.setArguments({true /*interactive*/}); - QDBusConnection::systemBus().asyncCall(method); + auto method = QDBusMessage::createMethodCall(QStringLiteral("org.kde.Shutdown"), + QStringLiteral("/Shutdown"), + QStringLiteral("org.kde.Shutdown"), + QStringLiteral("logoutAndReboot")); + QDBusConnection::sessionBus().asyncCall(method); } The question now is whether porting from org.freedesktop.login1 to org.kde.Shutdown is the right approach, vs plumbing our session teardown code and confirmation prompts through org.freedesktop.login1.
Talked to David E, and porting to org.kde.Shutdown is appropriate here.
A possibly relevant merge request was started @ https://invent.kde.org/plasma/discover/-/merge_requests/1171
Git commit 025dc056076be0c54a50dc988c18ab2adb439812 by Aleix Pol, on behalf of Nate Graham. Committed on 03/10/2025 at 18:07. Pushed by ngraham into branch 'master'. Use safer org.kde.Shutdown to shut down and restart Currently we use org.freedesktop.login1, which will not let apps prompt the user to save changes. This can lead to data loss. Ideally org.freedesktop.login1 would be plumbed through our session stuff so apps can prompt, but that's quite a ways away. In the meantime, use org.kde.Shutdown to resolve the issue. FIXED-IN: 6.4.6 M +10 -12 discover/DiscoverObject.cpp https://invent.kde.org/plasma/discover/-/commit/025dc056076be0c54a50dc988c18ab2adb439812
Git commit 8b3229a431808c05edf6c8c31f7d049927b81a67 by Nate Graham. Committed on 03/10/2025 at 20:04. Pushed by ngraham into branch 'Plasma/6.5'. Use safer org.kde.Shutdown to shut down and restart Currently we use org.freedesktop.login1, which will not let apps prompt the user to save changes. This can lead to data loss. Ideally org.freedesktop.login1 would be plumbed through our session stuff so apps can prompt, but that's quite a ways away. In the meantime, use org.kde.Shutdown to resolve the issue. FIXED-IN: 6.4.6 (cherry picked from commit 025dc056076be0c54a50dc988c18ab2adb439812) Co-authored-by: Nate Graham <nate@kde.org> M +10 -12 discover/DiscoverObject.cpp https://invent.kde.org/plasma/discover/-/commit/8b3229a431808c05edf6c8c31f7d049927b81a67
Git commit 3c71a1d74d2f0b44cdc91e543b524fccdb770de1 by Nate Graham. Committed on 03/10/2025 at 20:05. Pushed by ngraham into branch 'Plasma/6.4'. Use safer org.kde.Shutdown to shut down and restart Currently we use org.freedesktop.login1, which will not let apps prompt the user to save changes. This can lead to data loss. Ideally org.freedesktop.login1 would be plumbed through our session stuff so apps can prompt, but that's quite a ways away. In the meantime, use org.kde.Shutdown to resolve the issue. FIXED-IN: 6.4.6 (cherry picked from commit 025dc056076be0c54a50dc988c18ab2adb439812) Co-authored-by: Nate Graham <nate@kde.org> M +10 -12 discover/DiscoverObject.cpp https://invent.kde.org/plasma/discover/-/commit/3c71a1d74d2f0b44cdc91e543b524fccdb770de1