Bug 1741381 - DNF wants to remove kernel-core
Summary: DNF wants to remove kernel-core
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 30
Hardware: x86_64
OS: Linux
medium
unspecified
Target Milestone: ---
Assignee: Jaroslav Mracek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1750201 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-08-15 01:44 UTC by Douglas
Modified: 2019-11-29 13:53 UTC (History)
13 users (show)

Fixed In Version: dnf-4.2.8-2.fc30 dnf-4.2.9-3.fc31 dnf-4.2.5-5.fc29
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-29 13:53:50 UTC


Attachments (Terms of Use)

Description Douglas 2019-08-15 01:44:26 UTC
Description of problem:
I installed Fedora Workstation 30, opened a terminal and ran `dnf update`. After all updates were installed, I rebooted the machine and ran dnf autoremove. I was then shown this error:

```
Error: 
 Problem: The operation would result in removing the following protected packages: kernel-core
(try to add '--skip-broken' to skip uninstallable packages)
```

`dnf autoremove` will no longer work because of this error. Using --skip-broken doesn't change the output, the same error shows up again.

I ran `dnf update` next, but it was all up to date.

Version-Release number of selected component (if applicable):
4.2.7

How reproducible:
Always, after a fresh install with all updates applied.


Steps to Reproduce:
1. Install F30 Workstation
2. Install all updates
3. Reboot
4. Try to run `dnf autoremove`

This is a regression. I've installed F30 Workstation a couple of weeks ago and this was not reproducible back then.

I did not remove any packages. The steps described to reproduce it are precisely the things I did.

Comment 1 Marek Blaha 2019-09-04 13:17:19 UTC
Patch in PR https://github.com/rpm-software-management/dnf/pull/1474 fixes also this bug.

Comment 2 Marek Blaha 2019-09-09 08:33:24 UTC
*** Bug 1750201 has been marked as a duplicate of this bug. ***

Comment 3 Marek Blaha 2019-09-09 08:52:25 UTC
The problem here is that the "dnf update" command changed the reason of kernel packages from "user installed" to dependency and that is why autoremove command wants to remove them. This bug is solved by PR mentioned in comment1.

But once you get to this situation, you need to fix it manually by marking kernel packages back to "user installed" using "dnf mark" command:

# dnf mark install $(dnf repoquery --installed 'kernel*')

You can check the results by running "dnf repoquery --userinstalled"

Comment 4 Fedora Update System 2019-09-10 12:19:44 UTC
FEDORA-2019-d79d0c470c has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-d79d0c470c

Comment 5 Fedora Update System 2019-09-10 12:19:47 UTC
FEDORA-2019-431726b949 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-431726b949

Comment 6 Fedora Update System 2019-09-10 14:32:28 UTC
dnf-4.2.9-3.fc31, libdnf-0.35.3-3.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-d79d0c470c

Comment 7 Fedora Update System 2019-09-11 02:58:54 UTC
dnf-4.2.8-2.fc30, libdnf-0.35.2-2.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-431726b949

Comment 8 Fedora Update System 2019-09-11 18:24:51 UTC
FEDORA-2019-d79d0c470c has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-d79d0c470c

Comment 9 Fedora Update System 2019-09-11 18:26:25 UTC
FEDORA-2019-431726b949 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-431726b949

Comment 10 Fedora Update System 2019-09-11 18:28:56 UTC
FEDORA-2019-d4dd43f749 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-d4dd43f749

Comment 11 Fedora Update System 2019-09-12 14:44:33 UTC
dnf-4.2.9-3.fc31, libdnf-0.35.3-4.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-d79d0c470c

Comment 12 Fedora Update System 2019-09-12 20:59:39 UTC
dnf-4.2.8-2.fc30, libdnf-0.35.2-3.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-431726b949

Comment 13 Fedora Update System 2019-09-12 22:39:19 UTC
dnf-4.2.5-5.fc29, libdnf-0.31.0-7.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-d4dd43f749

Comment 14 electricpbr 2019-09-13 02:54:05 UTC
I upgraded dnf and libdnf via the testing repository before running the first full system upgrade. This did not fix the problem for me. Kernel-core is no longer listed but all installed kernels are.

[localhost ~]$ sudo dnf list --autoremove 
Fedora Modular 30 - x86_64                    33 kB/s |  17 kB     00:00
Fedora Modular 30 - x86_64 - Updates          25 kB/s |  16 kB     00:00
Fedora Modular 30 - x86_64 - Updates         1.1 MB/s | 2.9 MB     00:02
Fedora 30 - x86_64 - Updates                  34 kB/s |  16 kB     00:00
Fedora 30 - x86_64 - Updates                 3.8 MB/s |  24 MB     00:06
Fedora 30 - x86_64                            24 kB/s |  18 kB     00:00
Autoremove Packages
ebtables-compat.x86_64                   2.0.10-36.fc30              @updates
ebtables-services.x86_64                 2.0.10-36.fc30              @updates
grub2-tools-efi.x86_64                   1:2.02-81.fc30              @updates
kernel.x86_64                            5.0.9-301.fc30              @fedora
kernel.x86_64                            5.2.13-200.fc30             @updates
kf5-kipi-plugins-libs.x86_64             5.9.1-2.fc30                @updates
kio-extras-info.x86_64                   19.04.2-1.fc30              @updates

Comment 15 Fedora Update System 2019-09-14 01:12:55 UTC
dnf-4.2.8-2.fc30, libdnf-0.35.2-3.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2019-09-14 16:34:28 UTC
dnf-4.2.9-3.fc31, libdnf-0.35.3-4.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.

Comment 17 Fedora Update System 2019-09-27 01:44:57 UTC
dnf-4.2.5-5.fc29, libdnf-0.31.0-7.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.

Comment 18 Steve 2019-11-07 17:43:17 UTC
I see this in Fedora 31, dnf-4.2.9-5.fc31.noarch, libdnf-0.35.3-6.fc31.x86_64:

$ sudo dnf autoremove
================================================================================
 Package                   Arch        Version             Repository      Size
================================================================================
Removing:
 kernel                    x86_64      5.3.7-301.fc31      @anaconda        0  
 kernel                    x86_64      5.3.8-300.fc31      @updates         0  
 kernel-core               x86_64      5.3.7-301.fc31      @anaconda       67 M
 kernel-modules            x86_64      5.3.7-301.fc31      @anaconda       28 M
 kernel-modules            x86_64      5.3.8-300.fc31      @updates        28 M
 kernel-modules-extra      x86_64      5.3.7-301.fc31      @anaconda      1.9 M
 kernel-modules-extra      x86_64      5.3.8-300.fc31      @updates       1.9 M

Transaction Summary
================================================================================
Remove  7 Packages

Freed space: 126 M
Is this ok [y/N]: 
Operation aborted.
$

Comment 19 Steve 2019-11-07 18:54:00 UTC
On another machine:

$ sudo dnf autoremove:
Error: 
 Problem: The operation would result in removing the following protected packages: kernel-core
(try to add '--skip-broken' to skip uninstallable packages)
$ 

Please reopen bug and change version to 31.

Comment 20 Steve 2019-11-08 05:54:57 UTC
I see this only on fresh installed systems. Upgraded versions seems not be affected.

Comment 21 Jason Bowen 2019-11-13 15:24:33 UTC
I saw (In reply to Steve from comment #20)
> I see this only on fresh installed systems. Upgraded versions seems not be
> affected.

I saw this on reboot following an upgrade to kernel 5.3.9 on Fedora 31.:

{0}$ sudo dnf autoremove
Last metadata expiration check: 0:00:35 ago on Wed 13 Nov 2019 09:17:35 AM CST.
Error:
 Problem: The operation would result in removing the following protected packages: kernel-core
(try to add '--skip-broken' to skip uninstallable packages)
{1}$ dnf repoquery --installed 'kernel*'
kernel-0:5.3.8-300.fc31.x86_64
kernel-0:5.3.9-300.fc31.x86_64
kernel-core-0:5.3.8-300.fc31.x86_64
kernel-core-0:5.3.9-300.fc31.x86_64
kernel-devel-0:5.3.8-300.fc31.x86_64
kernel-devel-0:5.3.9-300.fc31.x86_64
kernel-headers-0:5.3.6-300.fc31.x86_64
kernel-modules-0:5.3.8-300.fc31.x86_64
kernel-modules-0:5.3.9-300.fc31.x86_64
kernel-tools-0:5.3.9-300.fc31.x86_64
kernel-tools-libs-0:5.3.9-300.fc31.x86_64
kernel-tools-libs-devel-0:5.3.9-300.fc31.x86_64
{0}$ sudo dnf mark install $( dnf repoquery --installed 'kernel*' )
kernel-5.3.8-300.fc31.x86_64 marked as user installed.
kernel-5.3.9-300.fc31.x86_64 marked as user installed.
kernel-core-5.3.8-300.fc31.x86_64 marked as user installed.
kernel-core-5.3.9-300.fc31.x86_64 marked as user installed.
kernel-devel-5.3.8-300.fc31.x86_64 marked as user installed.
kernel-devel-5.3.9-300.fc31.x86_64 marked as user installed.
kernel-headers-5.3.6-300.fc31.x86_64 marked as user installed.
kernel-modules-5.3.8-300.fc31.x86_64 marked as user installed.
kernel-modules-5.3.9-300.fc31.x86_64 marked as user installed.
kernel-tools-5.3.9-300.fc31.x86_64 marked as user installed.
kernel-tools-libs-5.3.9-300.fc31.x86_64 marked as user installed.
kernel-tools-libs-devel-5.3.9-300.fc31.x86_64 marked as user installed.
{0}$ sudo dnf autoremove
Last metadata expiration check: 0:02:04 ago on Wed 13 Nov 2019 09:17:35 AM CST.
Dependencies resolved.
Nothing to do.
Complete!
$ uname -r
5.3.9-300.fc31.x86_64
$ dnf --version
4.2.9
  Installed: dnf-0:4.2.9-5.fc31.noarch at Mon 11 Nov 2019 04:01:47 PM GMT
  Built    : Fedora Project at Thu 17 Oct 2019 10:39:34 AM GMT

  Installed: rpm-0:4.15.0-6.fc31.x86_64 at Mon 11 Nov 2019 04:01:37 PM GMT
  Built    : Fedora Project at Wed 23 Oct 2019 08:12:44 PM GMT
{0}[jbowen@vm-jbowen ~]$

Comment 22 Jason Bowen 2019-11-24 01:02:34 UTC
Reopening as problem persists in Fedora 31.

Comment 23 John Gotts 2019-11-24 22:47:03 UTC
Was not able to upgrade this afternoon from Fedora 30 to 31.

% dnf system-upgrade log --number 5
...
Nov 24 17:25:01 linux.localnet dnf[1093]: Error:
Nov 24 17:25:01 linux.localnet dnf[1093]:  Problem: The operation would result in removing the following protected packages: kernel-core
Nov 24 17:25:01 linux.localnet dnf[1093]: (try to add '--skip-broken' to skip uninstallable packages)
Nov 24 17:25:02 linux.localnet systemd[1]: dnf-system-upgrade.service: Main process exited, code=exited, status=1/FAILURE
Nov 24 17:25:02 linux.localnet systemd[1]: dnf-system-upgrade.service: Failed with result 'exit-code'.
Nov 24 17:25:02 linux.localnet systemd[1]: Failed to start System Upgrade using DNF.

I see several suggestions and several package updates. Any current suggestions?

Comment 24 Jason Bowen 2019-11-24 22:58:31 UTC
(In reply to John Gotts from comment #23)
> Was not able to upgrade this afternoon from Fedora 30 to 31.
> 
> % dnf system-upgrade log --number 5
> ...
> Nov 24 17:25:01 linux.localnet dnf[1093]: Error:
> Nov 24 17:25:01 linux.localnet dnf[1093]:  Problem: The operation would
> result in removing the following protected packages: kernel-core
> Nov 24 17:25:01 linux.localnet dnf[1093]: (try to add '--skip-broken' to
> skip uninstallable packages)
> ...
> I see several suggestions and several package updates. Any current
> suggestions?

Did you try marking the kernel* packages as user-installed? See comments
3 or 21 above for an example.

Comment 25 John Gotts 2019-11-28 23:31:03 UTC
It did work.

Can we add this to the release notes?

This laptop has been up and running since April 4, 2017, and I haven't done anything abnormal with any kernel packages through several revisions of Fedora, beginning with 25.

I barely touch this thing. I am a developer, but it isn't a development box. I rely on it to be stable.

I have my complete history for root and since April 4, 2017, I've only run the following dnf commands:

dnf update
dnf system-upgrade
dnf install on no package at all related to the kernel
rpm --install of less than 5 packages, all unrelated to the kernel
rpm -e of a few packages, when I was forced to do this before certain upgrades could complete

Some combination of these corrupted my installation with respect to being able to upgrade to Fedora 31.

Maybe this weird thing should be added to the upgrade steps.

Comment 26 Jaroslav Mracek 2019-11-29 13:53:50 UTC
The problem is fixed in dnf-4.2.17 by https://github.com/rpm-software-management/dnf/commit/384a4bcf20e62eccce3f0cc21f23e6b4293207ae. Unfortunately old systems after applying the patch will still remove the kernel, because dnf forget already the original install reason. To fix it just run `dnf mark install kernel kernel-modules`.


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