Server in semi-broken state after dnf system-upgrade

Hi all,

A few days back, I went to upgrade my server from F34 to F35. I used sudo dnf system-upgrade download --refresh --releasever=35 and then sudo dnf system-upgrade reboot. When it came back up, dnf thinks it’s still on version 34 and there are duplicate packages from 34 and 35 installed. cat /etc/fedora-release shows Fedora release 35 (Thirty Five) and uname -a prints Linux homeserver 5.19.6-100.fc35.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 31 18:58:02 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux and systemctl --version prints

systemd 249 (v249.12-5.fc35)

And dnf --version prints

  Installed: dnf-0:4.9.0-1.fc34.noarch at Fri 08 Oct 2021 12:08:02 AM GMT
  Built    : Fedora Project at Thu 23 Sep 2021 12:48:23 PM GMT

  Installed: dnf-0:4.13.0-1.fc35.noarch at Sun 04 Sep 2022 06:18:28 PM GMT
  Built    : Fedora Project at Mon 30 May 2022 10:39:59 AM GMT

  Installed: rpm-0: at Tue 11 May 2021 08:07:34 PM GMT
  Built    : Fedora Project at Mon 22 Mar 2021 11:03:11 AM GMT

  Installed: rpm-0:4.17.1-3.fc35.x86_64 at Sun 04 Sep 2022 06:16:21 PM GMT
  Built    : Fedora Project at Tue 02 Aug 2022 12:33:17 PM GMT

It’s unclear what’s gone wrong here during the reboot, but from what I’ve found I should be able to uninstall the duplicate packages from f34. That doesn’t work though:

$ sudo dnf remove --skip-broken $(sudo dnf repoquery --duplicates | grep fc34)
Last metadata expiration check: 0:33:35 ago on Tue 06 Sep 2022 07:52:54 AM CDT.
 Problem: The operation would result in removing the following protected packages: dnf, grub2-efi-x64, grub2-tools-minimal, sudo, systemd, systemd-udev

Any advice to resolve this manually at this point?

1 Like

Hi @sigmavirus24 , welcome to the forums. Please do take a quick look at the introductory posts in the #start-here category if you’ve not had the chance yet.

Yes, looks like the upgrade didn’t go through correctly. It could be because of a number of things—exhausted disk space, for example.

I guess you could try a distro-sync. What does sudo dnf --releasever=35 distro-sync do? Or even an sudo dnf --releasever=35 update? We’re just trying to get it to believe that it’s on Fedora 35 and update the packages accordingly.


Looks like you have a bunch of duplicates installed, which is not good. I would try things in this order until dnf problems returns nothing:

  1. sudo dnf distro-sync
  2. sudo package-cleanup --cleandupes
  3. Remove duplicates after a botched dnf upgrade · GitHub (this is a low level break-glass and at your own risk type of deal but it’s worked for me in the past.)

Run a sudo distro-sync again if #2 or #3 fixes the issues.

`sudo dnf --releasever 35 distro-sync
Last metadata expiration check: 1:55:48 ago on Tue 06 Sep 2022 12:08:36 PM CDT.
Problem: The operation would result in removing the following protected packages: dnf, grub2-efi-x64, grub2-tools-minimal, shim-x64, sudo, systemd, systemd-udev
(try to add ‘–skip-broken’ to skip uninstallable packages)

`dnf --releasever 35 update` did remove one package from f34 but not others. I'm wondering if I need to do something like  `sudo dnf --releasever 35 reinstall $(sudo dnf repoquery --duplicates | grep fc35)`

@vwbusguy, I can't find a package-cleanup command or `dnf problems`. Any pointers on what I'm missing there?

Sorry, dnf check (--problems is the package-cleanup version). package-cleanup might not be installed, which means you’re going to probably have the same problem with dnf remove --duplicates. If that’s the case, then you might be able to try your luck at my hack, then run dnf distro-sync again.

I also strongly recommend that you take this opportunity to backup whatever data is important on this box if you haven’t yet, since you’re nearing re-install territory.

1 Like