This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.
Step 1 - Enable NBD on the Host
modprobe nbd max_part=8
| //------------------------------------------------------------------------------ | |
| // pdbdump.c - dump symbols from .pdb and executable files (public domain). | |
| // - to compile; cl.exe /Ox /Zi pdbdump.c | |
| // - | |
| // - Martin Ridgers, pdbdump 'at' fireproofgravy.co.uk | |
| //------------------------------------------------------------------------------ | |
| #include <stdio.h> | |
| #include <Windows.h> | |
| #include <DbgHelp.h> |
| // CaptureStackBackTrace | |
| // http://msdn.microsoft.com/en-us/library/windows/desktop/bb204633(v=vs.85).aspx | |
| #define WIN32_LEAN_AND_MEAN | |
| #include <windows.h> | |
| #include <stdio.h> | |
| ////////////////////////////////////////////////////////////// | |
| void capture() { | |
| const ULONG framesToSkip = 0; | |
| const ULONG framesToCapture = 64; |
| // Filename: HttpServer.cs | |
| // Author: Benjamin N. Summerton <define-private-public> | |
| // License: Unlicense (http://unlicense.org/) | |
| using System; | |
| using System.IO; | |
| using System.Text; | |
| using System.Net; | |
| using System.Threading.Tasks; |
| #include "pch.h" | |
| #pragma comment(lib, "gdi32.lib") | |
| enum ZBID | |
| { | |
| ZBID_DEFAULT = 0, | |
| ZBID_DESKTOP = 1, | |
| ZBID_UIACCESS = 2, | |
| ZBID_IMMERSIVE_IHM = 3, | |
| ZBID_IMMERSIVE_NOTIFICATION = 4, |
| #include <windows.h> | |
| #include <initguid.h> | |
| // {c8900b66-a973-584b-8cae-355b7f55341b} | |
| DEFINE_GUID(CLSID_StartMenuCacheAndAppResolver, 0x660b90c8, 0x73a9, 0x4b58, 0x8c, 0xae, 0x35, 0x5b, 0x7f, 0x55, 0x34, 0x1b); | |
| // {46a6eeff-908e-4dc6-92a6-64be9177b41c} | |
| DEFINE_GUID(IID_IAppResolver_7, 0x46a6eeff, 0x908e, 0x4dc6, 0x92, 0xa6, 0x64, 0xbe, 0x91, 0x77, 0xb4, 0x1c); | |
| // {de25675a-72de-44b4-9373-05170450c140} |
| #include <Unknwn.h> | |
| #include <Windows.h> | |
| #include <ntstatus.h> | |
| #include <winternl.h> | |
| #include <wrl\implements.h> | |
| #include <comutil.h> | |
| #include <dcomp.h> | |
| #include <dwmapi.h> | |
| #include <dxgi1_3.h> | |
| #include <d3d11_2.h> |
Modern versions of Windows support GPU paravirtualization in Hyper-V with normal consumer graphics cards. This is used e.g. for graphics acceleration in Windows Sandbox, as well as WSLg. In some cases, it may be useful to create a normal VM with GPU acceleration using this feature, but this is not officially supported. People already figured out how to do it with Windows guests though, so why not do the same with Linux? It should be easy given that WSLg is open source and reasonably well documented, right?
Well... not quite. I managed to get it to run... but not well.
| # Steps needed to disable DeviceGuard with UEFI lock | |
| # Disable DeviceGuard in registry | |
| cmd /c 'REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DeviceGuard" /v "EnableVirtualizationBasedSecurity" /f' | |
| cmd /c 'REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DeviceGuard" /v "RequirePlatformSecurityFeatures" /f' | |
| cmd /c 'REG DELETE "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceGuard" /v "EnableVirtualizationBasedSecurity" /f' | |
| cmd /c 'REG DELETE "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceGuard" /v "RequirePlatformSecurityFeatures" /f' | |
| # Change UEFI settings. Reboot and confirmation needed. | |
| mountvol X: /s |