How can we run an Hyper-V virtual machine, with WSL2?

johnp

Member
Local time
3:24 PM
Posts
3
OS
Windows 11 Pro
Hi all,

I have installed and use Ubuntu in WSL2.

Also, I have installed and use Manjaro Linux MATE, in Hyper-V (as a Generation 2 virtual machine, that is the newest option).

Is there any way to run the Manjaro Linux installation of Hyper-V, with WSL2?

Thank you a lot.
 
Windows Build/Version
Windows 11 Version 21H2
Last edited:

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Build to Order machine
    CPU
    Intel Core i7-4790 (Haswell)
    Motherboard
    MSI Z97 Gaming 7
    Memory
    32 GB
    Graphics Card(s)
    GIGABYTE NVIDIA GeForce RTX 2060 GAMING OC PRO 6G
    Screen Resolution
    1080p
    Hard Drives
    2x Samsung 860 EVO SATA SSD 1TB
    Cooling
    CORSAIR Hydro Series H80i v2
    Internet Speed
    30 Mbps VDSL2
    Browser
    Microsoft Edge

jimbo45

Well-known member
Power User
VIP
Local time
1:24 PM
Posts
946
Location
Hafnarfjörður IS
OS
Windows XP,7,10,11 Linux Arch Linux
Hi there
Bit confused as to the meaning of this question.

You don't need HYPER-V to install the Linux VM if you want to run a "Native distro" in the WSL. There's no advantage in doing that over a "bog standard HYPER-V VM" at least IMO. Just install the distro from the MS store.

WSL means that this is actually a running "Linux kernel" on Windows - technically not really a VM in the true sense of the word. Ms is using a "modified" linux kernel and has some "customised" distros that will install on it. If you can use the command line you might be able to install other distros - not sure if that's possible currently as you'd need to be able to boot from an iso and get access to the "Linux root disk". It's also not easy to add a desktop GUI either although with a lot of tinkering it can be partly done. Some GUI programs will run however.

This though could be a way if you can get the tar file of the distro


I'm looking to see if there's ways of installing your own distros in the WSL -- have been doing other things lately but now W11 has settled down a bit - might be worth looking at this again.

If anybody has installed "Non Ms store" distros please post on how they did it - and also anybody whose got a full GUI working on WSL.

Cheers
jimbo
 

My Computer

System One

  • OS
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7

johnp

Member
Thread Starter
Local time
3:24 PM
Posts
3
OS
Windows 11 Pro
Hi jimbo45, thank you for your answer.

What I have done so far, is installed the default WSL2 Ubuntu instance.

Then I exported it to a tar file, and imported it as "Ubuntu MATE". Then, using tasksel, I installed the default Ubuntu MATE packages to it, by following this procedure:


It worked fine, when I opened a Windows Terminal with it, I was still viewing the Linux command line, but after installing xrdp in the virtual machine, I could see the GUI by connecting with Remote Desktop Connection client of Windows 11.

So, the situation was like this:

I had Ubuntu MATE with its GUI installed in WSL2, and was using it well with Windows Terminal.

Later, I erased the Ubuntu MATE WSL2 installation, and installed Manjaro MATE in Hyper-V.

The question is, can I use the Manjaro MATE Hyper-V virtual machine with WSL2, i.e. use its command line in Windows Terminal?

I will study the How-to guide you provided, it looks like it is in the right direction.
 
Last edited:

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Build to Order machine
    CPU
    Intel Core i7-4790 (Haswell)
    Motherboard
    MSI Z97 Gaming 7
    Memory
    32 GB
    Graphics Card(s)
    GIGABYTE NVIDIA GeForce RTX 2060 GAMING OC PRO 6G
    Screen Resolution
    1080p
    Hard Drives
    2x Samsung 860 EVO SATA SSD 1TB
    Cooling
    CORSAIR Hydro Series H80i v2
    Internet Speed
    30 Mbps VDSL2
    Browser
    Microsoft Edge

johnp

Member
Thread Starter
Local time
3:24 PM
Posts
3
OS
Windows 11 Pro
I read the How-to guide, it is about exporting Docker containers to a tar file.

I have no clue how to do the export of Manjaro MATE Hyper-V virtual machine, to a tar file.
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Build to Order machine
    CPU
    Intel Core i7-4790 (Haswell)
    Motherboard
    MSI Z97 Gaming 7
    Memory
    32 GB
    Graphics Card(s)
    GIGABYTE NVIDIA GeForce RTX 2060 GAMING OC PRO 6G
    Screen Resolution
    1080p
    Hard Drives
    2x Samsung 860 EVO SATA SSD 1TB
    Cooling
    CORSAIR Hydro Series H80i v2
    Internet Speed
    30 Mbps VDSL2
    Browser
    Microsoft Edge

jimbo45

Well-known member
Power User
VIP
Local time
1:24 PM
Posts
946
Location
Hafnarfjörður IS
OS
Windows XP,7,10,11 Linux Arch Linux
I read the How-to guide, it is about exporting Docker containers to a tar file.

I have no clue how to do the export of Manjaro MATE Hyper-V virtual machine, to a tar file.
Hi there

@johnp

I'm 100% not sure about this but I don't think you can convert a HYPER-V VM into a WSL version You can create Manjaro Mate WSL easily enough though. I'm not sure why you would want to convert a HYPER-V machine into a WSL version either -- remember that currently WSL machines can't be accessed from OUTSIDE their host due to the Virtual network being NAT and not Bridged. hyper-V vm's can be accessed remotely (bit of a fiddle with Networking but Kari's tutorials are always good on that one).

However there should be NO problem with accessing a HYPER-V Linux VM's terminal from Windowss -- the simplest is to do the following

1) On Windows install in the extra options the openssh server and ensure the service is running

2) On yourHYPER-V Linux VM ensure open ssh is installed and the ssh server is running (might be called sshd in some distros -the final d often signifies that a daemon is running, and enable and start the service (ssh / sshd depending on your distro. You might also want to enable "Root access for SSH" in the config, and if you need the GUI you can also mess around with X-Server over SSH but I wouldn't bother with that if XRDP works.

3) from Windows command line simply type SSH to your VM.

(Not sure if this works but it could also in some circumstances -- enable in "turn Windows features off and on" and select telnet. then you can also as an alternative telnet nto your VM. Personally I prefer the ssh method.

For Dockers you can install the Docker interface on Windows which makes it easy to "Pull" versions, create containers, import and export to .tar files etc.

Cheers
jimbo
 
Last edited:

My Computer

System One

  • OS
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7
Top Bottom