Browse Source

Use rpm -e instead of dnf for cleaning old kernels

If the running kernel of the system building the image
matches the kernel that is to be removed dnf will fail.

Repalce use use of dnf with rpm -e.

Closes-Bug: #1623409
Change-Id: Ie2481ea8a02b7b0720e46fa179f24badf4aa25c5
tags/2.35.0
Harald Jensås 3 months ago
parent
commit
1ac31afd62
2 changed files with 9 additions and 1 deletions
  1. +1
    -1
      diskimage_builder/elements/redhat-common/finalise.d/01-clean-old-kernels
  2. +8
    -0
      releasenotes/notes/fix-dnf-clean-old-kernels-use-rpm-to-erase-in-case-running-kernel-0401f78d63daca77.yaml

+ 1
- 1
diskimage_builder/elements/redhat-common/finalise.d/01-clean-old-kernels View File

@@ -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


+ 8
- 0
releasenotes/notes/fix-dnf-clean-old-kernels-use-rpm-to-erase-in-case-running-kernel-0401f78d63daca77.yaml View File

@@ -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
<https://bugs.launchpad.net/diskimage-builder/+bug/1623409>`_.


Loading…
Cancel
Save