Fix installation of drivers on firstboot with pending reboots

resolves: RHEL-103356
This commit is contained in:
Richard W.M. Jones 2025-07-13 13:01:12 +01:00
parent 77496488a3
commit f834344bf3
15 changed files with 154 additions and 26 deletions

View File

@ -0,0 +1,75 @@
From 594b05d6940c8719167d10c0cdfaa253349060ab Mon Sep 17 00:00:00 2001
From: Vadim Rozenfeld <vrozenfe@redhat.com>
Date: Thu, 10 Jul 2025 10:12:56 +1000
Subject: [PATCH] Modify configure_pnputil_install script to check pending
reboot status and report PnPUtil execution status
This change adds checks for system reboot status and reports
the result of PnPUtil driver installation attempt.
Related: https://issues.redhat.com/browse/RHEL-100682
Signed-off-by: Vadim Rozenfeld <vrozenfe@redhat.com>
---
convert/convert_windows.ml | 48 +++++++++++++++++++++++++++++++++++---
1 file changed, 45 insertions(+), 3 deletions(-)
diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml
index 71e867a5..8f0ff87b 100644
--- a/convert/convert_windows.ml
+++ b/convert/convert_windows.ml
@@ -396,9 +396,51 @@ let convert (g : G.guestfs) source inspect i_firmware
and configure_pnputil_install () =
let fb_script = "@echo off\n\
\n\
- echo Wait for VirtIO drivers to be installed\n\
- %systemroot%\\Sysnative\\PnPutil -i -a \
- %systemroot%\\Drivers\\Virtio\\*.inf" in
+ setlocal EnableDelayedExpansion\n\
+ set inf_dir=%systemroot%\\Drivers\\Virtio\\\n\
+ echo Installing drivers from %inf_dir%\n\
+ set REBOOT_PENDING=0\n\
+ \n\
+ timeout /t 10 /nobreak\n\
+ \n\
+ reg query \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\\Auto Update\\RebootRequired\"\n\
+ if %errorlevel%==0 (\n\
+ echo Windows Update: Reboot required.\n\
+ set REBOOT_PENDING=1\n\
+ )\n\
+ \n\
+ reg query \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Component Based Servicing\\RebootPending\"\n\
+ if %errorlevel%==0 (\n\
+ echo CBS: Reboot required.\n\
+ set REBOOT_PENDING=1\n\
+ )\n\
+ \n\
+ reg query \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\" /v PendingFileRenameOperations\n\
+ if %errorlevel%==0 (\n\
+ echo Session Manager: Reboot required.\n\
+ set REBOOT_PENDING=1\n\
+ )\n\
+ \n\
+ if \"%REBOOT_PENDING%\"==\"1\" (\n\
+ echo A reboot is pending.\n\
+ exit /b 249\n\
+ ) else (\n\
+ echo No pending reboot detected.\n\
+ )\n\
+ \n\
+ for %%f in (\"%inf_dir%*.inf\") do (\n\
+ echo Installing: %%~nxf.\n\
+ %systemroot%\\Sysnative\\PnPutil -i -a \"%%f\"\n\
+ if !errorlevel! NEQ 0 (\n\
+ echo Failed to install %%~nxf.\n\
+ exit /b 249\n\
+ ) else (\n\
+ echo Successfully installed %%~nxf.\n\
+ )\n\
+ )\n\
+ echo All drivers installed successfully.\n\
+ exit /b 0\n\
+ )" in
(* Set priority higher than that of "network-configure" firstboot script. *)
Firstboot.add_firstboot_script g inspect.i_root ~prio:2000

View File

@ -0,0 +1,49 @@
From 3e08788aaebf96d86452dc2c88d610dc0b72d02e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 13 Jul 2025 12:29:28 +0100
Subject: [PATCH] Update the common submodule
Pick up this commit from the submodule:
commit b40e534fefb74af32bd496904e44ce9bca1a7b34
Author: Vadim Rozenfeld <vrozenfe@redhat.com>
Date: Thu Jul 10 10:48:04 2025 +1000
Modify the firstboot script to check the scripts
which is required for commit 594b05d694 ("Modify
configure_pnputil_install script to check pending reboot status and
report PnPUtil execution status") to work properly.
Updates: commit 594b05d6940c8719167d10c0cdfaa253349060ab
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 0e9caa17..10d2b626:
diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml
index 6aca4c34..5f2642b0 100644
--- a/common/mlcustomize/firstboot.ml
+++ b/common/mlcustomize/firstboot.ml
@@ -305,13 +305,19 @@ if not exist \"%%scripts_done%%\" (
:: Pick the next script to run.
for %%%%f in (\"%%scripts%%\"\\*.bat) do (
echo running \"%%%%f\"
- move \"%%%%f\" \"%%scripts_done%%\"
- pushd \"%%scripts_done%%\"
+ pushd \"%%scripts%%\"
call \"%%%%~nf\"
set elvl=!errorlevel!
echo .... exit code !elvl!
popd
+ if !elvl! NEQ 249 (
+ echo Script succeeded, moving to scripts-done
+ move \"%%%%f\" \"%%scripts_done%%\"
+ ) else (
+ echo Script failed, will retry on next boot
+ )
+
:: Reboot the computer. This is necessary to free any locked
:: files which may prevent later scripts from running.
shutdown /r /t 0 /y

View File

@ -1,4 +1,4 @@
From 30fbc31e3f120bbcd7f2f672b7ab3bbcce2d30b8 Mon Sep 17 00:00:00 2001
From af2f0ee226fc824647543f89339db7667291ba67 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 30 Aug 2015 03:21:57 -0400
Subject: [PATCH] RHEL: Fixes for libguestfs-winsupport.

View File

@ -1,4 +1,4 @@
From a662fb76d04dba110b2a3a99a211fd00acc2d3c0 Mon Sep 17 00:00:00 2001
From 8d56fe97f76f2f98c3e752435afd77b8a7a81829 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 28 Sep 2014 19:14:43 +0100
Subject: [PATCH] RHEL: v2v: Select correct qemu binary for -o qemu mode

View File

@ -1,4 +1,4 @@
From fb42730cfdf1aab60907ec1e89b81d813706d854 Mon Sep 17 00:00:00 2001
From 75607a51efa706a1cc6afc1272008ea47e52f9a3 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 30 Sep 2014 10:50:27 +0100
Subject: [PATCH] RHEL: v2v: Disable the --qemu-boot / -oo qemu-boot option

View File

@ -1,4 +1,4 @@
From 0be0dc4ba3ea7c2c0b18da752c8f1623745e7799 Mon Sep 17 00:00:00 2001
From a43b6a7b27aba25bffd67a52660b06d283f0ebf3 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 24 Apr 2015 09:45:41 -0400
Subject: [PATCH] RHEL: Fix list of supported sound cards to match RHEL qemu

View File

@ -1,4 +1,4 @@
From ff2f899c058ab778866994185577c95e67357199 Mon Sep 17 00:00:00 2001
From 3938fddacc27ae3c0fc4a71d8859fd5cf38429d1 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 2 Mar 2017 14:21:37 +0100
Subject: [PATCH] RHEL: v2v: -i disk: force VNC as display (RHBZ#1372671)

View File

@ -1,4 +1,4 @@
From 2b0b7dcf7320c4d6168b0338c1bc30e046e50818 Mon Sep 17 00:00:00 2001
From 3fd0b3841fdd3fad3700486668a821b08bd1f6eb Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Tue, 26 Mar 2019 09:42:25 +0100
Subject: [PATCH] RHEL: point to KB for supported v2v hypervisors/guests

View File

@ -1,4 +1,4 @@
From 0de752b6dc94d76c0af910595072783d60103e5c Mon Sep 17 00:00:00 2001
From 950dddbd2b40c9354b5276c6899f4b0b58b5aeb9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 8 Jul 2024 09:35:54 +0100
Subject: [PATCH] RHEL: Remove input from Xen

View File

@ -1,4 +1,4 @@
From cba913549d610ece1c8debcd6829359fbe8ce66c Mon Sep 17 00:00:00 2001
From 86ca9c403ba8884b18718e9741b748a005566d73 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 30 Jun 2021 11:15:52 +0100
Subject: [PATCH] RHEL: Remove -o glance

View File

@ -1,4 +1,4 @@
From 8d74d632ab8faa9d4a784cbbad53e0f525309973 Mon Sep 17 00:00:00 2001
From 9532140d99bb5ec20d04440c24e54fdc5fcae6dc Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 5 Jul 2022 11:58:09 +0100
Subject: [PATCH] RHEL: tests: Remove btrfs test

View File

@ -1,4 +1,4 @@
From e15edbfd3a69426dfa624108669e5cce86f1d4bc Mon Sep 17 00:00:00 2001
From 4b5b05d707211f70e28ac0e0b156708a3e7e64b6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 28 Apr 2023 12:28:19 +0100
Subject: [PATCH] RHEL: Remove --block-driver option

View File

@ -1,4 +1,4 @@
From 898c60041ed7ff57d87969ec7830a1611529ec7c Mon Sep 17 00:00:00 2001
From 6b6297167e8676b65befaaaa1c75fe6b98d37e0b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 8 Jul 2024 09:56:54 +0100
Subject: [PATCH] RHEL: Remove -o ovirt, -o ovirt-upload and -o vdsm modes

View File

@ -1,4 +1,4 @@
From 2cf49985ecbad6f7dad863a487f6aa581800dc31 Mon Sep 17 00:00:00 2001
From 50e40ccab96a5cb498ac18246df20d9f163ffed3 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 9 Jul 2024 11:30:09 +0100
Subject: [PATCH] RHEL: Add warning about virt-v2v-in-place not being supported

View File

@ -7,7 +7,7 @@
Name: virt-v2v
Epoch: 1
Version: 2.8.1
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPL-2.0-or-later AND LGPL-2.0-or-later
@ -34,18 +34,20 @@ Patch0004: 0004-o-kubevirt-Add-oo-disk-to-allow-disk-names-to-be-ove.patch
Patch0005: 0005-output-Add-optional-create-parameter.patch
Patch0006: 0006-o-kubevirt-Add-oo-create-false-to-avoid-disk-creatio.patch
Patch0007: 0007-input-input_vddk.ml-Fix-escaping-of-export-.-paramet.patch
Patch0008: 0008-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0009: 0009-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0010: 0010-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0011: 0011-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0012: 0012-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0013: 0013-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0014: 0014-RHEL-Remove-input-from-Xen.patch
Patch0015: 0015-RHEL-Remove-o-glance.patch
Patch0016: 0016-RHEL-tests-Remove-btrfs-test.patch
Patch0017: 0017-RHEL-Remove-block-driver-option.patch
Patch0018: 0018-RHEL-Remove-o-ovirt-o-ovirt-upload-and-o-vdsm-modes.patch
Patch0019: 0019-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch
Patch0008: 0008-Modify-configure_pnputil_install-script-to-check.patch
Patch0009: 0009-Update-the-common-submodule.patch
Patch0010: 0010-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0011: 0011-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0012: 0012-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0013: 0013-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0014: 0014-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0015: 0015-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0016: 0016-RHEL-Remove-input-from-Xen.patch
Patch0017: 0017-RHEL-Remove-o-glance.patch
Patch0018: 0018-RHEL-tests-Remove-btrfs-test.patch
Patch0019: 0019-RHEL-Remove-block-driver-option.patch
Patch0020: 0020-RHEL-Remove-o-ovirt-o-ovirt-upload-and-o-vdsm-modes.patch
Patch0021: 0021-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch
%if !0%{?rhel}
# libguestfs hasn't been built on i686 for a while since there is no
@ -336,7 +338,7 @@ done
%changelog
* Thu Jul 10 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.8.1-3
* Sun Jul 13 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.8.1-4
- Rebase to virt-v2v 2.8.1
related: RHEL-81735
- Fix virt-v2v -v --install dnf5 error
@ -373,6 +375,8 @@ done
resolves: RHEL-101599
- Fix escaping of nbdkit-vddk-plugin export parameter
resolves: RHEL-102734
- Fix installation of drivers on firstboot with pending reboots
resolves: RHEL-103356
* Tue Feb 11 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.7.1-4
- Rebase to virt-v2v 2.7.1