Skip to contentSkip to conversation

qga/installer: Remove QGA VSS if QGA installation failed

PATCH In review Kostiantyn Kostiuk 3 participants 5 messages Aug 25, 2025 – Sep 3, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qga/installer: Remove QGA VSS if QGA installation failed

When QGA Installer failed to install QGA service but install QGA VSS provider, provider should be removed before installer exits. Otherwise QGA VSS will has broken infomation and prevent QGA installation in next run.

---
 qga/installer/qemu-ga.wxs | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
qga/installer/qemu-ga.wxs +21 -2
index df572adb4a..32b8308728 100644
@@ -151,6 +151,14 @@
               Return="check"
               >
     </CustomAction>
+    <CustomAction Id="UnRegisterCom_Rollback"
+              ExeCommand='"[qemu_ga_directory]qga-vss.dll",DLLCOMUnregister'
+              Execute="rollback"
+              Property="rundll"
+              Impersonate="no"
+              Return="check"
+              >
+    </CustomAction>
     <?endif?>
 
     <Feature Id="QEMUFeature" Title="QEMU Guest Agent" Level="1">
@@ -174,8 +182,19 @@
 
     <InstallExecuteSequence>
       <?ifdef var.InstallVss?>
-      <Custom Action="UnRegisterCom" After="StopServices">Installed</Custom>
-      <Custom Action="RegisterCom" After="InstallServices">NOT REMOVE</Custom>
+        <!-- Use explicit Sequence number to provide an absolute position in the sequence-->
+        <!-- This is needed to set "UnRegisterCom_Rollback" before "RegisterCom" and after "InstallFiles"-->
+        <!-- but, Wix detect this double condition incorrectly -->
+
+        <!-- UnRegisterCom_Rollback (for install rollback): at 5849, right before RegisterCom (5850)-->
+        <!-- Runs only if the installation fails and rolls back-->
+        <Custom Action="UnRegisterCom_Rollback" Sequence="5849">NOT REMOVE</Custom>
+
+        <!-- RegisterCom (for install): at 5850, right after InstallFiles (5849) (old: After="InstallServices")-->
+        <Custom Action="RegisterCom" Sequence="5850">NOT REMOVE</Custom>
+
+        <!-- UnRegisterCom (for uninstall): at 1901, right after StopServices (1900) (old: After="StopServices")-->
+        <Custom Action="UnRegisterCom" Sequence="1901">Installed</Custom>
       <?endif?>
     </InstallExecuteSequence>
   </Product>
Signature · 1 line
2.50.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Kostiantyn Kostiuk

When QGA Installer failed to install QGA service but install QGA VSS provider, provider should be removed before installer exits. Otherwise QGA VSS will has broken infomation and

typos, should be: "QGA VSS will have broken information""

Quoted 49 lines

prevent QGA installation in next run.

---
 qga/installer/qemu-ga.wxs | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
qga/installer/qemu-ga.wxs +21 -3
index df572adb4a..32b8308728 100644
@@ -151,6 +151,14 @@
               Return="check"
               >
     </CustomAction>
+    <CustomAction Id="UnRegisterCom_Rollback"
+              ExeCommand='"[qemu_ga_directory]qga-vss.dll",DLLCOMUnregister'
+              Execute="rollback"
+              Property="rundll"
+              Impersonate="no"
+              Return="check"
+              >
+    </CustomAction>
     <?endif?>
 
     <Feature Id="QEMUFeature" Title="QEMU Guest Agent" Level="1">
@@ -174,8 +182,19 @@
 
     <InstallExecuteSequence>
       <?ifdef var.InstallVss?>
-      <Custom Action="UnRegisterCom" After="StopServices">Installed</Custom>
-      <Custom Action="RegisterCom" After="InstallServices">NOT REMOVE</Custom>
+        <!-- Use explicit Sequence number to provide an absolute position in the sequence-->
+        <!-- This is needed to set "UnRegisterCom_Rollback" before "RegisterCom" and after "InstallFiles"-->
+        <!-- but, Wix detect this double condition incorrectly -->
+
+        <!-- UnRegisterCom_Rollback (for install rollback): at 5849, right before RegisterCom (5850)-->
+        <!-- Runs only if the installation fails and rolls back-->
+        <Custom Action="UnRegisterCom_Rollback" Sequence="5849">NOT REMOVE</Custom>
+
+        <!-- RegisterCom (for install): at 5850, right after InstallFiles (5849) (old: After="InstallServices")-->
+        <Custom Action="RegisterCom" Sequence="5850">NOT REMOVE</Custom>
+
+        <!-- UnRegisterCom (for uninstall): at 1901, right after StopServices (1900) (old: After="StopServices")-->
+        <Custom Action="UnRegisterCom" Sequence="1901">Installed</Custom>
       <?endif?>
     </InstallExecuteSequence>
   </Product>
--
Quoted 2 lines

2.50.1

#2 lore raw
In reply to Kostiantyn Kostiuk
Quoted 4 lines · Kostiantyn Kostiuk

When QGA Installer failed to install QGA service but install QGA VSS provider, provider should be removed before installer exits. Otherwise QGA VSS will has broken infomation and prevent QGA installation in next run.

I'm picking this up for qemu-stable (10.0 & 10.1). Please let me know if I shouldn't.

Thanks,

/mjt

#3 lore raw

Hi Michael,

Please also pick
https://lore.kernel.org/qemu-devel/[email protected]/
for stable as it provides more detailed error logs.

Best Regards,
Kostiantyn Kostiuk.

Quoted 14 lines · Michael Tokarev
Quoted 4 lines · Kostiantyn Kostiuk

When QGA Installer failed to install QGA service but install QGA VSS provider, provider should be removed before installer exits. Otherwise QGA VSS will has broken infomation and prevent QGA installation in next run.

I'm picking this up for qemu-stable (10.0 & 10.1). Please let me know if I shouldn't.

Thanks,

/mjt