DNF Automatic install updates fails to start/install updates (failed with result 'exit-code')

I’ve installed dnf-automatic and have things configured. It looks like when dnf-automatic is triggered, it attempts to install but ultimately fails. If I manually enter dnf-automatic or dnf uprade, updates proceed with out issue.

How could I resolve this? It seems so difficult just to get Fedora to automatically check for & install updates.

Thanks for any help/suggestions.

dnf-automatic-install.service - dnf automatic install updates
   Loaded: loaded (/usr/lib/systemd/system/dnf-automatic-install.service; static; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2020-01-10 07:44:55 EST; 15h ago
  Process: 18538 ExecStart=/usr/bin/dnf-automatic /etc/dnf/automatic.conf --timer --installupdates (code=exited, status=1/FAILURE)
 Main PID: 18538 (code=exited, status=1/FAILURE)
      CPU: 263ms

Jan 10 07:44:55 localhost.localdomain dnf-automatic[18538]: Error: Failed to download metadata for repo 'etcher-rpm': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
Jan 10 07:44:55 localhost.localdomain dnf-automatic[18538]: Errors during downloading metadata for repository 'fedora-cisco-openh264':
Jan 10 07:44:55 localhost.localdomain dnf-automatic[18538]:   - Curl error (6): Couldn't resolve host name for https://codecs.fedoraproject.org/openh264/31/x86_64/repodata/repomd.xml [Could not resolve host: codecs.fedorapr>
Jan 10 07:44:55 localhost.localdomain dnf-automatic[18538]: Error: Failed to download metadata for repo 'fedora-cisco-openh264': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
Jan 10 07:44:55 localhost.localdomain dnf-automatic[18538]: Errors during downloading metadata for repository 'fedora-modular':
Jan 10 07:44:55 localhost.localdomain dnf-automatic[18538]:   - Curl error (6): Couldn't resolve host name for https://mirrors.fedoraproject.org/metalink?repo=fedora-modular-31&arch=x86_64 [Could not resolve host: mirrors.f>
Jan 10 07:44:55 localhost.localdomain dnf-automatic[18538]: Error: Failed to download metadata for repo 'fedora-modular': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for https://mirrors.fe>
Jan 10 07:44:55 localhost.localdomain systemd[1]: dnf-automatic-install.service: Main process exited, code=exited, status=1/FAILURE
Jan 10 07:44:55 localhost.localdomain systemd[1]: dnf-automatic-install.service: Failed with result 'exit-code'.
Jan 10 07:44:55 localhost.localdomain systemd[1]: Failed to start dnf automatic install updates.

● dnf-automatic-install.timer - dnf-automatic-install timer
   Loaded: loaded (/etc/systemd/system/dnf-automatic-install.timer; enabled; vendor preset: disabled)
   Active: active (waiting) since Thu 2020-01-09 18:37:23 EST; 1 day 4h ago
  Trigger: Sat 2020-01-11 06:31:06 EST; 7h left

Jan 09 18:37:23 localhost.localdomain systemd[1]: Started dnf-automatic-install timer

My dnf.conf file seems fairly standard:

[main]
gpgcheck=1
installonly_limit=5
clean_requirements_on_remove=True
best=False
skip_if_unavailable=True

Hi,

Looks like its trying to run before you are online. Is the timer set to run on boot?

Thanks Tom.

Did your read this:
https://dnf.readthedocs.io/en/latest/automatic.html”?

PS: Your also can drag and drop images to your post editing frame.

I should add that my computer is often in sleep mode and I check the status of dnf-automatic after I wake the computer. Could this be the problem? I’ve read online that adding the following lines to (/usr/lib/systemd/system/dnf-automatic-install.service) might resolve this issue:

After=network-online.target
Wants=network-online.target

Where exactly can I see if it is set to run on reboot? My (/usr/lib/systemd/system/dnf-automatic-install.timer) file is pretty standard I think:

[Unit]
Description=dnf-automatic-install timer
ConditionPathExists=!/run/ostree-booted
Wants=network-online.target

[Timer]
OnCalendar=--* 6:00
RandomizedDelaySec=60m
Persistent=true

[Install]
WantedBy=multi-user.target

Thanks, I didn’t realize adding a photo was so straight forward.
I did reading the link you referenced. Though, unless I am over-looking something, I don’t see a ‘fix’ for my issue. I’m beginning to think it’s happening because I often put my computer to sleep. I’m hoping I could resolve the issue while still continuing to put my computer to sleep.

Hi,

I agree the computer being in sleep is probably the cause of the issue. Also its checking the fro updates at 6am, is the time you want it do so?

Also adding After=network-online.target, would probably prevent the crash; but won’t run again till scheduled if asleep again won’t update.

Thanks Tom.

I don’t really mind that my desktop is checking for updates at 6am. As I understand it, with the way dnf-automatic is configured, it will run when the computer is next ‘awake’/available. And that actually does happen, it does run when the computer is next awake/available after 6:00am. It just fails and exits out when attempting to download from 'updates-modulrar) So I am hoping I could get this configured to run/install when my computer is next awake/available after the 6:00 scheduled time to run

Even after adding the following lines to my (/usr/lib/systemd/system/dnf-automatic-install.service) file, dnf-automatic still failed to install updates. Of course, 'dnf-automatic and ‘dnf upgrade’ work just fine if i manually enter them in a terminal window.

After=network-online.target
Wants=network-online.target
Restart=on-failure
RestartSec=10

My service file currently looks like the following, is something wrong/missing. Is there anything I can do here? Thanks for any suggestions :slight_smile:


Hi,

I think these want to go in the dnf-automatic-install.timer, rather than the service unit file.

These should go in the [service] section of the unit file, but I don’t think oneshots support a restart; so I think they redundant.

Thanks Tom.

Arch Wiki

Try

Wants= means an optional dependency.

Requires=network-online.target
After=network-online.target

Thank you, I was making both of these changes in the same file. I’ll make the appropriate change in the .timer file and the restart statement i’ll add to the service file even if it is redundant.

1 Like

I looked at the arch wiki you linked to and some other pages that explain the difference between wants and requires. I’ll give this a try, thank you for the tip!

No luck adding to the timer file

However, I began to think if there was away I could cause the service to sleep for a few seconds before running. Just curious, does this look ok, if I add (ExecStartPre=/bin/sleep) to the [Service] portion of the service file:

[Service]
Type=oneshot
Nice=19
IOSchedulingClass=2
IOSchedulingPriority=7
Environment=“ABRT_IGNORE_PYTHON=1”
ExecStartPre=/bin/sleep 30
ExecStart=/usr/bin/dnf-automatic /etc/dnf/automatic.conf --timer --installupdates

Did your tested, if it is works before configurations, as is? Isn’t it is logical for “dnf-automatic” to work “as is”, with some defaults being set for the users.

PS: After=graphical.target ?

I appreciate all the suggestions I received from you and tjdoyle in this thread.
Luckily adding the ’ ExecStartPre=/bin/sleep 30’ line in the service file resolved my issue.
Today was the first day dnf-automatic ran/completed successfully.

3 Likes