Bug 1698145 - dnf protects certain packages in container, when it should not [NEEDINFO]
Summary: dnf protects certain packages in container, when it should not
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: dnf
Version: 8.2
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: 8.0
Assignee: Pavla Kratochvilova
QA Contact: Eva Mrakova
Mariya Pershina
Depends On: 1887911 1887916
Blocks: 1697963
TreeView+ depends on / blocked
Reported: 2019-04-09 16:54 UTC by Andrei Stepanov
Modified: 2021-05-18 15:00 UTC (History)
6 users (show)

Fixed In Version: dnf-4.4.2-2.el8
Doc Type: Enhancement
Doc Text:
.The `protect_running_kernel` configuration option is now available. With this update, the `protect_running_kernel` configuration option for the `dnf` and `microdnf` commands has been introduced. This option controls whether the package corresponding to the running version of the kernel is protected from removal. As a result, the user can now disable protection of the running kernel.
Clone Of:
Last Closed: 2021-05-18 15:00:34 UTC
Type: Bug
Target Upstream Version:
pkratoch: needinfo? (astepano)

Attachments (Terms of Use)

Comment 1 Jaroslav Mracek 2019-04-15 14:32:33 UTC
I am sorry but the protection of packages is a feature of dnf. For your user case I would recommend to use "rpm -e kernel kernel-core kernel-modules" or "rpm -e $(dnf repoquery kernel* -q --installed)" commands for a kernel case. To disable protection it also helps to use "--setopt=protected_packages=''", then the systemd could be removed, but not a running kernel. Hope that it helps.

Comment 2 Andrei Stepanov 2019-04-15 15:01:20 UTC
Jaroslav Mracek 

I see bug. And bug is: DNF behaves differently in various namespaces.
Action of DNF is not consistent. For specific example check original bug-report.
We have ci-system. Where main tools id DNF. Of course we can set various `special conditions`. But this is local solution. And more and more people will bump into this.
Please make aware DNF of different namespaces.
Currently DNF is not ready to work in containers.

Comment 3 Daniel Mach 2019-04-29 11:17:11 UTC
We could use systemd-detect-virt to detect if we're inside a container.
Also if we're working with an installroot that is different (realpath!) to '/' we could also allow removing kernel.

Comment 20 errata-xmlrpc 2021-05-18 15:00:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (dnf bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


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