Bug 447245

Summary: Auto updates do not work
Product: [Applications] Discover Reporter: Elias <supgesu>
Component: NotifierAssignee: Dan Leinir Turthra Jensen <leinir>
Status: RESOLVED FIXED    
Severity: major CC: aleixpol, dap78, dofficialgman, fleisch.johannes, gigaoxygen28, johnmaverick74, kde.cope348, kde, nate, nutzloserwerbemuell, pieterkristensen, postix, ruawhitepaw, tombrown9501, Torkin, travier, yvan
Priority: NOR    
Version: 5.23.4   
Target Milestone: ---   
Platform: Other   
OS: Linux   
URL: https://invent.kde.org/plasma/discover/-/merge_requests/369
See Also: https://bugs.kde.org/show_bug.cgi?id=471548
Latest Commit: Version Fixed In: 6.3.0
Sentry Crash Report:
Attachments: Offline updates config

Description Elias 2021-12-19 22:40:25 UTC
Hi, I try to get auto updates working on a machine that I don't want to babysit that often. The problem is that they work very unreliable. I had them working only once in all the time I have the auto update setting enabled in the system settings. But most times, the machine ends up on very old software, because the auto updates do not get run.


STEPS TO REPRODUCE
1. Use Kubuntu 21.10 or 22.04 (dev branch)
2. Enable auto updates in system settings
3. Use the machine for work

OBSERVED RESULT

Auto updates nearly never get run.

EXPECTED RESULT

Auto updates should work reliably.


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Kubuntu 22.04
(available in About System)
KDE Plasma Version: 5.23.4
KDE Frameworks Version: 5.89
Qt Version: 5.15.2

ADDITIONAL INFORMATION

I already have a guess why this works so bad. Haven't found documentation for how exactly this works (should be added btw) so I had a look at the source code.
Here:
https://invent.kde.org/plasma/discover/-/blob/5ad26c9c66cd2b8913e2ee8bfaa93f9fa76d65c0/notifier/UnattendedUpdates.cpp#L33-36

It seems that it waits for an idle moment of 15 minutes (even tho the comment says 1 hour, should be corrected and also made configurable).
I don't know what exactly "an idle moment" is. But if it means something like no user input (no mouse movement or keyboard presses) for 15 minutes then this may be the reason for my problem.
The machine I try to get auto updates working on is nearly never that long unused while powered on. Usually it is booted, someone gets work done, and it gets shut down again. Yeah, sometimes we get something to drink/eat in between or go to the toilet, but this never takes 15 minutes, so there are no 15 minutes idles and this is most likely why auto updates never get triggered.

If my assumption is true, this could be fixed by changing from 15 minutes of idle to for example just 15 minutes after boot.
Also, I think 15 minutes is a little long. Would recommend changing it to 10 minutes as default to make it more reliable in more cases, and also make it configurable for those who have to adopt it to their usage.
Comment 1 Elias 2021-12-21 16:11:44 UTC
Btw. on Debian+Ubuntu there is an addational bug wich prevents auto updates from working. Not Discovers fault, but wanted to note that, for anyone testing.
The deb/ubuntu package for packagekit currently contains a patch which disallows offline updates for non admin users and without a password prompt. This makes offline updates never get triggered. You have to change `/usr/share/polkit-1/actions/org.freedesktop.packagekit.policy` to get it working.
See:
https://bugs.launchpad.net/ubuntu/+source/packagekit/+bug/1955489

---

Also, adding to this I wrote before:

> If my assumption is true, this could be fixed by changing from 15 minutes of idle to for example just 15 minutes after boot.

Instead of 'xx minutes after boot' maybe 'xx minutes after updates were found' would be the better choice here.
Comment 2 John 2022-04-05 16:27:20 UTC
I can confirm this!

I'm on:
Operating System: KDE neon 5.24
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Kernel Version: 5.13.0-39-generic (64-bit)
Graphics Platform: X11


I have Discover configured to auto-update.
I was expecting Discover to check on updates (All kinds of updates that do not fit OS Upgrades) and that it would silently install them in the background.

That never happens! 
I Always have to fire up discover and order it to "update all/everything" manually
Comment 3 John 2022-04-05 17:22:52 UTC
(In reply to John from comment #2)

> That never happens! 
> I Always have to fire up discover and order it to "update all/everything"
> manually

let me just scratch that!!!

It apparently works, but only after 15min in idle, as Elias pointed out.
I do agree we should be able to set it to auto-update after 15min of boot, however!
Comment 4 Aleix Pol 2022-04-08 14:51:25 UTC
You mean to get the updates happen even while you're using the system?
Comment 5 John 2022-04-11 14:57:33 UTC
Yes.

Has long as they only get installed on ShutDown or at BootUp, i don't understand why they can't be downloaded while i'm using the system.

Even if i have to manually set it to do that, i should be able to say "i want my system to download the updates as soon as it can"
Comment 6 Bug Janitor Service 2022-09-11 22:09:45 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/discover/-/merge_requests/369
Comment 7 Johannes Fleisch 2023-04-27 08:58:19 UTC
For me, the automatic updates start just as little often, so i don`t use it. But for casual users who never update themselves, it is important that there is a well-functioning automatic update system. But I don't think that more setting options are necessary for the update process. In my opinion, only the automatic update process should be adjusted.
Comment 8 PK 2023-07-23 05:41:20 UTC
I totally agree with Johannes in comment 7. I recently installed Plasma on a laptop from plm. 2014. Windows (10) is really becoming too heavy on such a laptop so Plasma seemed a sensible choice. I was pleasantly surprised that it was love at first site with Plasma, especially after I showed Kpat!
But I have no hope at all that the owner of this laptop will periodically update her machine.
For her, automatic update would be a great option. I really don't see why automatic update should wait for anything at all! In my opinion it should grab every opportunity to do it's job.
Comment 9 postix 2023-11-21 10:48:11 UTC
I also face this issue with the Fedora 38 (now 39) machines of parents. Despite having auto update enabled, they remain at the same state when I last time manually updated them.

Automatically checking for updates and installing them on shutdown (bug #436928) - maybe once in a week at least - would greatly enhance the situation imo.
Comment 10 pikesquare 2023-12-18 20:44:12 UTC
I face the same issue currently on fedora 39. I have it running on two different computers but on both the auto updates don't work. It stays the same unless you update manually.
Comment 11 kleiner 2024-03-08 17:57:01 UTC
I am also facing this issue on fedora 39, manually starting the update in discover works perfectly, however auto updates are never done by themselves.
Comment 12 tombrown9501 2024-03-11 22:07:36 UTC
I also would like this feature to work! Updates will never install automatically.
Comment 13 tombrown9501 2024-03-11 23:21:35 UTC
The importance of this bug needs to be updated to Major to reflect the severity based on KDE guidelines.

Major	Like Normal, but with no known workaround, or the workaround is painful and difficult
Normal	Something isn't working the way it was designed to work, with a known workaround that isn't too painful

Thanks!
Comment 14 nutzloserwerbemuell 2024-04-06 00:19:05 UTC
I do agree as well, this bug should get a higher priority and be fixed soon -  epecially since the KDE team does actively promote offline updates ( https://discuss.kde.org/t/why-doesnt-discover-notifier-enable-offline-updates-by-default-if-theyre-recommended/3336/14?u=rokejulianlockhart ). 

The average user sees the option to enable automatic updated right next to offline updates in KDE system settings, is happy about it, activates it - and never looks for updates again.  This menas then the bug noted here causes updates to be effectively disabled...
Comment 15 nutzloserwerbemuell 2024-04-06 00:21:53 UTC
(edit: I just noted the bug already got a higher priority. Sorry for that...)
Comment 16 John 2024-07-04 15:45:49 UTC
I've been thinking about this...

I think Plasma is misleading users if they set update settings to

Apply System Updates: Immediately

And it only does so "after 15 minutes of idle" (which may never occur!).

When set to "Immediately" it should indeed apply them "Immediately" and not after XX Minutes of Idle.
Having it "delayed" misleads the user.

So either the idle time is removed or, ideally, a solution like Elias said: allowing user to set it manually (to, e.g.: 0min, 15min, 30 min) - where the 15min could be the default value...
Comment 17 John 2024-07-04 15:48:23 UTC
BTW, i think the option to apply updates as soon as possible (e.g.: after 0min) is an important option!
Comment 18 Timothée Ravier 2024-09-09 12:30:07 UTC
This is likely a duplicate of https://bugs.kde.org/show_bug.cgi?id=471548
Comment 19 Nate Graham 2024-09-16 14:29:53 UTC

*** This bug has been marked as a duplicate of bug 471548 ***
Comment 20 John 2024-10-14 11:24:44 UTC
(In reply to Nate Graham from comment #19)
> 
> *** This bug has been marked as a duplicate of bug 471548 ***

Nate, i don't think this should be marked as duplicate of 471548.
The issue here is regarding all updates and not just flatpaks.

I also ended up here, again, because the 15 min idle does not appear to be working anymore.

After the 6.2 update, i configured the system to finally use the offline updates - along with the new option to "install updates and shut down" - but after waiting more an hour (not touching the PC!) no updates were ready to be installed on shut down as expected...

The only way to get them available to install and shutdown was to manually open Discover and press Install All.

I think this should be reopened...
Comment 21 John 2024-10-17 14:42:35 UTC
Created attachment 174942 [details]
Offline updates config

i would like to present my expectations over this feature (because others may share this...)

With offline updates configured like the attached screenshot i was expecting that:

- as soon as we get notified there are updates available the System would immediately start downloading them in the background all by itself, without requiring any user intervention! (E.g.: the user does not need to "open Discover > go to Updates and > press Update All" or any other kind of action)

- when we go to shutdown the computer - on the logout screen - we would be offered the option to "Install Updates and Shutdown"
Comment 22 Rua 2024-11-16 15:31:33 UTC
(In reply to John from comment #21)
> Created attachment 174942 [details]
> Offline updates config
> 
> i would like to present my expectations over this feature (because others
> may share this...)
> 
> With offline updates configured like the attached screenshot i was expecting
> that:
> 
> - as soon as we get notified there are updates available the System would
> immediately start downloading them in the background all by itself, without
> requiring any user intervention! (E.g.: the user does not need to "open
> Discover > go to Updates and > press Update All" or any other kind of action)
> 
> - when we go to shutdown the computer - on the logout screen - we would be
> offered the option to "Install Updates and Shutdown"

I'm running into the same problem. The update settings are the same as in the provided screenshot, and I would expect things to behave as you describe. But nothing happens. I get a notification that there are updates, but Discover just sits there for days until I manually install them.

Once I do manually install them, I get a prompt to restart, and all of that stuff works totally fine. Computer reboots, updates get installed, etc. It's only the process of initiating it automatically that does not work. It only does anything if I manually open Discover and tell it to.
Comment 23 Bug Janitor Service 2024-11-22 07:10:43 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/discover/-/merge_requests/975
Comment 24 Harald Sitter 2024-12-16 15:37:42 UTC
Git commit 000772d959fb7b51ed29cd18dcc9bdb435d6e8fe by Harald Sitter.
Committed on 16/12/2024 at 15:33.
Pushed by sitter into branch 'master'.

notifier: reduce the idle time to 1 minute

the motivation here was to not have the update run while the user is
using the system so as to not disturb workflows. alas, the problem is
that idle time is a poor measure because the system may never be idle
for long enough or the user returns before the update is complete
rendering the idle timeout pointless to begin with.

accepting defeat here, we are bring this value way down.

should this become a problem we may need to investigate better solutions
depending on what the actual problem is (e.g. cgroup constraints could
help with load issues). remains to be seen if there will be problems
though.

M  +6    -2    notifier/UnattendedUpdates.cpp

https://invent.kde.org/plasma/discover/-/commit/000772d959fb7b51ed29cd18dcc9bdb435d6e8fe
Comment 25 PK 2024-12-16 16:37:15 UTC
Will the system hold the automatic update process the moment you touch anything? In that case I think it would be useful if there was the possibility to make the automatic update process go on once it started.
Imho than it would be almost guarantied that a lot of users would work with up to date systems.
Comment 26 John 2024-12-16 17:02:12 UTC
(In reply to PK from comment #25)
> Imho than it would be almost guarantied that a lot of users would work with
> up to date systems.

That's what i expect as well: once it starts, it does not stop and continues to run on the background!

if that's not the case, an option to make it behave like this would be more than welcome. I want to be sure my system is always up-to-date and i really don't want to have to babysit it everyday, like i have to now!!!

I want it to download what it has to and get the updates ready for offline installation when i shut it down! 
So that it be ready for work the next morning...
Comment 27 Rua 2024-12-16 17:17:32 UTC
I think making the idle wait time optional entirely is the most sensible. There are probably some users who use their computer from the moment it's booted, to the moment it's shut down. There are also presumably users (like me) who would not mind updates going on in the background while they're doing things.

Maybe the disruptiveness of the background updates is overstated? It depends on whether stuff is appearing on the screen (progress bars, notifications). I would definitely like it to update even if I'm doing things, but not show anything on the screen except maybe a quick notification when it's finished. Then I can restart the machine later whenever I want.