Skip to content

Commit 2825253

Browse files
committed
Add XenClean and XenBootFix instructions
These tools are already usable regardless of the driver's signing state. Signed-off-by: Tu Dinh <[email protected]>
1 parent 8d2aaa3 commit 2825253

File tree

2 files changed

+75
-84
lines changed

2 files changed

+75
-84
lines changed

docs/troubleshooting/windows-pv-tools.md

Lines changed: 73 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Windows Agent / PV-Tools
1+
# Windows PV Tools
22

33
Common issues with Windows PV tools.
44

@@ -21,19 +21,8 @@ If despite running the Windows tools installer, there's no devices visible in th
2121
### Solutions
2222

2323
#### Leftovers from old Citrix XenServer Client Tools.
24-
1. remove any xen*.* files from `C:\Windows\system32` like
25-
* xenbus_coinst_7_2_0_51.dll
26-
* xenvbd_coinst_7_2_0_40.dll
27-
* xenbus_monitor_8_2_1_5.exe
28-
* and similiar `xen*_coinst` and `xen*_monitor` files
29-
2. remove any leftover `XenServer` devices from device manager, also display hidden `XenServer` devices and remove them!
30-
* To show hidden devices in Device Manager: `View -> Show Hidden Devices`
3124

32-
#### There was an issue with the installing of the drivers certificate, so the drivers did not load silently
33-
34-
Resolved with version 8.2.2.200-RC1 and newer.
35-
36-
***
25+
See the XenClean guides below for instructions.
3726

3827
## Network PV drivers aren't working.
3928

@@ -48,7 +37,7 @@ If the tools are installed, while XCP-ng Center says that I/O is optimized, but
4837
* Clean your system from `Citrix Client Tools` _AND_ `XCP-ng Client Tools` to create a clean state.
4938
* Then install the Client Tools from scratch.
5039

51-
[This Guide](../../vms#%EF%B8%8F-guest-tools) may help you through the process.
40+
See the XenClean guides below for instructions.
5241

5342
## Not all PV drivers are correctly installed
5443

@@ -80,6 +69,76 @@ Consult your motherboard manual for details; for example, on Dell systems with i
8069
![](../../static/img/performance-setting.png)
8170
</div>
8271

72+
## Completely removing existing Xen PV drivers with XenClean
73+
74+
XenClean is an utility for cleanly removing Xen PV drivers and management agents of the following products:
75+
76+
* XCP-ng Windows PV Tools, versions 8.2 and 9.1
77+
* XenServer VM Tools for Windows, versions 9.3 and 9.4
78+
* Other Xen drivers
79+
80+
It is included in the installation package of XCP-ng Windows PV Tools 9.1 and above.
81+
[See the newest releases here.](https://github.com/xcp-ng/win-pv-drivers/releases)
82+
83+
To use XenClean, simply run the `Invoke-XenClean.ps1` script **as Administrator**. Your system will automatically reboot.
84+
85+
**Note**: You should always use the latest version of XenClean regardless of your Windows PV driver version. The same applies to XenBootFix.
86+
87+
**Note**: You should disable the "Manage Citrix PV drivers via Windows Update" option on your VM before running XenClean. Otherwise, Windows may reinstall PV drivers from Windows Update after rebooting.
88+
89+
**Note**: If you downloaded XenClean from the internet, you may need to unblock the script file before running it. This can be done by right-clicking the file, then choosing **Properties** - **Unblock** - **OK**.
90+
91+
**Tip**: XenClean leaves its log files at `%TEMP%\xenclean-<time>`. Please provide these logs in case of uninstallation failure.
92+
93+
## Windows fails to boot (hanging at boot or BSOD with Stop code `INACCESSIBLE_BOOT_DEVICE`)
94+
95+
In some situations (failed uninstallation, major Windows version upgrades), Xen PV drivers (whether Citrix or XCP-ng) may cause Windows to fail to start (hanging at boot, BSOD with Stop code `INACCESSIBLE_BOOT_DEVICE`).
96+
The XenBootFix utility included with XCP-ng Windows PV Tools 9.1 and above helps you disable any active Xen PV drivers and get your system to a bootable state before running XenClean.
97+
98+
**Note**: The utility only runs in Windows Preinstallation Environment (PE) or Windows Recovery Environment (RE). It will not run from Safe Mode.
99+
100+
Below is a procedure for using XenBootFix to recover a non-booting VM:
101+
102+
1. Boot into Windows PE or Windows RE in command line-only mode. There are a few ways to accomplish this:
103+
* If your Windows installation BSODs on boot multiple times, it will automatically boot into Windows RE. Choose **Troubleshoot** - **Command Prompt**.
104+
* When running Windows Server, press **F8** before Windows starts, then choose **Repair Your Computer**. Choose **Troubleshoot** - **Command Prompt**.
105+
* Boot your VM using a Windows Setup or Windows PE CD image. If you don't see a command line, press **Shift+F10**.
106+
2. Identify your Windows installation drive letter.
107+
* Use the `dir` command to list files in a given drive letter. For example: `dir C:\` (the backslash is required)
108+
* In some cases, your Windows partition should already be mounted. Try the first few letters (`C:`, `D:`, `E:`).
109+
* If you cannot find your Windows drive letter, you may need to assign a new drive letter with Diskpart.
110+
* Type `diskpart` at the command line. The command prompt should change to `DISKPART>`
111+
* Type `list vol` then make a note of your Windows partition and its drive letter (if any).
112+
* If your Windows partition does not have a drive letter, type `sel vol N` where `N` is the volume number shown in Diskpart, then type `assign letter=W`. Your Windows partition will be assigned the drive letter `W:`.
113+
* Finally, at the `DISKPART>` prompt, type `exit` to exit Diskpart.
114+
3. Obtain XenBootFix.
115+
* If you're using XCP-ng Windows PV Tools 9.1 or later, it is located at `W:\Program Files\XCP-ng\Windows PV Drivers\XenBootFix\XenBootFix.exe` where `W:` is your Windows drive letter.
116+
* If you have PowerShell, run the following command: `Invoke-WebRequest https://<download path of XenBootFix.exe> -OutFile XenBootFix.exe`
117+
* Failing all that, you can create a new ISO image containing XenBootFix using WinCDEmu, ImgBurn or a similar tool, then attach it to your VM.
118+
* **Note**: If using Windows PE, do not remove its CD image when it's running. You may encounter unexpected errors otherwise.
119+
4. Run the command `<path to XenBootFix.exe> W:\Windows` where `W:` is your Windows drive letter.
120+
* **Note**: Make sure the drive letter belongs to your actual Windows installation and not Windows PE/RE. By default, Windows PE/RE use the drive letter **X:**.
121+
5. Type `exit` to close Command Prompt. If using Windows RE, choose **Continue** to boot into Windows. Windows should now start normally.
122+
6. **You must immediately run XenClean from within Windows to remove the remaining Xen drivers**. See instructions above.
123+
124+
## Connecting to guests using serial console
125+
126+
In some situations, you might want to expose a VM's serial console to network for troubleshooting purposes (e.g. Windows kernel debugging).
127+
You can use the following procedure:
128+
129+
* Shut down the VM.
130+
* On your host, run the following command: `xe vm-param-set uuid=<uuid> platform:hvm_serial=tcp::<port>,server,nodelay,nowait` where `<uuid>` is the VM's UUID and `<port>` is the TCP port on the host that exposes the VM's serial port, e.g. 7001.
131+
* You need to open the selected port on the host's firewall: `/etc/xapi.d/plugins/firewall-port open 7001`
132+
* Note that any host running the VM will need this command.
133+
* Connecting to port 7001 on the host will connect to your VM's serial port. You can use Telnet, PuTTY or any similar tools.
134+
* To configure kernel debugging on Windows, disable Secure Boot and BitLocker then run the following commands within the VM:
135+
```
136+
bcdedit /debug on
137+
bcdedit /dbgsettings serial debugport:1 baudrate:115200
138+
```
139+
Connect using [WinDbg](https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/) using the `Attach to kernel` option with a connection string: `com:ipport=7001,port=<host IP>`
140+
* To undo the changes and remove the serial setting, use `xe vm-param-remove uuid=<uuid> param-name=platform param-key=hvm_serial`
141+
83142
## Windows bug check 0x3B (SYSTEM_SERVICE_EXCEPTION) on systems with newer Intel CPUs
84143

85144
### Cause

docs/vms/vms.md

Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -460,76 +460,8 @@ xe vm-param-get param-name=has-vendor-device uuid={VM-UUID}
460460

461461
Our installer is not able currently to cleanly uninstall Citrix tools. Citrix tools' uninstaller itself isn't either: it leaves various things behind.
462462

463-
So we need to perform a complete manual clean-up of the tools:
464-
* either entirely manually
465-
* or using the experimental PowerShell script contributed by one of our users at [https://github.com/siodor/win-tools-cleanup](https://github.com/siodor/win-tools-cleanup)
466-
467-
:warning: In any case, first disable "Windows Update tools" for the VM (Xen Orchestra, advanced tab) and reboot it.
468-
469-
Following is the manual process.
470-
471-
###### The confident option
472-
473-
You can try a simple process first with some chances of success.
474-
475-
0. Make a snapshot so you can rollback. Windows can get unstable/unbootable if things go wrong.
476-
1. Uninstall Citrix :registered: XenServer :registered: Client Tools
477-
2. Reboot
478-
3. Uninstall `XenServer PV`-Drivers in Device Manager in following order (reboots may be needed):
479-
* `XenServer PV Network Device` (one ore more Devices)
480-
* `XenServer PV Storage Host Adapter`
481-
* `XenServer PV Network Class`
482-
* `XenServer Interface`
483-
* `XenServer PV Bus (c000)` (if present)
484-
* `XenServer PV Bus (0002)` or `XenServer PV Bus (0001)`
485-
4. Reboot
486-
5. Check that you see this unknown device in Device Manager:
487-
* `SCSI-Controller` - PCI-Device ID `5853:0002`
488-
6. Unpack ZIP file
489-
7. Start setup.exe
490-
8. Follow the install wizard
491-
492-
**Note**: Restart can take a while if your windows is currently updating. Restart only occurs after windows has the updates finished.
493-
494-
###### The nuclear option
495-
496-
If the *confident option* above didn't yield the expected results, then we switch to a more aggressive attitude towards the old tools.
497-
498-
:::tip
499-
What follows works in many cases, but some users occasionally still meet the following issues: XCP-ng tools not installing (but Citrix tools install well, so that is a solution to have working tools), and occasional BSODs in some cases or versions of Windows.
500-
501-
Through many tests, a user came up with a similar yet slightly different procedure that allowed them to avoid Blue Screens Of Death in their situation: https://xcp-ng.org/forum/post/27602.
502-
503-
Help is welcome to help us reconcile both procedures into one.
504-
:::
505-
506-
* Follow the steps 0 to 4 of the "confident option" above if not done yet.
507-
* Follow this (ignore steps 6 and 7, do not try to install the tools yet) [https://support.citrix.com/article/CTX215427](https://support.citrix.com/article/CTX215427)
508-
* Now open regedit and go to HKLM\SYSTEM\CurrentControlSet\Services and delete entries for all xen* services.
509-
* In regedit, also go to HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DIFx\DriverStore and remove ONLY xennet* xenvif*
510-
* Go to C:\Windows\System32 and remove: (you may not have all these)
511-
* xenbus_coinst*.dll
512-
* xenvbd_coinst*.dll
513-
* liteagent.exe
514-
* Now go to C:\Windows\System32\drivers and remove any files named xen*
515-
* Go to C:\Windows\system32\DriverStore\FileRepository and remove xennet* and Xenvif* directories.
516-
* Open the Device Manager and Click View --> Show Hidden Devices. Select Other Devices and Right click on XENBUS VIF and select uninstall. If it asks to delete the driver, check yes. Do this for any xen related thing you see in device manager. Also do the same for any unknown devices.
517-
* Lastly, reboot the VM. You should now hopefully be able to install xen tools regularly.
518-
519-
**Note**: Also have a look at our [Troubleshooting Guide - Windows PV-Tools](../troubleshooting/windows-pv-tools.md).
520-
521-
##### VMs with INACCESSIBLE_BOOT_DEVICE error
522-
523-
You can try to manually inject the missing drivers in recovery mode.
524-
525-
* Get the "Drivers" folder from the XCP Tools installation path (C:\PROGRAM FILES...) - from another VM or install the tools somewhere else to get it.
526-
* Create an ISO-Image containing the "Drivers" folder (see [http://imgburn.com](http://imgburn.com)) and mount that ISO-Image to your VM
527-
* Boot to recovery mode and use the command line and the tool "dism" (see [Microsoft Docs](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-and-remove-drivers-to-an-offline-windows-image)) to inject the drivers (specifically the xenbus and xenvbd drivers) - watch out for the drive letter of the Windows installation and the CD-Drive ('D' and 'E' in the following example):
528-
529-
````
530-
dism /image:d:\ /add-driver /driver:e:\Drivers\xenbus\x64\xenbus.inf
531-
dism /image:d:\ /add-driver /driver:e:\Drivers\xenvbd\x64\xenvbd.inf
532-
````
463+
So we need to perform a complete clean-up of it using the XenClean utility.
464+
You will find the detailed instructions in our [Troubleshooting Guide - Windows PV Tools](../troubleshooting/windows-pv-tools.md).
533465

534466
#### Contributing
535467
##### Linux / xBSD

0 commit comments

Comments
 (0)