Bug 2216807 - upgrade to dnf5 fails because dnf is protected
Summary: upgrade to dnf5 fails because dnf is protected
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf5
Version: 39
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Evan Goode
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-22 17:00 UTC by Zbigniew Jędrzejewski-Szmek
Modified: 2023-10-25 20:26 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-08-28 21:46:40 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
strace from dnf5 upgrade… (17.79 MB, application/octet-stream)
2023-06-22 17:00 UTC, Zbigniew Jędrzejewski-Szmek
no flags Details
dnf debugdata (7.39 MB, application/octet-stream)
2023-06-22 17:02 UTC, Zbigniew Jędrzejewski-Szmek
no flags Details

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.

Comment 7 Evan Goode 2023-08-28 21:46:40 UTC
The current dnf5 packages in the Fedora repositories no longer obsolete dnf, so I am closing this bug.

Comment 8 Gregory Lee Bartholomew 2023-10-25 20:26:11 UTC
FYI, I just hit this today while trying to run `dnf update --releasever=39` to upgrade from 38 to 39. Fedora Linux 38 was fully up-to-date. It showed that a handful of packages were going to be skipped due to broken dependencies. After adding `--best --allowerasing`, the update refused to proceed due to the required removal of the protected package "dnf". After further adding `--setopt=protected_packages=,`, I got the following.

# dnf update --releasever=39 --best --allowerasing --setopt=protected_packages=,
...
Removing dependent packages:
 annobin-plugin-gcc                                       x86_64                            12.28-1.fc37                                             @updates                            962 k
 dnf                                                      noarch                            4.17.0-6.fc38                                            @updates                            2.3 M
 dnf-plugins-core                                         noarch                            4.4.3-1.fc38                                             @updates                             22 k
 fonts-srpm-macros                                        noarch                            1:2.0.5-11.fc38                                          @fedora                              55 k
 go-srpm-macros                                           noarch                            3.2.0-2.fc38                                             @fedora                              59 k
 libdnf                                                   x86_64                            0.71.0-2.fc37                                            @updates                            2.0 M
 libsolv                                                  x86_64                            0.7.25-1.fc38                                            @updates                            932 k
 perl                                                     x86_64                            4:5.36.1-497.fc38                                        @updates                              0  
 perl-CPAN                                                noarch                            2.36-1.fc38                                              @updates                            1.9 M
 perl-ExtUtils-CBuilder                                   noarch                            1:0.280236-491.fc38                                      @fedora                              96 k
 perl-ExtUtils-Embed                                      noarch                            1.35-497.fc38                                            @updates                             16 k
 perl-ExtUtils-Miniperl                                   noarch                            1.11-497.fc38                                            @updates                            8.7 k
 perl-devel                                               x86_64                            4:5.36.1-497.fc38                                        @updates                            7.8 M
 python-srpm-macros                                       noarch                            3.11-10.fc38                                             @fedora                              50 k
 python3-dnf                                              noarch                            4.17.0-6.fc38                                            @updates                            2.7 M
 python3-dnf-plugins-core                                 noarch                            4.4.3-1.fc38                                             @updates                            1.2 M
 python3-hawkey                                           x86_64                            0.71.0-2.fc37                                            @updates                            313 k
 python3-libcomps                                         x86_64                            0.1.20-1.fc38                                            @updates                            143 k
 python3-libdnf                                           x86_64                            0.71.0-2.fc37                                            @updates                            3.9 M
 redhat-rpm-config                                        noarch                            252-1.fc38                                               @fedora                             193 k

Transaction Summary
===============================================================================================================================================================================================
Install    2 Packages
Upgrade  546 Packages
Remove    20 Packages

Total download size: 249 M
Is this ok [y/N]: y

FYI.


Note You need to log in before you can comment on or make changes to this bug.