Commit 2764abefaa14 ("make-disk: Don't upgrade the kernel to avoid kernel
command line bug", 2022-03-24) replaced the "--update" option of
virt-builder with an open-coded DNF update command, excluding the kernel
packages from the update.
Albeit a justified workaround, it is a bit too broad: it breaks on all
guest OS images that don't have DNF, such as old RHEL, Debian and Ubuntu,
etc. (In a subsequent patch, I'm going to refactor the Debian/Ubuntu
branch, and for testing that, I first need eliminate the open-coded DNF
command.) Refine the workaround as follows:
- I've tested Fedora 33 and Fedora 37; they work without the workaround
(they are not yet, and no longer, affected by the bug, respectively).
- I've tested Fedora 34 and 36, they are affected. They need the
workaround.
- Fedora 35 is also broken, per
<
https://bugzilla.redhat.com/show_bug.cgi?id=1945835#c24>.
- RHEL-9.0 and RHEL-9.1 *seem* to work fine without the workaround (that
is, with commit 2764abefaa14 reverted). However, that's deceptive: in
my testing, the original "--update" option does not bring in any new
kernel packages, so even if the bug is still there, it is not triggered.
Because RHEL-9 is based on Fedora 34, which is affected, assume that
RHEL-9 is affected too.
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
---
virt-p2v-make-disk.in | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/virt-p2v-make-disk.in b/virt-p2v-make-disk.in
index 865a92847f8b..44ff0b45ac7a 100644
--- a/virt-p2v-make-disk.in
+++ b/virt-p2v-make-disk.in
@@ -48,6 +48,7 @@ eval set -- "$TEMP"
output=
upload=
verbose=
+declare -a update_option=(--update)
declare -a passthru
usage ()
@@ -184,6 +185,19 @@ EOF
--upload $tmpdir/p2v.conf:/etc/dracut.conf.d/
--run $tmpdir/post-install
"
+ # Fedora 34 through 36, and presumably RHEL-9 (based on Fedora 34)
+ # suffer from a bug where a kernel image installation via libguestfs
+ # pollutes the just installed kernel's commandline in the boot loader
+ # config file. Irrelevant and bogus parameters from the appliance
+ # kernel's /proc/cmdline are copied over. This prevents the root
+ # filesystem from being mounted. Refer to
+ # <
https://bugzilla.redhat.com/show_bug.cgi?id=1945835#c24> and/or
+ # commit 2764abefaa14.
+ case "$osversion" in
+ fedora-34|fedora-35|fedora-36|rhel-9.*)
+ update_option=(--run-command 'dnf -y update --exclude=kernel\*')
+ ;;
+ esac
;;
debian-*|ubuntu-*)
depsfile="$datadir/dependencies.debian"
@@ -246,7 +260,7 @@ virt-builder "$osversion"
\
$preinstall_args \
--hostname p2v.local \
--run-command 'hostname p2v.local' \
- --run-command 'dnf -y update --exclude=kernel\*' \
+ "${update_option[@]}" \
--install "$install" \
--root-password password:p2v \
--upload "$datadir"/issue:/etc/issue \