Skip to content

Conversation

@rwmjones
Copy link
Member

After conversion, we found that Microsoft's pnputil utility could not list drivers. It would fail with:

> pnputil /e
> [some drivers listed]
> Failed to enumerate driver packages: The parameter is incorrect.

and an errorlevel of 87 (0x57, ERROR_INVALID_PARAMETER). Also Windows Update could be affected. This is really a bug in pnputil, but we have to work around it.

This is apparently happening because pnputil and/or the underlying APIs in Windows cannot handle the guestor "driver" that we temporarily added to enable viostor, before real viostor gets installed on the first boot after conversion. There is something malformed about the Windows registry entries or something else.

Probably for the same reason, it was not possible to disable or remove the guestor driver from within Windows, although we did publish instructions on how to do it from outside Windows (commit d0bc03b643 "docs: Document fix for updating converted Windows guests after conversion").

A better way to do this would be to go back to installing a partial viostor driver. The real viostor installer will then fix the registry entries correctly at first boot, and there will no longer be any 'guestor' entries.

A note about: 'viostor.inf_amd64_0000000000000000' (drv_inf_label). The real viostor driver uses 'viostor.inf_amd64_aaadc7282ed35504'. I'm not clear if the hex digits are different for each build or how they vary. However I found that using all zeroes works fine. An examination of the registry after the guest has been converted and booted shows the 'viostor.inf_amd64_0000000000000000' key is still present (as well as the real 'viostor.inf_amd64_aaadc7282ed35504' key), but apparently this does not affect pnputil.

This partially reverts virt-v2v commit d56170211c ("v2v: win >= 8: simplify registry patching")

Reverts: commit d56170211c427740e174b96e7274148bcb91ae46
Fixes: https://issues.redhat.com/browse/RHEL-112517
Related: commit d0bc03b6434c775b724a4950dd0d1a25876e5bea
Related: https://issues.redhat.com/browse/MTV-2256

@rwmjones
Copy link
Member Author

@vrozenfe @crobinso @rvka

@rwmjones
Copy link
Member Author

After this patch, pnputil /e command works fine on newly converted guests.

@crobinso
Copy link
Collaborator

Small comments for this code:

  • this code is also called for vioscsi but hardcodes viostor naming. should be based on driver_name argument?
  • hardcodes amd64 in the name. old code pre d56170211c427740e174b96e7274148bcb91ae46 would name this x86 when appropriate. no idea if that makes a real difference.
  • this only impacts win8+ apparently, would be nice to mention in the commit message.
  • There's still guestor references in function names.

But using a win11 VM I narrowed down the actual fix to just the drv_inf_label suffix change _tmp -> _amd64_0000000000000000 . just _amd64 doesn't do it, and _tmp_0000000000000000 doesn't do it either. so seems like something is doing some kinda validation on the arch piece.

I can't tell the original intention of the guestor naming... was it to keep the entry name generic enough that it could cover viostor or vioscsi? Also I have no idea what drv_config is actually supposed to be. scsi_inst seems to reference sections in the viostor/vioscsi inf files, guestor_conf is fake, and we've gotten this far without it pointing to a real value, maybe we shouldn't start now. dunno...

More data points: It seems like multiple DRIVER.inf_amd64_* entries can co-exist in registry in other circumstances too. I have a few duplicate entries on a personal windows machine. Also, running virtio-win-guest-tools.exe installer after a v2v will add new additional vio* registry entries.

chatgpt claims the hex string is a checksum windows calculates at driver install time but it can't provide an authoritative reference. seems valid though: installing different driver versions via virtio-win-guest-tools.exe gives different values, and re-installing gives the same values. i'm guessing it's just to avoid registry entry naming collisions, not used for any sort of validation.

@rwmjones
Copy link
Member Author

rwmjones commented Sep 18, 2025

But using a win11 VM I narrowed down the actual fix to just the drv_inf_label suffix change _tmp -> _amd64_0000000000000000

Interestingly I thought that all the changes were needed, but I'm not sure if I tried only changing drv_inf_label on its own. (My aim initially was to get rid of guestor entirely.) I do favour the most minimal possible change.

The guestor name comes from @rvka in libguestfs/virt-v2v@d561702

I chose scsi_inst because that is the name of the registry key that viostor uses.

Note also I completely forgot about vioscsi installation (via the --block-driver option), and didn't test it.

Let me see if I can reproduce your more minimal fix.

After conversion, we found that Microsoft's pnputil utility could not
list drivers.  It would fail with:

  > pnputil /e
  > [some drivers listed]
  > Failed to enumerate driver packages: The parameter is incorrect.

and an errorlevel of 87 (0x57, ERROR_INVALID_PARAMETER).  Also Windows
Update could be affected.  This is really a bug in pnputil, but we
have to work around it.

This is apparently happening because pnputil and/or the underlying
APIs in Windows cannot handle the guestor "driver" that we temporarily
added to enable viostor, before real viostor gets installed on the
first boot after conversion.  There is something malformed about the
Windows registry entries or something else.

Probably for the same reason, it was not possible to disable or remove
the guestor driver from within Windows, although we did publish
instructions on how to do it from outside Windows (commit d0bc03b643
"docs: Document fix for updating converted Windows guests after
conversion").

After much trial and error Cole Robinson found that the problem is
specific to the 'SYSTEM\DriverDatabase\DriverPackages\guestor_tmp'
key.  This appears to be validated by pnputil.  If we change the
format to match the name of existing keys, then it works.

A note about: 'guestor.inf_amd64_0000000000000000' (drv_inf_label).
The real viostor driver uses 'viostor.inf_amd64_aaadc7282ed35504'.
I'm not clear if the hex digits are different for each build or how
they vary.  However I found that using all zeroes works fine.  An
examination of the registry after the guest has been converted and
booted shows the 'guestor.inf_amd64_0000000000000000' key is still
present (as well as the real 'viostor.inf_amd64_aaadc7282ed35504'
key), but apparently this does not affect pnputil.

Updates: commit d56170211c427740e174b96e7274148bcb91ae46
Fixes: https://issues.redhat.com/browse/RHEL-112517
Related: commit d0bc03b6434c775b724a4950dd0d1a25876e5bea
Related: https://issues.redhat.com/browse/MTV-2256
Thanks: Cole Robinson
@rwmjones
Copy link
Member Author

rwmjones commented Sep 18, 2025

The updated version is the more minimal change, matching what Cole said above. I tested it and it still works for me. I also stopped hard-coding the arch.

Copy link
Collaborator

@crobinso crobinso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I think it's fine to push

@rwmjones rwmjones merged commit da55dc4 into libguestfs:master Sep 22, 2025
rwmjones added a commit to libguestfs/virt-v2v that referenced this pull request Sep 22, 2025
  Richard W.M. Jones (2):
      daemon, generator: Use power of 2 for initial size of Hashtbl.create
      mlcustomize/inject_virtio_win.ml: Use viostor.inf instead of guestor

See-also: libguestfs/libguestfs-common#17
rwmjones added a commit to libguestfs/guestfs-tools that referenced this pull request Sep 22, 2025
Richard W.M. Jones (3):
      mlstdutils: Export List.find_opt
      daemon, generator: Use power of 2 for initial size of Hashtbl.create
      mlcustomize/inject_virtio_win.ml: Use viostor.inf instead of guestor

See-also: libguestfs/libguestfs-common#17
rwmjones added a commit to libguestfs/guestfs-tools that referenced this pull request Sep 22, 2025
Richard W.M. Jones (3):
      mlstdutils: Export List.find_opt
      daemon, generator: Use power of 2 for initial size of Hashtbl.create
      mlcustomize/inject_virtio_win.ml: Use viostor.inf instead of guestor

See-also: libguestfs/libguestfs-common#17
(cherry picked from commit 13bcff3)
rwmjones added a commit to libguestfs/guestfs-tools that referenced this pull request Sep 22, 2025
Richard W.M. Jones (3):
      mlstdutils: Export List.find_opt
      daemon, generator: Use power of 2 for initial size of Hashtbl.create
      mlcustomize/inject_virtio_win.ml: Use viostor.inf instead of guestor

See-also: libguestfs/libguestfs-common#17
(cherry picked from commit 13bcff3)
crobinso pushed a commit to crobinso/guestfs-tools that referenced this pull request Oct 14, 2025
Richard W.M. Jones (3):
      mlstdutils: Export List.find_opt
      daemon, generator: Use power of 2 for initial size of Hashtbl.create
      mlcustomize/inject_virtio_win.ml: Use viostor.inf instead of guestor

See-also: libguestfs/libguestfs-common#17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants