{"id":507,"date":"2022-09-09T13:14:56","date_gmt":"2022-09-09T20:14:56","guid":{"rendered":"https:\/\/sysprogs.com\/tutorials\/?p=507"},"modified":"2022-09-12T16:02:40","modified_gmt":"2022-09-12T23:02:40","slug":"visualkernel-qemu-integration","status":"publish","type":"post","link":"https:\/\/sysprogs.com\/VisualKernel\/documentation\/qemu\/","title":{"rendered":"VisualKernel QEMU Integration"},"content":{"rendered":"<p>VisualKernel is fully integrated with <a href=\"https:\/\/www.qemu.org\/\">QEMU<\/a> &#8211; an open-source virtualization engine.<\/p>\n<p>QEMU has a very basic GUI compared to VMWare and VirtualBox, however it is the only virtualization platform that supports kernel debugging on hosts that have the Windows Hyper-V platform enabled. See the <a href=\"#acceleration\">Acceleration<\/a> section for more details.<\/p>\n<h2>Overview<\/h2>\n<p>You can manage the installed QEMU virtual machines via <strong>Tools-&gt;VisualKernel-&gt;Manage Qemu Virtual Machines<\/strong>:<\/p>\n<p><a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/vms.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-508\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/vms.png\" alt=\"\" width=\"1032\" height=\"638\" \/><\/a><\/p>\n<h2><a id=\"settings\"><\/a>Editing Settings<\/h2>\n<p>VisualKernel provides basic GUI for creating new QEMU virtual machines and editing their settings. You can customize the basic parameters (CPU\/RAM\/Storage) or tweak the command line directly:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/vmsettings-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-513\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/vmsettings-1.png\" alt=\"\" width=\"803\" height=\"414\" \/><\/a><\/p>\n<h2><a id=\"network\"><\/a>Network Connection<\/h2>\n<p>Unlike VMWare and VirtualBox that require installing a dedicated network driver, Qemu works by virtualizing individual TCP connections. E.g. it can be configured to map port 22 on the guest to port 2222 on the Windows machine. You can then connect to the guest using the <strong>localhost:2222<\/strong> syntax.<\/p>\n<p>VisualKernel will normally manage the SSH ports automatically. Each time you start a VM, it will find an unused port on the Windows machine, allocate it for the QEMU VM and set the project-level <strong>$(SSHPort)<\/strong> variable to the allocated port number. You can override this behavior via the <strong>Network<\/strong> page of the QEMU VM settings:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/09\/forward.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-535\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/09\/forward.png\" alt=\"\" width=\"860\" height=\"406\" \/><\/a><\/p>\n<h2><a id=\"acceleration\"><\/a>Acceleration<\/h2>\n<p>In order to provide reasonable performance on Windows hosts, QEMU requires the Hyper-V platform to be enabled via <strong>Control Panel -&gt; Add\/Remove Programs -&gt; Turn Windows features on or off<\/strong>: <a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/09\/hyperv.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-536\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/09\/hyperv.png\" alt=\"\" width=\"415\" height=\"368\" \/><\/a><\/p>\n<p>Note that enabling the Hyper-V platform (also needed for WSL 2) forces any other virtualization software to use the Hyper-V engine (WHPX). As of September 2022, QEMU is the only engine that supports kernel debugging when using Hyper-V.<\/p>\n<h2><a id=\"snapshots\"><\/a>Snapshots<\/h2>\n<p>Like many other virtualization tools, QEMU supports creating snapshots of the virtual machines. You can use the Snapshots view under the VisualGDB QEMU Manager to create, restore or delete snapshots:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/09\/snapshots.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-537\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/09\/snapshots.png\" alt=\"\" width=\"1081\" height=\"619\" \/><\/a><\/p>\n<h2><a id=\"monitor\"><\/a>QEMU Monitor<\/h2>\n<p>QEMU provides a way to fine-tune the VM behavior by running commands via the QEMU monitor. You can find the comprehensive list of supported commands on <a href=\"https:\/\/qemu.readthedocs.io\/en\/latest\/system\/monitor.html\">this page<\/a>. You can use the &#8220;Launch QEMU Monitor&#8221; link in the bottom right part of the QEMU VM Manager window to automatically connect to the QEMU monitor and issue commands to it:<\/p>\n<p><a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/09\/monitor.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-538\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/09\/monitor.png\" alt=\"\" width=\"986\" height=\"593\" \/><\/a><\/p>\n<h2><a id=\"troubleshooting\"><\/a>Troubleshooting<\/h2>\n<p>VisualKernel stores the QEMU VM configuration in the XML files with the <strong>.qvm<\/strong> extension. The directory with the <strong>.qvm<\/strong> file typically also contains the following files with the same name:<\/p>\n<table>\n<tbody>\n<tr>\n<td>File<\/td>\n<td>Meaning<\/td>\n<\/tr>\n<tr>\n<td>&lt;VM&gt;.cmd<\/td>\n<td>Contains the exact command line used to launch the QEMU executable. You can run this file manually to reproduce various issues.<\/td>\n<\/tr>\n<tr>\n<td>&lt;VM&gt;.log<\/td>\n<td>Contains the debug output from QEMU.<\/td>\n<\/tr>\n<tr>\n<td>&lt;VM&gt;.run<\/td>\n<td>Contains the PID of the QEMU process and the port numbers allocated to SSH and other services.<\/td>\n<\/tr>\n<tr>\n<td>&lt;VM&gt;.snap<\/td>\n<td>Assigns meaningful names and descriptions to the internal QEMU snapshot IDs.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>VisualKernel is fully integrated with QEMU &#8211; an open-source virtualization engine. QEMU has a very basic GUI compared to VMWare<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57],"tags":[56,26],"_links":{"self":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts\/507"}],"collection":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/comments?post=507"}],"version-history":[{"count":8,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts\/507\/revisions"}],"predecessor-version":[{"id":543,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts\/507\/revisions\/543"}],"wp:attachment":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/media?parent=507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/categories?post=507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/tags?post=507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}