rpm-software-management/dnf

dnf-automatic crashes on AlmaLinux 8.10 using reboot when-needed

jejo86 opened this issue · 4 comments

Description

My /etc/dnf/automatic.conf has the following settings:

# Whether updates should be applied when they are available, by
# dnf-automatic.timer. notifyonly.timer, download.timer and
# install.timer override this setting.
apply_updates = yes

# Reboot when needed
reboot = when-needed

# Reboot at 04:00 in the morning.
reboot_command = shutdown -r 04:00

I can run the timer via systemctl start dnf-automatic.timer.

Having a look at /var/log/dnf.log shows the following error:

2024-08-14T23:40:27+0200 DEBUG DNF version: 4.7.0
2024-08-14T23:40:27+0200 DDEBUG Command: needs-restarting needs-restarting -r
2024-08-14T23:40:27+0200 DDEBUG Installroot: /
2024-08-14T23:40:27+0200 DDEBUG Releasever: 8
2024-08-14T23:40:27+0200 DEBUG cachedir: /var/cache/dnf
2024-08-14T23:40:27+0200 DDEBUG Base command: needs-restarting
2024-08-14T23:40:27+0200 DDEBUG Extra commands: ['needs-restarting', '-r']
2024-08-14T23:40:27+0200 DEBUG User-Agent: constructed: 'libdnf (AlmaLinux 8.10; generic; Linux.x86_64)'
2024-08-14T23:40:28+0200 DDEBUG timer: sack setup: 759 ms
2024-08-14T23:40:28+0200 DDEBUG Cleaning up.
2024-08-14T23:40:28+0200 DDEBUG Plugins were unloaded.
2024-08-14T23:40:28+0200 SUBDEBUG
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 67, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 106, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 122, in cli_run
    cli.run()
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 1055, in run
    return self.command.run()
  File "/usr/lib/python3.6/site-packages/dnf-plugins/needs_restarting.py", line 305, in run
    raise dnf.exceptions.Error()  # Sets exit code 1
dnf.exceptions.Error: None

I have installed python3.9 and not python3.6. Is that the problem?

What can I do to fix it?

There are two things that confuse me:

  1. support for the reboot option was never released for RHEL8. It was introduced in dnf-4.14.0-8.el9 released in RHEL 9.3. Not sure about AlmaLinux though.
  2. the log looks like it belongs to dnf needs-restarting -r, not the dnf-automatic run

My version being too old is a good explanation for the reboot not working. I just added the settings

# Reboot when needed
reboot = when-needed

# Reboot at 04:00 in the morning.
reboot_command = shutdown -r 04:00

into my /etc/dnf/automatic.conf after having read the documentation.

I just assumed it work work. I wasn't aware it is such a new function.

I removed those two lines from my config. Now the dnf.exceptions.Error: None is not thrown and logged anymore.

Thanks for the help!


Anyway, unfortunately one needs to have the inside information, when that feature was added. On the documentation page, in the lower left corner, I can only select to read the manual for the latest and for the stable versions. It would be nice if it were possible to select the documentation for the version one has installed, in my case 4.7.0.

Maybe this could eventually be implemented?!

Mentioning the version in which a new feature is available is an excellent suggestion for the documentation, thank you!

The documentation you're referring to is for the latest upstream version of DNF, which is typically newer than the version released downstream in RHEL. I recommend consulting the documentation specific to your distribution, such as man dnf-automatic.

Mentioning the version in the documentation in which a new feature was introduced is also a good solution.

Yes, in hindsight I should have had a look at man dnf-automatic, but it was more convenient to search for the documentation online and have it presented to me in a pretty webpage as opposed to the black & white text in the terminal connected via SSH to my server.

Anyway, this solves my issue. Thanks for the support.