convert/convert_windows.ml: Disable VMware drivers#139
Conversation
|
Looks ok to me. I'll give it a test |
|
I don't think it's going to work at the moment, I spotted at least one bug. (Hence draft!) |
22117a2 to
9be5cb4
Compare
|
The patch is now in a state where it runs and at least tries to disable the VMware drivers. However for each VMware driver, the disable command fails. I'm not sure if that's what it is supposed to do or not. No additional information is given by devcon, so it's not clear why it fails to disable the driver and if that's expected or not. I will try to attach the latest firstboot log. (@vrozenfe please take a look) NB: Before testing you will need to install mingw-devcon-redistributable-0~20260212git2977346e-5.fc45.noarch.rpm (release -5 contains vital fixes) |
We essentially expect that uninstalling VMware drivers will fail
(because the VMware uninstaller is broken). Therefore add a firstboot
script which does the next best thing, disabling all VMware drivers.
This requires the Microsoft devcon utility is installed under
/usr/share/virt-tools/{x86,x64}/devcon.exe. This utility is open
source and can be found here:
https://github.com/microsoft/Windows-driver-samples/tree/main/setup/devcon
Most of the hard work was done by and all of the batch file was
written by Vadim Rozenfeld.
Thanks: Vadim Rozenfeld
Fixes: https://issues.redhat.com/browse/RHEL-112249
9be5cb4 to
58a311a
Compare
|
I reran the same conversion using the MSFT version of devcon.exe, ie. known working. It also failed to disable the devices. The output of devcon is slightly different. Diffing the log from the comment above and the log from the MSFT version of devcon, the difference (for each device, I only show one) is: Two conclusions from this:
|
|
The mingw |
|
@crobinso I believe this is finally ready for testing now. I wasn't able to satisfactorily test that driver disabling works unfortunately, but I did at least prove that the new script runs at the right time and fails in the same way both with MSFT devcon and our devcon, which is ... something?! Edit: You will need |
|
OK I tested it out. Confirmed the code is executing and output is in the windows log. This is a windows 10 VM from vmware. I see the same For starters the Running manually Seems like So it makes sense that There is However in the case of the vmci driver, even after If you grab the Also it seems like |
|
So to summarize a bit: AFAIK
But if success here is |
|
I should note that Vadim (privately) gave me two scripts. The one I used for this patch uses |
BTW: you can also choose "View->Show Hidden devices" in the device manager. Then you can see devices that are not currently connected and non-pnp devices.
devcon little bit outdated. See comment from MS: https://github.com/MicrosoftDocs/windows-driver-docs/blob/staging/windows-driver-docs-pr/devtest/devcon-disable.md
For general knowledge: SW first means you install your driver into driver store before any might HW exists in the system. What is "driver store" depends on the how old your Windows is (something between not really anything, to the ability to have side by side driver versions in the system). Latest MS certifications enforce drivers' package isolation https://learn.microsoft.com/en-us/windows-hardware/drivers/develop/driver-isolation |
|
BTW: I suggest removing any remnant of the VMWare installation completely. Including registry entries and directories. |
|
I worry about deleting directories in v2v as someone might put some random important data in them & then blame us. |
It is easy to learn what should be the content of the VMWare installation and warn and not delete the content if something else is present. But let's clean up VMWare completely, also to prevent unneeded questions. |
What does this mean?
Do you mean running Vadim has a private git repo with some scripts, can we publish that please so I can refer to it. With that repo in mind, let's be specific about exactly what is involved. Deleting "registry entries and directories" is not a sufficient description to implement anything. Which scripts from Vadim's repo need to be run, in what order, with rebooting between or not, etc. Anyway (as this is upstream v2v discussion) I would prefer to do the safest and smallest change first. We can easily change from remove -> disable later if this works well. |
mingw-devcon-redistributable-0~20260212git2977346e-5.fc45.noarch.rpm
Let's start with Vadim scripts. But little understanding of how VMWare installation looks like is in oder in my opinion. If you need help with this, let's discuss. |
|
I'm going to be very straightforward and open about my position here, so there's no confusion. I do not believe that "leftover VMware drivers" is an actual problem, because I have not seen incontrovertible evidence of that. If that evidence is later produced, I will change my position on this. Virt-v2v converts literally 1000s of VMs every day. A single mistake that lasts for a few days in production is a catastrophe because it would mean having to go in after the fact to angry customers to clean up problems (if that is even possible, accidentally deleting vital data or registry keys isn't recoverable). This makes me very conservative about making changes. We should do the smallest thing that can work. Everything we ship has to be open source, since this is an open source project. We have to use tools that are either installed in all VMs we support, or open source tools we can compile ourselves. I wasn't aware until this point that we shoudn't be using devcon and should use pnputil because no one bothered to tell me, and all the scripts provided to me so far use devcon. (Side question: pnputil appeared first in Windows Vista which is old enough for us, but does that version have all the features we need?) Because I was told to use devcon, I have packaged devcon using an open source toolchain and got it into Fedora. This was a significant amount of work in itself. I do have a rough idea of what VMware installs in Windows. I don't know (or at least, not without a lot of extra effort) precisely what registry keys it adds, the complete list of files it adds, and whether those lists have changed over time, as I imagine they have. To thoroughly remove VMware by hand we'd presumably need to do that detailed study. This sounds to me far too complex and hence risky (see above). The place to discuss all this is right here, on the open source upstream project. Vadim's repo should be publicly available unless there is some clear reason why it should not be, and I don't see that reason. |
MSFT currently recommends using PnPUtil instead of DevCon, see https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon. So, as we develop a new feature, the best solution goes with MSFT recommendation.
At least keeping the network configuration is a problem. Windows is very strict when check network configuration. If you try to set the same IP + mask that are in use by any other adapter (even if it is disabled), Windows will show error and ask you to remove configuration. Exact this issue we caught in customer environment when scripts failed to set IP for NetKVM because IP was in use by vmxnet3. There was no vmxnet3 device, but driver was present and Windows keeping configuration for future. The similar issue we will see with vsock. In Windows you need to register socket user mode and address family. Windows does not have virtio-sock AF, so VMWare vsock register AF and link AF with corresponding DLL. As a result, installing virtio-win viosock user mode driver will fail, as the same AF is already registered. We don't see this issue yet, only because this is new driver that was release official only in the latest version of virtio-win. |
|
I will start from the end.
Totally agree. I don't see any reason why it shouldn't be publicly available.
Perfectly good reason to do things on Windows the Windows way.
@kostyanf14 and I are more than happy welcomed to participate in research and discussions to prevent inventions of the wheel if there are licensing, redistribution, or other issues.
Is this an effort? Yes.
Yes, but getting additional help to solve Windows issues (like research of VMWare installer) is a resource allocation question that can be discussed internally. |
|
Those cases about vmxnet and vsock are helpful, thanks. There was also a case where vmware drivers were in a kernel backtrace, right? Do we know how that happened, when VM was running outside of vmware? Just throwing it out there: IMO a standalone |
|
@crobinso We also have a tested code as part of our installer in DLL that has the functionality of driver installation and removal that can be wrapped and used for generic purposes. |
|
Question: If we disable a driver (using And will that also fix the network adapter address / vsock address problems? |
Yes, we link to this, plus the VMware official method, in our docs: https://libguestfs.org/virt-v2v.1.html#removing-vmware-tools-from-windows-guests My view is that doing either of these is just too complex. Even if we try to "shift the blame" to someone else, we will inevitably be asked to support / fix the resulting mess. So we suggest to users that if they are really concerned about the "leftover VMware drivers" "problem" they should read those methods and if they are happy, then they can do it themselves. |
No. Windows keeps the network adapter address until the driver is installed or the adapter address is removed from the registry. Windows keeps any custom address family until you unregister it via API or remove it from the registry. |
I should note that MTV adds an extra firstboot script which does some network stuff on top of what virt-v2v does. It's probably best to read the scripts to understand exactly what: https://github.com/kubev2v/forklift/tree/main/pkg/virt-v2v/customize/scripts/windows |
|
@rwmjones The mess is now. In practice we are trying to shift the blame by sending our customers to do some work that they don't do. And latter they complain to us anyway. |
|
Can someone answer this question please:
|
|
Depending what kind of driver.
Anyway, please please uninstall the drivers!!!! |
We're waiting on actionable instructions on how to do this. Also for Vadim's repo to be published somewhere, assuming that will still be part of this. |
I don't get what disabling a device does if Windows can decide to reenable it. Anyway we are not presenting any VMware devices to qemu guests, so this seems like a non-issue.
Are there actual VMware filter drivers involved here (be specific, what is the name of the driver?)
What does "AF family registration" mean? AF = Address Family? Anyway we aren't presenting a VMware balloon device so I don't know how this could be relevant to anything. |
|
So far we've identified exactly two real problems to my knowledge:
|
Disable = disable specific instance of the device. Windows disables SW representation of the device, not the driver.
While we add those, for now let's delete the drivers the we know of. |
|
@rwmjones https://github.com/virtio-win/vmwremover/blob/main/drivers/remove_vmware_driver_packages.bat - enumerates everything with pnputil (including filter drivers) and removes them No need for devcon redistribution or clone. |
|
@crobinso I understand from Vadim that some registry issues you found are not in https://github.com/virtio-win/vmwremover.git, please send PR. |
Finally we get something actionable, thank you.
I see this script has been rewritten to use pnputil instead of devcon as was in the earlier version that was provided privately. I'm going to close this PR since we will need to start again from scratch. |
|
Please continue discussions here: #144 |




We essentially expect that uninstalling VMware drivers will fail (because the VMware uninstaller is broken). Therefore add a firstboot script which does the next best thing, disabling all VMware drivers.
This requires the Microsoft devcon utility is installed under /usr/share/virt-tools/{x86,x64}/devcon.exe. This utility is open source and can be found here:
https://github.com/microsoft/Windows-driver-samples/tree/main/setup/devcon
Most of the hard work was done by and all of the batch file was written by Vadim Rozenfeld.
Thanks: Vadim Rozenfeld
Fixes: https://issues.redhat.com/browse/RHEL-112249