WSL2 support update

Hello,

I wanted to ask whether there are ideas to support dietpi as a wsl distro. :slight_smile:

My last information is, that WSL don’t support systemd, which is a basic requirement for DietPi. Not sure if this changed in meantime.

Thanks for the quick answer!
It seems like systemd is available since last september:

I dont want to push any things which are not in the diepi’s creators mind, just asking because I tried pengwin wsl distro and it was way more limited than what I am used to with dietpi :slight_smile:

Theoretically WLS2 is working using Debian and our own install script Supported hardware - DietPi.com Docs

Additional settings might be needed inside WLS Debian to fix some DNS issues and to force systemd

root@gram:~# cat /etc/wsl.conf
[network]
generateResolvConf = false

[boot]
systemd=true
root@gram:~#

I changed WSL Debian as default in Windows cmd

C:\>wsl --list --all
Windows Subsystem fĂĽr Linux-Distributionen:
Debian (Standard)
Ubuntu

C:\>

and use wsl -u root to start conatiner as user root. At least from same host system, SSH is working as well

However I had some network issues and it was needed to set STATIC IP. Somehow DHCP was not working as it did not set a default gateway. Not sure why becuase it worked on first place. :thinking:

I made a quick test with a VM under Proxmox. But I could not activate the Hyper-V hypervisor in the machine, so in this environment, i failed to install WSL 2 to run the DietPi conversion script.

@andey what would be your use case for running DietPi WSL system?

I do not have a specific use case to be honest.
My simple idea was, that it might be a good thing to be able to test changes before applying them to my productive dietpi system.
Perhaps it would even be possible to make a backup of a dietpi system and troubleshoot it using wsl.
Or simply using the quick installer to spin up a webserver/dev-environment/… for development or testing new software and so on :slight_smile:

For testing, it might be easiest to use Hyper-V or VirtualBox. There you could use fully supported VM’s

However, your idea of restoring systems on a VM might not goanna work. You need to keep in mind the chip architecture used. Usually, SBC are based an ARM while VM’s or native PC use x86. Therefore, you can’t restore such a backup. It depends on what your source system is and where you like to restore on. Even between SBC this will not work. Each manufacture use own kernel and software modules. In an ideal world you would have 2 identical systems that you can compare with each other :smiley:

I was just brainstorming :smiley:

Since I do not want to a WSL2 Debian image or Docker container as a starting point for a DietPi WSL2 image, I’m still trying to future out how to create one from scratch, via debootstrap only. It does not need a bootloader and no kernel, so is close to a container image (well, of course, a Docker image can be imported). It internally mounts an /init “file” as primary or secondary (if systemd support is enabled) init command, similar to how it exists in Docker images. But something else is missing for WSL2 to boot an image. If anyone knows what this might be, I’d be highly interested.

I’ll have another careful look into the VHDX image file of minimised official WSL2 Debian image to hopefully find other required files/dirs needed for WSL to boot it.