{"id":687,"date":"2022-04-19T03:02:28","date_gmt":"2022-04-19T03:02:28","guid":{"rendered":"https:\/\/www.buddroyce.com\/?p=687"},"modified":"2022-04-19T03:03:25","modified_gmt":"2022-04-19T03:03:25","slug":"hyper-v-and-linux","status":"publish","type":"post","link":"https:\/\/www.buddroyce.com\/?p=687","title":{"rendered":"Hyper-V and Linux"},"content":{"rendered":"\n<p>After I completed my CISSP certification I wanted a break from all the studying and do something nerdy that I&#8217;ve been meaning to do but never got around to it. For me, this was doing a full Linux From Scratch build.<\/p>\n\n\n\n<p>Back in the day I would just load up Linux on another machine to use as a host but since I now have my studio workstation at home with more cores than I know what to do with, I decided it might be a good idea to put it to work running some VMs.<\/p>\n\n\n\n<p>Most of the VM&#8217;s I&#8217;ve worked with have predominantly been Type II hypervisors (meaning they run off a host OS) and every once in a while I&#8217;ll get to build a virtualization server using a Type I hypervisor. For some strange reason I completely forgot that Microsoft&#8217;s Windows Server Hyper-V is actually available on Windows 10 and 11 Pro.<\/p>\n\n\n\n<p>With it being a Type I hypervisor, it meant that my VM&#8217;s don&#8217;t have the operating system overhead like a Type II normally would (read more performance), but more importantly, it also meant that if I wanted to run VMs in the background as a service, I totally could while I still use my workstation. Yeah, it&#8217;s probably not the best idea in a production environment but this is my house\/home lab.<\/p>\n\n\n\n<p>I&#8217;ll cover my LFS build in another post as I&#8217;d rather cover some issues I found while using a Linux guest OS under Windows Hyper-V.<\/p>\n\n\n\n<p>Yes I know I could have just used WSL2 but I really didn&#8217;t want to mess with my main system all that much, especially since I&#8217;d likely be building and destroying many installs as I&#8217;d be testing a bunch of distros I&#8217;d like to use as the host. Technically speaking I could have just used ANY distro and then update the packages accordingly but I&#8217;d rather not muck around with that just to get my LFS build started.<\/p>\n\n\n\n<p>For the most part, I ran into two common issues.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Some distros just won&#8217;t boot or just get stuck in a black screen forever.<\/li><li>When they did work, I couldn&#8217;t copy and paste from my host (My Windows box) into my guest (my virtualized Linux box).<\/li><\/ol>\n\n\n\n<p><strong>Issue 1: Getting Linux distros to work properly<\/strong><\/p>\n\n\n\n<p>After looking at a few distros, I settled on the EndeavourOS pre-installation live environment as my host for my LFS build. However, for some strange reason I couldn&#8217;t get it to boot properly.<\/p>\n\n\n\n<p>Found out after a bit of searching that this problem can be worked around by using the Quick Create feature under Hyper-V and unchecking <em>&#8220;This virtual machine will run Windows&#8221;<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"817\" height=\"479\" src=\"https:\/\/www.buddroyce.com\/wp-content\/uploads\/2022\/04\/HyperV_quickCreate.png\" alt=\"\" class=\"wp-image-689\" srcset=\"https:\/\/www.buddroyce.com\/wp-content\/uploads\/2022\/04\/HyperV_quickCreate.png 817w, https:\/\/www.buddroyce.com\/wp-content\/uploads\/2022\/04\/HyperV_quickCreate-300x176.png 300w, https:\/\/www.buddroyce.com\/wp-content\/uploads\/2022\/04\/HyperV_quickCreate-768x450.png 768w\" sizes=\"auto, (max-width: 817px) 100vw, 817px\" \/><\/figure>\n\n\n\n<p>After doing that, EndeavourOS booted fine!<\/p>\n\n\n\n<p>Now it&#8217;s great that I got it to work but the problem is my main SSD where Hyper-V likes to defaults to doesn&#8217;t have that much space and I&#8217;d like to have my VMs sitting on a larger secondary SSD I have sitting around and set other options that the quick create menu doesn&#8217;t give me (like limiting the size of my virtual hard disk).<\/p>\n\n\n\n<p>So now that I know Hyper-V will work, I just gotta figure out how to configure it manually so I don&#8217;t have to use the Quick Create and it turns out all I needed to do was disable secure boot under the host settings<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"722\" height=\"683\" src=\"https:\/\/www.buddroyce.com\/wp-content\/uploads\/2022\/04\/HyperV_HostSettings.png\" alt=\"\" class=\"wp-image-690\" srcset=\"https:\/\/www.buddroyce.com\/wp-content\/uploads\/2022\/04\/HyperV_HostSettings.png 722w, https:\/\/www.buddroyce.com\/wp-content\/uploads\/2022\/04\/HyperV_HostSettings-300x284.png 300w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/figure>\n\n\n\n<p>This issue also replicates itself while I was trying to install some other distros, so if you run into the same problem. See if Secure Boot is enabled.<\/p>\n\n\n\n<p><strong>Issue 2: Getting Copy\/Paste to work<\/strong><\/p>\n\n\n\n<p>Yes I know I really should manually type everything but sometimes, I just want to copy and paste text\/urls\/commands from my browser in my host machine into my VM. When I was running Virtual Box, I was fully able to copy\/paste between host and guest no problem after I install the guest tools, but I couldn&#8217;t find any that I could use under Hyper-V and EndeavourOS.<\/p>\n\n\n\n<p>Online searches didn&#8217;t bring up much other than making sure I have enhanced sessions turned on for both the Hyper-V server and the guest, which I already did but it just didn&#8217;t work for the life of me. Sure I could just use a browser from within the VM but I really didn&#8217;t feel like doing that.<\/p>\n\n\n\n<p>Apparently the Ubuntu distros from the Hyper-V Quick Create menus have guest tools built into the distro but I couldn&#8217;t get it to work either.<\/p>\n\n\n\n<p>The only solution that worked was using xrdp and instead of connecting through the Hyper-V manager (effectively running VMConnect), I&#8217;d have to run RDP and remote in.<\/p>\n\n\n\n<p>Thankfully I found a script that sorts all that out for me. I couldn&#8217;t get it to work under EndeavourOS but it did work fine under Ubuntu (and it supposedly supports Debian as well). <\/p>\n\n\n\n<p><a href=\"https:\/\/c-nergy.be\/blog\/?p=17175\">xRDP \u2013 Easy install xRDP on Ubuntu 18.04,20.04,21.04,21.10 (Script Version 1.3) \u2013 Griffon&#8217;s IT Library (c-nergy.be)<\/a><\/p>\n\n\n\n<p>Following the instructions, the installation was pretty painless.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Run wget https:\/\/www.c-nergy.be\/downloads\/xRDP\/xrdp-installer-1.3.zip<\/li><li>Unzip the file<\/li><li>Set the script to executable (chmod +x)<\/li><li>run the script<\/li><li>LOG OUT OF THE SYSTEM (very important)<\/li><li>Run remote desktop connection<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"401\" height=\"472\" src=\"https:\/\/www.buddroyce.com\/wp-content\/uploads\/2022\/04\/RDP_Linux.png\" alt=\"\" class=\"wp-image-691\" srcset=\"https:\/\/www.buddroyce.com\/wp-content\/uploads\/2022\/04\/RDP_Linux.png 401w, https:\/\/www.buddroyce.com\/wp-content\/uploads\/2022\/04\/RDP_Linux-255x300.png 255w\" sizes=\"auto, (max-width: 401px) 100vw, 401px\" \/><\/figure>\n\n\n\n<p>What works is the ability to copy and paste between host and guest OS&#8217;s. I initially ran into a problem where I&#8217;d RDP into the VM but would run into a black screen. Turned out it&#8217;s a known issue as the user that&#8217;s trying to remote in can&#8217;t be currently logged in. Logging out of any sessions solves that.<\/p>\n\n\n\n<p>I disable printer sharing because printers always seem to cause problems and I don&#8217;t think I&#8217;ll need to print anything from my VM.<\/p>\n\n\n\n<p>The sound redirection doesn&#8217;t seem to work even when I run the script with the sound redirection flag or run pulseaudio -k but I really don&#8217;t care about sound on the VM. Being able to copy and paste between host and client was the real win for me here.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After I completed my CISSP certification I wanted a break from all the studying and do something nerdy that I&#8217;ve been meaning to do but never got around to it. For me, this was doing a full Linux From Scratch build. Back in the day I would just load up Linux on another machine to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-687","post","type-post","status-publish","format-standard","hentry","category-it-and-tech"],"_links":{"self":[{"href":"https:\/\/www.buddroyce.com\/index.php?rest_route=\/wp\/v2\/posts\/687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.buddroyce.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.buddroyce.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.buddroyce.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.buddroyce.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=687"}],"version-history":[{"count":1,"href":"https:\/\/www.buddroyce.com\/index.php?rest_route=\/wp\/v2\/posts\/687\/revisions"}],"predecessor-version":[{"id":692,"href":"https:\/\/www.buddroyce.com\/index.php?rest_route=\/wp\/v2\/posts\/687\/revisions\/692"}],"wp:attachment":[{"href":"https:\/\/www.buddroyce.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.buddroyce.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.buddroyce.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}