linuxmint / mintupdate

The Linux Mint Update Manager
309 stars 152 forks source link

Disabling automatic refresh stopped working with Mint 21.1 (Vera) #787

Closed navid-zamani closed 1 year ago

navid-zamani commented 1 year ago

Describe the bug I can’t tell the exact point in time, but at or after I upgraded to 21.1 (Vera) (~2 weeks ago?), mintupdate seems to auotmatically refresh its list of updates by itself, even though I disabled it in the settings because I’m on a slow connection and it makes the Internet unusable in the worst situations.
Toggling the switch on, closing the settings dialog, opening it again, toggling it off again, and closing the dialog, does not seem to change thing. And “thanks” to “simplification”, there is no clear way to find where this setting is actually stored to change it manually or check what’s going on behind the scenes.

P.S.: After having seen the logs… It seems something is changing the package cache, and that triggers the refreshes despite reporting that it does not. I am not aware of anything changing the package cache.

Screenshots You can see, it is disabled: Bildschirmfoto vom 2023-01-08 14-57-06

To Reproduce Steps to (maybe!) reproduce the behavior:

  1. Install Mint 21.0.
  2. Disable above automatic refresh. But keep the mintupgrade icon in the tray.
  3. Upgrade to Mint 21.1.
  4. Use your system for a week or until you suddenly notice mintupgrade icon in the tray showing new updates being available. (Addendum: The goal is to see that “changing of the package cache“ happen. You maintainers will probably know what that might be, and can trigger it manually, to save waiting a week. :)
  5. Open mintupgrade to confirm.
  6. Observe automatic refresh still being disabled in the settings.

Expected behavior Automatic refresh should only happen when this setting is enabled. (In fact, background process should use the Internet unless previously authorized. I would have said “in a meaningful way”, to say small things are OK. But of things that aren’t meaningful use on a 1Gb/s connection in a metropolis are very much meaningful on a 8kB/s connection in the middle of nowhere.)

Distribution:

Software version: 5.9.6

Logs: NOTE: The two latter refreshes were manually started for testing purposes. (To see if mintupgrade somehow forgets that it has already upgraded things.) 01.08@14:49 ++ Launching Update Manager 01.08@14:49 ++ Changes to the package cache detected, triggering refresh 01.08@14:49 ++ Starting refresh (local only) 01.08@14:49 ++ Auto-refresh disabled in preferences, AutomaticRefreshThread stopped 01.08@14:49 ++ System is up to date 01.08@14:49 ++ Refresh finished 01.08@14:49 ++ Starting refresh (local only) 01.08@14:57 ++ Starting refresh (local only) 01.08@14:57 ++ Starting refresh (retrieving lists of updates from remote servers) 01.08@14:57 ++ Refreshing available Cinnamon updates from the server 01.08@14:57 ++ Refreshing available Flatpak updates

carlosmintfan commented 1 year ago

Hey, this isn't necessarily a bug. Did mintUpdate really use your internet connection or did you just see new updates?

carlosmintfan commented 1 year ago

It seems that you manually installed or removed some packages, if that wasn't done by some other background process.

carlosmintfan commented 1 year ago

And that you had the update info from some other process, when installing something or opening the Software Manager or so. But I might look into this later, the next days.

carlosmintfan commented 1 year ago

Did you install something or launch Software Manager immediately after launching Update Manager, or when it wasn't running? Could it be that 01.08@14:49 ++ Changes to the package cache detected, triggering refresh 01.08@14:49 ++ Starting refresh (local only) and 01.08@14:49 ++ Auto-refresh disabled in preferences, AutomaticRefreshThread stopped were independent from each other? Also, the log says: 01.08@14:49 ++ System is up to date while you say: Use your system for a week or until you suddenly notice mintupgrade icon in the tray showing new updates being available. (You didn't make that bold) And Starting refresh (local only) shouldn't use your internet connetion. Did I understand something wrong? Could you give more info?

navid-zamani commented 1 year ago

Hey, I had mintupdate offer some new updates to install without me refreshing it yesterday and today again.

Weirdly, the logs don’t show anything but “changes to the package cache detected” for yesterday evening. As far as I remember, I only see this in the morning after turning the thing on (from hibernation.)

~Yes, the two things you mentioned were really independent from each other., as now I only got the trigger message.~ Don’t know what that would imply though. (Hadn’t had my coffee yet. ;)

This is the current log:

01.12@17:08 ++ Launching Update Manager
01.12@17:08 ++ Changes to the package cache detected, triggering refresh
01.12@17:08 ++ Starting refresh (local only)
01.12@17:08 ++ Auto-refresh disabled in preferences, AutomaticRefreshThread stopped
01.12@17:08 ++ System is up to date
01.12@17:08 ++ Refresh finished
01.13@11:33 ++ Changes to the package cache detected, triggering refresh
01.13@11:33 ++ Starting refresh (local only)
01.13@11:33 ++ Tracker: Mintupdate update button was pressed recently: 1 days ago
01.13@11:33 ++ Found 3 software updates
01.13@11:33 ++ Refresh finished

Context: Yesterday morning (GMT+1) I updated Mint, as I do every Thursday.

Weird.

I guess there is nothing you can do from your end, and I have to dig deeper. Can you suggest me how to get some more detailed infos out of mintupdate? Since it’s Python, maybe I could add some logging at the right places. I want to find out what triggers it refreshing things, and what exactly is refreshed here. (As you said: Is it really going online, or …?)

carlosmintfan commented 1 year ago

If it says: Starting refresh (local only), it shouldn't use your internet connection.

carlosmintfan commented 1 year ago

But why does it say “changes to the package cache detected, triggering refresh” after launching it??

carlosmintfan commented 1 year ago

Oh, same with me! 01.14@14:54 ++ Launching Update Manager 01.14@14:54 ++ Changes to the package cache detected, triggering refresh 01.14@14:54 ++ Starting refresh (local only) 01.14@14:54 ++ Initial refresh will happen in 0 day(s), 0 hour(s) and 10 minute(s) 01.14@14:54 ++ Tracker: Max days reached: 10 days 01.14@14:54 ++ Tracker: Mintupdate update button was pressed recently: 3 days ago 01.14@14:54 ++ Found 35 software updates 01.14@14:54 ++ Refresh finished

carlosmintfan commented 1 year ago

The AutomaticRefreshThread and RefreshThread are located in /usr/lib/linuxmint/mintUpdate/mintUpdate.py

carlosmintfan commented 1 year ago

AutomaticRefreshThread is called in class MintUpdate in /usr/lib/linuxmint/mintUpdate/mintUpdate.py Look at lines 1702 and 1703.

carlosmintfan commented 1 year ago

Changes to the package cache detected, triggering refresh is written to the log at /usr/lib/linuxmint/mintUpdate/mintUpdate.py, line 142, in function refresh_cache of class CacheWatcher

carlosmintfan commented 1 year ago

You may look at lines 1693 and 1964 (all of /usr/lib/linuxmint/mintUpdate/mintUpdate.py), where CacheWatcher is started

carlosmintfan commented 1 year ago

This should check all 90 seconds if there are changes to the package cache

carlosmintfan commented 1 year ago

This may have used your internet connection in older Vera mintUpdate versions, but it shouldn't do that in the latest mintUpdate version.

carlosmintfan commented 1 year ago

But I don't promise. Maybe it uses it for flatpak stuff.

carlosmintfan commented 1 year ago

And /usr/lib/linuxmint/mintUpdate/checkAPT.py is called in /usr/lib/linuxmint/mintUpdate/mintUpdate.py But that should only be local... You may check what it does with flatpaks in mintUpdate.py if self.root_mode isn't necessarily true.

carlosmintfan commented 1 year ago

Oh. Auto-refresh disabled in preferences, AutomaticRefreshThread stopped But there's another message on my computer when I disable refreshs: Auto-refresh disabled in preferences, cancelling recurring refresh Does it say Auto-refresh disabled in preferences, AutomaticRefreshThread stopped only at startup?

carlosmintfan commented 1 year ago

If you want to look in the python: /usr/lib/linuxmint/mintUpdate/mintUpdate.py, line 398: self.application.logger.write("Auto-refresh disabled in preferences, AutomaticRefreshThread stopped") /usr/lib/linuxmint/mintUpdate/mintUpdate.py, line 375: self.application.logger.write("Auto-refresh disabled in preferences, cancelling %s refresh" % refresh_type) and refresh_type can be at least "recurring" or "initial"...

carlosmintfan commented 1 year ago

Are you getting thinks like this in the log: Auto-refresh disabled in preferences, cancelling initial refresh Auto-refresh disabled in preferences, cancelling recurring refresh ? It may depend on which settings you have for when it should refresh, even if refreshing is disabled - could you enable auto-refreshes for short, set the settings to 10 minutes for initial and 2 hours for recurring, for example, then disable auto-refreshes again and see if you're getting Auto-refresh disabled in preferences, cancelling initial refresh and Auto-refresh disabled in preferences, cancelling recurring refresh after using your computer for the time you set for initial refresh + ~30s and always get it in the recurring auto-refresh periods?

carlosmintfan commented 1 year ago

Note: The settings are stored in your dconf database. You may install the graphical dconf editor (apt install dconf-editor) or use the gsettings command line (if you now how to)

navid-zamani commented 1 year ago

Hey, I think i solved it!

I had to wait for some days, to make sure it didn’t happen anymore. But now I may have something reproducible:

Apparently the toggle to automatically refresh the list of updates has no effect on /etc/apt/apt.conf.d/20auto-upgrades, as APT::Periodic::Update-Package-Lists was still "1". After manually setting it to "0", the problem went away.

I found it by catching the process in action and looking at its source, if i remember correctly.

The thing is: AFAIK I never had the toggle enable after disablying it the first time I installed the system. An upgrade (possibly of Mint as a whole) may have replaced above file with the detault version, without checking with the toggle in the GUI first. So that may be required to fully reproduce this.
But if your toggle works on that setting, the setting in the file is always consistent with the toggle (e.g. "0" when it should), and re-installing the package that that file belongs to doesn’t overwrite it without the GUI getting the memo either, then it may have been a transient case that won’t appear anymore and this bug can be closed.

navid-zamani commented 1 year ago

Yeah, I just checked again, and the toggle has no effect on that setting in that file, but the setting was "1", without me setting it. In fact I did not even know about those files, as I’m still rather new to apt.

Lurux commented 1 year ago

That's weird, I don't have this file on my /etc/apt/apt.conf.d/ directory (also on an upgraded system). Did you enable automatic updates at some point, by any chance ?

navid-zamani commented 1 year ago

@Lurux: Interesting! Hmm… I may have toggled the switch some years ago, when going through the UI while having my GF on the phone because I wanted her to do it. But it’s definitely disabled ever since.

I suspect it may be a leftover of a less than perfect system upgrade? (Keeping Mint tidy over the years is harder than keeping Gentoo tidy. Because when one has to dive into its bowels, one is way more inept, and so solving problems is harder and messier. After a decade, only a full re-install helps, while on Gentoo, after pretty much 20 years, everything is actually cleaner than when I started. :D)

And since you can’t do anything about this anymore anyway, and there’s no need to, I think we can close this.

If anyone else has this problem, they will hopefully just find this. :)

(I’m just glad bug trackers exist. They are a key factor of why open source projects are heads and tails above commercial software. :)

Spudz76 commented 10 months ago

I have a 10periodic file with that setting in it, and then 99update-notifier seems to be what pops the dialog about updates ready to install (even with the periodic disabled) any time you update the lists manually from anywhere else. Commented out every line of both files, hopefully the Mint Updates thing is totally gone now. I can handle my own updating, and the shell already told me if I have things to install, I don't need GUI moron boxes.

Both should check the state of the MintUpdates in startup apps and not occur if it's disabled.

carlosmintfan commented 10 months ago

Hey @navid-zamani , late question, could you run: dpkg -S /etc/apt/apt.conf.d/20auto-upgrades ? It should print the package that provides that file.

navid-zamani commented 10 months ago

@carlosmintfan: Interestingly, it says it found no path that matches the pattern. I used tab completion so it can’t be mistyped.

There are 22 files in total that directory btw. And it’s the only one with /periodic/i in it. Other than that, 50unattended-upgrades is the only other one with /unattended/i in it, but everything of relevance is commented out.