How often does apt check for upgrades?

How often does it look for updates, upgrades and/or patches and how do I change it to more frequent or less frequent?

I may have found it in Lubuntu’s Software Sources under the Updates tab.
These settings can be changed.

However, and please correct me if I’m wrong, I believe there is something in the system that over-rides these settings.

I want to know the filepath and filename to the settings which over-ride Update settings in Software Sources.

Hello WyattWhiteEagle -

I have been slow to respond as I do not have unattended-upgrade installed I cannot verify my thoughts.
However:
The system default settings are in /usr/share/unattended-upgrades/
Will have both the 50unattended-upgrades and the 20auto-upgrades files with the system defaults.
and:
Unattended-updates is triggered by a daily cronjob: /etc/cron.daily/apt-compat

Maybe these will point you in the right direction.

-my bit to try to help-

1 Like

Thank you
That is very informative.
My machine has all those files. Haven’t checked them out yet.

I find myself wondering what thought’s your unable to verify.

My theory is this…
I have minimal desktop install Lubuntu 24.04. Seems to be aimed toward something like a ā€œserverā€ version of Lubuntu, but with no snaps.
Everywhere I’ve seen, I’ve read things about ā€œimproving your Linux experience and performanceā€, they all seem to be tailored toward server’s.
If Lubuntu Minimal is aimed toward server functions, there’s a possibility that the server side of the system is automatically checking for upgrades.
For an end-user desktop, which is what I have, checking every hour or every 30 minutes, I feel that’s a bit over-doing it.

All I can do is ā€œsurmiseā€ -
Take a look in the file /etc/cron.daily/apt-compat
long about line 49 is ā€œrandom sleepā€ - designed to spread the load across the serving servers -
If you edit out the ā€˜random_sleep’ then apt-daily will run at the same time each day…or a few minutes after startup if the system happens to be off (thanks, anacron).

As to the difference between a server and a desktop - kernel is the same same – only difference is the installed packages. – not to likely that a server would be checking for updates very often - I would not expect a server to have the unattended-upgrades package installed by default.

-is a thought-

Here’s something from journalctl -b
systemd[1]: Started anacron.timer - Trigger anacron every hour.

And this from /etc/cron.daily/apt-compat, lines 31-32…
sleep for a random interval of time (default 30min)
(some code taken from cron-apt, thanks)
That’s where the random sleep is introduced in that file.

Seem’s to me that every 30 minutes to every hour, something is happening.
More investigation is needed to know what all is happening.
I would imagine that these things, for whatever the reasons are, they are running in the background this often.

Well welll - hourly !
anacron I did expect to run when the system boots up (checks a time stamp file to determine what jobs are to be run) -
I will have to research too for why anacron.timer is activated.
But, not tonight - past bed time for me and my eyes and mind are clouded over.

-a pause for the cause-

Ok, have a awesome rest.

Some learning goin’ on here. Me and others…awesome.

Wow…I see what all I’ve done…
Where I was 4 years ago…

Wow, I’ve actually come a long way…not as fast as some or most, but for me…this is AWESOME!!!

I still got some learning to do though.
Time-stamp files and locations.
Cronjob edits.
Unmet condition checks.

Awesome stuff.

Changed to title to match the actual question.

The more generic ā€œUpdates, upgrades, and patchesā€ would mislead a lot of folks searching for many different kinds of help here, where they would not find that help.

I can make understanding this very simple for you: there is NO server distribution with a typical desktop interface. There are occasionally graphical elements to servers, but they’re usually in the form of served up web pages. Munin is a great example of this.

The reason why minimal exists is to strip down the Lubuntu experience to the AHEM absolute minimum. Ignore extra cruft and just provide the LXQt desktop and the Lubuntu tweaks to it. That’s it. As the Arch folks would say, ā€œKeep It Simple, Stupid.ā€ From there, you can build it up however you want. Other flavors provide a similar experience, so if and when *buntu folks migrate to Lubuntu, they see expected behavior.

Regarding the original question, while the discussion has mostly centered around a more general *buntu-wide perspective, Lubuntu actually comes with its own upgrader. For 24.04 you can see the answer to your question in the code comments:

    checkTimer->start(21600000); // check four times a day, at least one of those times unattended-upgrades should have refreshed the apt database

    checkForUpdates(); // check immediately after launch, which usually will be immediately after boot or login

@ian-weisser
Thank you for that improvement.
We don’t want to start people running on a ā€œwild goose chaseā€.

Without neglecting the afore mentioned files and informations…
What are those times? (both anacron -every hour- and the updater/upgrader)
Do those times match a specific time zone?
Or do the times match the local time of the machine?
Can those time specifications be changed on the local machine?
(not to be distributed with future releases)

Are you asking about Lubuntu Update or the base machinery?

Thanks ! As I live and learn too -

This is indeed an eye opener :smiley:

-the times they be a change’n-

To be clear, it relies on unattended-upgrades to kind of do the heavy lifting, but yeah. We were discussing making that configurable. Lubuntu Update is still kind of newish.

Is that a clock time like 12:05pm or is it a number of seconds or minutes, etc?

For me, The updater’s 4 times a day is only a little much.
But I can learn to live with that.
I would hope it becomes configurable so that my machine isn’t checking more than 2 times a day.

About the time zone questions, If my system is set to trigger anacron at 12:00am, is that 12:00am my time or is it 12:00am in Austrailia, or Africa, or in the UK?

And how might I check what times and jobs cron and anacron runs?
I don’t want to schedule my jobs for the same times the system or packages has their jobs scheduled for.

21600000 x 4 times a day = 86,400,000

86,400,000 (24 Ɨ 60 Ɨ 60 Ɨ 1000) milliseconds – one day

Note to self:
From boot time, it’s in milliseconds .

Now to find the files that control anacron and Lubuntu Updater activity.
What are the names and locations of these files?
-off to search for them-

checkTimer->start(21600000)
Four times a day (every 6 hours)

sudo /usr/bin/featherpad /etc/cron.daily/apt-compat
Default is every 30 minutes
(random sleep = 1800 seconds = 30 minutes)
(43200 seconds is two times a day; every 12 hours)

I reconfigured mine from ā€œRandomSleep=1800ā€ to ā€œRandomSleep=43200 # 1800ā€

sudo /usr/bin/featherpad /usr/lib/apt/apt.systemd.daily
(This file is mainly variables and statements of if, else, elif, fi)

I don’t recommend disabling these, but reconfiguring to your needs.
I’m a low-end user on a minimal desktop install of Lubuntu 24.04.
Server’s may need to keep the configurations.

Each of these files, including manpages, mentions other files which the user may want to reconfigure.
Future updates and upgrades may change your customization’s back to the defaults at some point, so keep a check on your custom configurations of these files.

/etc/cron.d/anacron

30 7-23 * * *   root	[ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi

/etc/crontab

17 *	* * *	root	cd / && run-parts --report /etc/cron.hourly
25 6	* * *	root	test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; }
47 6	* * 7	root	test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.weekly; }
52 6	1 * *	root	test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.monthly; }

This one follows a different time format.
The 1 and 5 means daily with a 5 minute delay.
/etc/anacrontab

1	5	cron.daily	run-parts --report /etc/cron.daily
7	10	cron.weekly	run-parts --report /etc/cron.weekly
@monthly	15	cron.monthly	run-parts --report /etc/cron.monthly

As far as anacron.timer, this page talks some about it…
If you use cron jobs and want to change the time Anacron runs…

Does anyone know of any settings that over-ride these configurations?

Why do you want to change the default settings?

I don’t have the answer for you but I am curious to understand what reasoning lies behind wanting to make these changes.

If it is part of a learning process to better know the inner workings of a Linux distro, I can get that.

If not, I do not see the point of changing things especially since if something goes wrong there may be a lot of work involved trying to unscramble the eggs, figuratively speaking.

I would certainly not recommend doing this on a machine you need for daily use.

Perhaps a spare computer or better still a VM to first test configuration changes before committing them to your main computer.

1 Like