{"id":10,"date":"2025-01-05T11:14:43","date_gmt":"2025-01-05T11:14:43","guid":{"rendered":"https:\/\/homelab.computer\/?p=10"},"modified":"2025-01-13T19:57:30","modified_gmt":"2025-01-13T19:57:30","slug":"qubes-os-hiding-a-pcie-device-from-dom0","status":"publish","type":"post","link":"https:\/\/homelab.computer\/index.php\/2025\/01\/05\/qubes-os-hiding-a-pcie-device-from-dom0\/","title":{"rendered":"Qubes OS: Hiding PCIe devices from dom0"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Directly attaching PCIe devices to multiple active virtual machines (VMs) is usually impossible. When attempted, all VMs will simultaneously try to control the hardware, leading to VMs or the entire system crashing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An exception exists for hardware supporting Single Root I\/O Virtualization (SR-IOV), which enables partitioning a PCIe device for simultaneous use by multiple VMs. However, SR-IOV requires both motherboard and PCIe card compatibility, making it uncommon in consumer hardware.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide will not address SR-IOV configuration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In Qubes OS, users often encounters system crashes during GPU pass-through attempts. This occurs because the GPU initially attaches to dom0 during boot up. Subsequently, attempting to assign the GPU to a second VM causes the system instantly crash and reboot.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hiding a device prevents it from attaching to dom0, making it available for allocation to any user VM.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Hiding a PCIe device from dom0<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide demonstrates hiding your GPU, but this method applies to any PCIe device.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1.<\/strong> <strong>Identify the Device ID:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In dom0, use <strong>lspci<\/strong> to list connected PCIe devices and identify the device you want to hide:<\/p>\n\n\n\n<p class=\"has-background has-small-font-size wp-block-paragraph\" style=\"background-color:#eaeaea\"><code>05:00.0 VGA compatible controller: NVIDIA Corporation AD106 [GeForce RTX 4060 Ti 16GB] (rev a1)<br>05:00.1 Audio device: NVIDIA Corporation Device 22bd (rev a1)<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, <strong>05:00.0<\/strong> represents the GPU, and <strong>05:00.1<\/strong> is an audio device connected to it. If your GPU has any other connected devices, hide all of them.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2. Modify GRUB Configuration:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Append the following line to your \/etc\/default\/grub file:<\/p>\n\n\n\n<p class=\"has-background has-small-font-size wp-block-paragraph\" style=\"background-color:#eaeaea\"><code>GRUB_CMDLINE_LINUX=\"$GRUB_CMDLINE_LINUX rd.qubes.hide_pci=05:00.0,05:00.1\"<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <strong>05:00.0<\/strong>, and <strong>05:00.1<\/strong> with the actual IDs of your targeted devices.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3. Update GRUB Configuration:<\/strong><\/p>\n\n\n\n<p class=\"has-background has-small-font-size wp-block-paragraph\" style=\"background-color:#eaeaea\"><code>sudo grub2-mkconfig -0 \/boot\/grub2\/grub.cnf<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>4. Reboot and Verify:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After rebooting, run: <strong>lspci -v<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Look for your GPU entry. The Kernel driver should now indicate <strong>pciback<\/strong>.<\/p>\n\n\n\n<p class=\"has-background has-small-font-size wp-block-paragraph\" style=\"background-color:#eaeaea\"><code>Kernel driver in use: pciback<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The device is now hidden from dom0 and can be safely assigned to a virtual machine.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Short guide explaning how to hide a PCIe device from dom0, useful when doing PCIe pass-through<\/p>\n<a class=\"read-more-link\" href=\" https:\/\/homelab.computer\/index.php\/2025\/01\/05\/qubes-os-hiding-a-pcie-device-from-dom0\/ \">Read more<\/a>","protected":false},"author":1,"featured_media":14,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,2],"tags":[],"class_list":["post-10","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-pcie-pass-through","category-qubes-os"],"_links":{"self":[{"href":"https:\/\/homelab.computer\/index.php\/wp-json\/wp\/v2\/posts\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/homelab.computer\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/homelab.computer\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/homelab.computer\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/homelab.computer\/index.php\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":5,"href":"https:\/\/homelab.computer\/index.php\/wp-json\/wp\/v2\/posts\/10\/revisions"}],"predecessor-version":[{"id":57,"href":"https:\/\/homelab.computer\/index.php\/wp-json\/wp\/v2\/posts\/10\/revisions\/57"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/homelab.computer\/index.php\/wp-json\/wp\/v2\/media\/14"}],"wp:attachment":[{"href":"https:\/\/homelab.computer\/index.php\/wp-json\/wp\/v2\/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/homelab.computer\/index.php\/wp-json\/wp\/v2\/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/homelab.computer\/index.php\/wp-json\/wp\/v2\/tags?post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}