Upgrading multiple vms to Fedora 41 was not as smooth as I’ve learned to expect.
Customary, I followed the steps from this official guide – Upgrading Fedora Linux Using DNF System Plugin, which invokes dnf system-upgrade.
In all cases, except on few machines, running sudo dnf distro-sync from post-upgrade would retrieve the old (Fedora 40) packages, which was solved by adding --releasever=41 to the command.
In the remaining cases, however, dnf would not run at all. I would get these errors instead:
$ dnf distro-sync --releasever=41
Traceback (most recent call last):
File "/usr/bin/dnf", line 56, in <module>
from dnf.cli import main
File "/usr/lib/python3.12/site-packages/dnf/__init__.py", line 30, in <module>
import dnf.base
File "/usr/lib/python3.12/site-packages/dnf/base.py", line 32, in <module>
from dnf.comps import CompsQuery
File "/usr/lib/python3.12/site-packages/dnf/comps.py", line 27, in <module>
from dnf.exceptions import CompsError
File "/usr/lib/python3.12/site-packages/dnf/exceptions.py", line 22, in <module>
import dnf.util
File "/usr/lib/python3.12/site-packages/dnf/util.py", line 29, in <module>
import dnf.callback
File "/usr/lib/python3.12/site-packages/dnf/callback.py", line 22, in <module>
import dnf.yum.rpmtrans
File "/usr/lib/python3.12/site-packages/dnf/yum/rpmtrans.py", line 26, in <module>
import rpm
ModuleNotFoundError: No module named 'rpm'
I’m at loss how to deal with this. Hopefully, someone has a solution.
Thanks.
$ uname -a
Linux myvm 6.11.5-300.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Oct 22 20:11:15 UTC 2024 x86_64 GNU/Linux
Try sudo dnf upgrade --releasever=41
Note that dnf is upgraded from dnf-3 on f40 to dnf5 on f41 and they do operate a little different.
You can verify if dnf was upgraded by running ls -l /usr/bin/dnf If that shows as a symlink to dnf5 then it was upgraded, but if it shows as a symlink to dnf-3 like this
$ ls -l /usr/bin/dnf
lrwxrwxrwx. 1 root root 5 Aug 14 19:00 /usr/bin/dnf -> dnf-3
then it was not upgraded to the f41 version.
Those messages seem to indicate that it is trying to use the old version (which seems broken) and you may need to run it as sudo dnf5 upgrade --releasever=41 or sudo dnf5 distro-sync --releasever=41
Your stacktrace contains /usr/lib/python3.12/site-packages/dnf, which should not exist on Fedora 41, only on Fedora 40. (Fedora 41 uses Python 3.13)
Can you please check whether you are really running Fedora 41?
If you are running Fedora 41, how did you upgrade to Fedora 41? I suspect that something went wrong during your upgrade. If you upgraded using dnf system-upgrade, can you please read through or upload the logs from your system upgrade? dnf system-upgrade log should list a single upgrade step and dnf system-upgrade log --number=1 should show/give the last log, which you could pipe to a file for example by executing dnf system-upgrade log --number=1 > /tmp/system-upgrade.log
You never mentioned dnf system-upgrade, only dnf distro-sync and dnf upgrade with --releasever=41 which are both not the correct way to do an offline system upgrade via dnf. They may result in a mixed state.
Not quite – as I’ve mentioned in my second reply, I followed the standard method to upgrade as per official Upgrading Fedora Linux Using DNF System Plugin , which is using dnf system-upgrade
I’ve updated the original post to make it more clear.
Try fpaste logfile or whatever the name of the logfile is.
You can also run sudo dnf5 distro-sync --releasever=41 fedora\* and see if that works without problems. These are the packages that determines the current repository version.
Here’s the output from $ dnf system-upgrade log --number=1, which should include everything starting from initial upgrade using dnf system-upgrade, and followed by subsequent attempts with dnf5 upgrade --releasever=41 and dnf5 distro-sync --releasever=41
So, I’ve tried dnf5 distro-sync --releasever=41 fedora\* as VK suggested. It worked fine, and seemingly have fixed the problem – after first reboot, dnf upgrade --refresh updated the system using Fedora 41 repos.
However, on the second reboot, repeated dnf upgrade --refresh pointed to Fedora 40 again. This is bizarre.
I will just add this – this is not an isolated issue with new release. I’ve performed upgrade on 8 virtual machines in parallel, and they all had the same problem – after upgrade (dnf system-upgrade), uname would show Fedora 41, however dnf would point back to Fedora 40.
The difference on 3 out of 8 machines was that dnf would not work at all (the original post in this topic).
I don’t know which exact file is providing the current version, but it is one of the files provided by one of the fedora-release* packages. Maybe you should run
Oct 29 20:45:37 myvm systemd[1]: dnf-system-upgrade.service: Main process exited, code=killed, status=15/TERM
Oct 29 20:45:37 myvm systemd[1]: dnf-system-upgrade.service: Failed with result 'signal'.
Oct 29 20:45:37 myvm systemd[1]: Stopped dnf-system-upgrade.service - System Upgrade using DNF.
Oct 29 20:45:37 myvm systemd[1]: dnf-system-upgrade.service: Triggering OnFailure= dependencies.