Hello, friends. In this post, you will learn how to control when daily Ubuntu updates happens. This post although simple is quite useful if you have home test servers.
As we know, Ubuntu 22.04 integrates several important options to automate system updates. This saves sysadmin time and effort.
But not everything is happiness, there are also times when we need to modify some parameters of those updates to avoid some problems that may arise.
Control when daily Ubuntu updates happen
The first thing to do is to update the system as usual
sudo apt update sudo apt upgrade
apt daily timers are run by systemd, this can be checked by running:
systemctl list-timers | grep apt
You will get an output screen like this
Thu 2022-12-01 06:51:07 UTC 7h left n/a n/a n/a apt-daily-upgrade.timer apt-daily-upgrade.service Thu 2022-12-01 07:39:40 UTC 8h left n/a n/a n/a apt-daily.timer apt-daily.service
As you can see, two tasks are done. The first is associated with an
apt update and the second with an
The next step is to find out where these configuration files are located. This is simple, you can do this by running.
systemctl status apt-daily.timer | grep loaded
systemctl status apt-daily-upgrade.timer | grep loaded
You will notice that both are in
/lib/systemd so we can’t edit it directly.
To complete this, we will overwrite it in
sudo cp /lib/systemd/system/apt-daily.timer /etc/systemd/system/ sudo cp /lib/systemd/system/system/apt-daily-upgrade.timer /etc/systemd/system/
And now if you edit them with any text editor, for example I’ll edit the first one
sudo nano /etc/systemd/system/apt-daily.timer
You will see an output like this:
It is within the
TIMER section that you have to make the respective changes. Especially in
oncalendar as there you will be able to set the exact time it will run.
Save the changes and close the editor. Then you are done.
Knowing more about an Ubuntu server will help you to manage it better and get the most out of it. Today, you learned how to control when the daily Ubuntu updates happen.