Dnf-automatic changes its own timer

I’m using dnf-automatic-install to keep my system up to date and modified its timer to run at night, however when dnf-automatic itself is being updated it changes the timer back to how it was.

Is there a way to avoid this?

Hi @giani and welcome to Ask Fedora!

dnf-automatic installs it’s systemd units (.service and .timer) ones in /usr/lib/systemd/system/, and on package’s update will overwrite any changes you do to these unit files.

To avoid this, you can (and even should) copy files you want to make changes to to /etc/systemd/system/. Unit files in /etc have higher priority – i.e. will overrule units from /usr/lib/ – and won’t be overwritten by package’s updates.

sudo cp -v /usr/lib/systemd/system/dnf-automatic-install.timer /etc/systemd/system/

# Now make your changes to timer
sudo vim /etc/systemd/system/dnf-automatic-install.timer 

# Tell systemd to look for new and changed unit files
sudo systemctl daemon-reload

# Apply changes to timer right now
sudo systemctl restart dnf-automatic-install.timer

Restarting timer can be superfluous an not really needed, but won’t do any harm.


Fedora’s systemd quick-docs describe a different approach. Also check the rest of it if you seek better understanding systemd and it’s units.

The way I described (and successfully used myself before) is described on freedesktop.org’s systemd wiki here.

3 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.