From 447354f9335e9d91b1f6d724010aa5655b2fe6c7 Mon Sep 17 00:00:00 2001 From: Xinliang Liu Date: Thu, 14 Jan 2021 02:05:20 +0000 Subject: [PATCH] Fix centos 8.3 partition image building error with element iscsi-boot This use the same workaround as element bootloader's[1] to fix CentOS 8.3 partition image building error with iscsi-boot: ... 2021-01-12 07:11:02.439 | + grub2-mkconfig -o /boot/grub2/grub.cfg 2021-01-12 07:11:02.654 | /usr/bin/grub2-editenv: error: cannot rename the file /boot/grub2/grubenv.new to /boot/grub2/grubenv: No such file or directory. 2021-01-12 07:11:02.665 | Generating grub configuration file ... 2021-01-12 07:11:03.112 | /usr/bin/grub2-editenv: error: cannot rename the file /boot/grub2/grubenv.new to /boot/grub2/grubenv: No such file or directory. ... [1]: https://review.opendev.org/c/openstack/diskimage-builder/+/750279 Closes-Bug: 1911120 Change-Id: I2de5444f7e1a145df9abb03fa4c367e8bb914e03 --- .../elements/iscsi-boot/finalise.d/51-open-iscsi-config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/diskimage_builder/elements/iscsi-boot/finalise.d/51-open-iscsi-config b/diskimage_builder/elements/iscsi-boot/finalise.d/51-open-iscsi-config index 440f3179..f5bc4777 100755 --- a/diskimage_builder/elements/iscsi-boot/finalise.d/51-open-iscsi-config +++ b/diskimage_builder/elements/iscsi-boot/finalise.d/51-open-iscsi-config @@ -8,6 +8,9 @@ set -eu set -o pipefail if [[ $DISTRO_NAME =~ "centos" ]]; then + if [[ -L /boot/grub2/grubenv ]]; then + rm -f /boot/grub2/grubenv + fi sed -i -E 's/(GRUB_CMDLINE_LINUX_DEFAULT=")(.+)(")/\1\2 rd.iscsi.firmware=1"/' /etc/default/grub grub2-mkconfig -o /boot/grub2/grub.cfg fi