Bug 2216807

Summary: upgrade to dnf5 fails because dnf is protected
Product: [Fedora] Fedora Reporter: Zbigniew Jędrzejewski-Szmek <zbyszek>
Component: dnf5Assignee: Evan Goode <egoode>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 39CC: amatej, awilliam, egoode, jkolarik, nsella, petersen, pkratoch, rpm-software-management
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
strace from dnf5 upgrade…
none
dnf debugdata none

Description Zbigniew Jędrzejewski-Szmek 2023-06-22 17:00:12 UTC
Created attachment 1972129 [details]
strace from dnf5 upgrade…

Description of problem:
I have a container which has dnf and dnf5 installed, and the 'dnf update' fails:

$ rpm -q dnf dnf5
dnf-4.15.1-1.fc39.noarch
dnf5-5.0.9-3.fc39.x86_64
$ sudo dnf upgrade dnf
Last metadata expiration check: 1:08:36 ago on Thu Jun 22 09:42:16 2023.
Error: 
 Problem: The operation would result in removing the following protected packages: dnf
(try to add '--skip-broken' to skip uninstallable packages)
$ sudo dnf upgrade dnf5
Last metadata expiration check: 1:08:39 ago on Thu Jun 22 09:42:16 2023.
Error: 
 Problem: The operation would result in removing the following protected packages: dnf
(try to add '--skip-broken' to skip uninstallable packages)
$ sudo dnf upgrade 
Last metadata expiration check: 1:08:41 ago on Thu Jun 22 09:42:16 2023.
Error: 
 Problem: The operation would result in removing the following protected packages: dnf
(try to add '--skip-broken' to skip uninstallable packages)

I don't have /etc/yum/protected.d, and:

$ cat /etc/dnf/protected.d/*
# DNF is obsoleted in Fedora 39 by DNF 5 and should no longer be marked as protected.

# dnf
python3-dnf
sudo
systemd
systemd-udev

How reproducible:
100%.

I'll attach strace and debugsolver output.

Comment 1 Zbigniew Jędrzejewski-Szmek 2023-06-22 17:02:09 UTC
Created attachment 1972130 [details]
dnf debugdata

Comment 2 Evan Goode 2023-07-10 15:45:09 UTC
Hi, what version of `libdnf` do you have installed? The protection of the `dnf` package was (unfortunately) hardcoded in libdnf until the most recent version, 0.70.1.

I believe this issue should not affect users upgrading from Fedora 38 to Fedora 39 IF they remember to do a full update of F38 before upgrading to F39. But some Rawhide users may have to use `--skip-broken` or similar since not much time passed between (1) removing the hardcoded protection of dnf and (2) obsoleting DNF in favor of DNF 5.

Comment 3 Zbigniew Jędrzejewski-Szmek 2023-07-11 22:17:34 UTC
libdnf-0.70.0-1.fc39.x86_64

I removed dnf5, libdnf5, libdnf5-cli (*dnf5*), and this doesn't change anything.
Is there a way to do the upgrade without calling rpm manually?
I guess if not, we should at least document the rpm-based approach so people
can upgrade their systems if they get into this situation.

Comment 4 amatej 2023-07-12 04:55:25 UTC
It is possible to override the protected packages.

$ dnf update --setopt=protected_packages=,

This clears all protected packages for the run.
Setting "," to a list option empties it.

Comment 5 Evan Goode 2023-07-12 16:45:18 UTC
Thanks Ales, I can confirm this works even for the protection of dnf. I am able to upgrade from dnf-4.15.1-1.fc39.noarch and libdnf-0.70.0-1.fc39.x86_64 straight to DNF 5 with that command.

Comment 6 Fedora Release Engineering 2023-08-16 07:14:58 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.