diff --git a/diskimage_builder/elements/redhat-common/finalise.d/01-clean-old-kernels b/diskimage_builder/elements/redhat-common/finalise.d/01-clean-old-kernels index 5d8393f2..23d8619e 100755 --- a/diskimage_builder/elements/redhat-common/finalise.d/01-clean-old-kernels +++ b/diskimage_builder/elements/redhat-common/finalise.d/01-clean-old-kernels @@ -18,7 +18,7 @@ if [[ ${YUM} == "dnf" ]]; then # http://dnf.readthedocs.org/en/latest/cli_vs_yum.html _old_kernels="$(dnf repoquery --installonly --latest-limit=-1 -q)" if [[ -n "${_old_kernels}" ]]; then - dnf remove -y ${_old_kernels} + rpm -e ${_old_kernels} fi else install-packages yum-utils diff --git a/releasenotes/notes/fix-dnf-clean-old-kernels-use-rpm-to-erase-in-case-running-kernel-0401f78d63daca77.yaml b/releasenotes/notes/fix-dnf-clean-old-kernels-use-rpm-to-erase-in-case-running-kernel-0401f78d63daca77.yaml new file mode 100644 index 00000000..970eeadf --- /dev/null +++ b/releasenotes/notes/fix-dnf-clean-old-kernels-use-rpm-to-erase-in-case-running-kernel-0401f78d63daca77.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Fixed an issue where cleaning old kernels on systems runing ``dnf`` would + fail in case the kernel packages being removed matches the running kernel + of the system building the image. See Bug: `1623409 + `_. +