Bug 436928 - Option to apply updates on shutdown, not startup
Summary: Option to apply updates on shutdown, not startup
Status: CONFIRMED
Alias: None
Product: Discover
Classification: Applications
Component: Updates (offline) (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Dan Leinir Turthra Jensen
URL:
Keywords: usability
: 435971 438136 467145 483896 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-05-11 13:12 UTC by Harald Sitter
Modified: 2024-04-11 22:35 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harald Sitter 2021-05-11 13:12:40 UTC
SUMMARY
offline updates may be followed by a reboot or a power-off. currently we always force reboot. it maybe useful to have a configuration option for this as users might prefer to apply updates on shutdown rather than boot up.

Kind of ties into bug #436924 as power-off requires that ksmserver redirects the UI option for power-off into an actual reboot combined with the setting the trigger word on packagekit to 'power-off' such that packagekit will poweroff after the update.

https://github.com/hughsie/PackageKit/blob/master/docs/offline-updates.txt
Comment 1 Nate Graham 2021-05-11 14:27:00 UTC
You're talking about in the Discover UI itself, right?

Ideally I think we would have two post-update options for the user:

- Reboot now
- Close the app and apply the updates on next shutdown/reboot, or not, as per Bug 436924.
Comment 2 Harald Sitter 2021-05-17 09:03:29 UTC
(In reply to Nate Graham from comment #1)
> You're talking about in the Discover UI itself, right?

Yes, well, the KCM I suppose.

Depending on a specific user's way of using the system it may be more appropriate to set the offline update behavior to reboot (after update the system reboots) or power-off (after update the system powers off).

e.g. consider two office use cases:

User A has a system with SSD and tends to grab a cup of coffee after entering the office and turning on the PC. reboot is a reasonable system for this scenario because the user will be away from the machine for a while anyway. Meanwhile we start into the update target, apply the update, reboot. By the time the user is back we'd ideally be done and they can log in.

User B has a system with a HDD and doesn't drink coffee. power-off may be a more reasonable approach. They will power off the system when they leave the office anyway. We can simply set the offline trigger to power-off and instruct ksmserver/the greeter to perform a reboot instead of a power-off. The user leaves the office. The PC reboots into the update target, applies the update, powers off.
Comment 3 Aleix Pol 2021-05-17 23:15:25 UTC
The two behaviours that PackageKit offers are:
- apply on startup then reboot with the new software
- apply it at shutdown where it reboots, applies the updates and shuts down

Now we're always going with the first one because the latter has weirdness when the user asks for reboot (it will shut down anyway, we'd need to hook onto the user's selection) and it asks the user for the bios/disk password when they're shutting down which feels very weird.

If we could get PackageKit to apply the updates in the used session before updating, that could be a useful alternative, as the next startup would already happen with the new kernel and all, but as is it feels very wonky.
Comment 4 Harald Sitter 2021-05-19 09:38:02 UTC
Technically possible; needs talking to with upstream though: https://bugs.kde.org/show_bug.cgi?id=435971#c6
Comment 5 Nate Graham 2022-11-14 20:02:20 UTC
*** Bug 435971 has been marked as a duplicate of this bug. ***
Comment 6 Nate Graham 2022-11-14 20:02:25 UTC
*** Bug 438136 has been marked as a duplicate of this bug. ***
Comment 7 TrianguloY 2022-11-17 16:49:26 UTC
Workaround for those waiting on this feature:
With this script https://unix.stackexchange.com/a/621933 you can effectively "update and shutdown" but with the following caveat:
- The computer needs to restart to launch the offline updater, which means that it will boot grub/bootloader and everything related, as mentioned in another comment. If you need to manually choose an option when booting  or you have bios/disk password, you will need to wait and enter them. Once the updater starts you can then leave your computer, it will properly turn off after finishing (instead of the currently hardcoded reboot).
Comment 8 John 2023-02-14 15:27:25 UTC
Harald Sitter's *User B* is definitely the desired mode around here.
(i prefer to get updates as soon as possible - even if it causes some system instability - but for all other workers here, User B is perfect)

Is there any PackageKit bug report on the issue Aleix Pol describes about applying updates on shutdown?
Comment 9 Nate Graham 2023-03-13 19:50:37 UTC
*** Bug 467145 has been marked as a duplicate of this bug. ***
Comment 10 John 2023-05-08 14:41:11 UTC
Bug 452820 is possibly a duplicate of this (needs confirmation)
Comment 11 postix 2023-11-25 16:12:01 UTC
 Richard Hughes, collaborator of PackageKit, said on Oct 2021 [1] 

>> Apply updates while shutting down instead of when turning on
> Also not possible as you need a pristine boot to apply updates safely, rather than a system that has been futzed with.

[1] https://github.com/PackageKit/PackageKit/issues/510#issuecomment-935732482
Comment 12 postix 2023-11-25 16:23:42 UTC
systemd v254 introduced a new reboot type: soft-reboot. [1] Do you think this could help here? 

[1] https://media.ccc.de/v/all-systems-go-2023-184-soft-reboot-atomically-replace-rootfs-and-reboot-userspace-without-kernel-restart
Comment 13 postix 2023-11-25 20:59:29 UTC
^ I meant in order not to need entering the luks encryption password on the reboot to apply the offline-update.
Comment 14 John 2023-11-27 10:52:15 UTC
Maybe it's worth noting here that, according to user "Phil O", this may serve as a workaround:

> sudo dnf update -y && poweroff || { sleep 30 ; poweroff ; }
from:
https://pointieststick.com/2023/11/24/this-week-in-kde-the-plasma-6-feature-freeze-approaches/#comment-38562
Comment 15 Nate Graham 2024-04-11 22:35:26 UTC
*** Bug 483896 has been marked as a duplicate of this bug. ***