Last weekend, I decided to concentrate on a single mission: Get a desktop installed in any or all of my WSL distros without using X Server or any other third party software installed in Windows, then create a WSL Sandbox for testing purposes.
The first goal was the easiest. I got XFCE desktop installed in my WSL Ubuntu, and connected to it using the Windows native Remote Desktop Connection. Thus, no X Server was needed:
I documented this surprisingly easy and fast process in a tutorial on Ten Forums: Windows Subsystem for Linux – Add desktop experience to Ubuntu
My second goal was more difficult. I tested various scenarios to create a real WSL Sandbox, failing miserably in all but two scenarios. As far as I can tell, both methods I came up with are the most practical ones. They do what a Sandbox should do — namely, reset all WSL Linux distros to a clean state. The first method uses a Hyper-V virtual machine with nested virtualization enabled, and Production Checkpoints. When I want to discard all changes, I return back to a clean state in less than 20 seconds.
The second method uses a native boot VHD. It gives WSL more direct access to real, physical hardware on the host device, but restoring a WSL clean state takes more time, up to a few minutes.
For all those details, please see the tutorial on Ten Forums: Windows Subsystem for Linux – Create a WSL Sandbox in Windows 10
I am not completely happy with my Sandbox solutions, or rather workarounds. But anyways, I did manage to achieve what I wanted. I’ll keep thinking about it, and experimenting. If I find any better ways to create and manage a WSL sandbox, I’ll update this article (or write a new one).
Author: Kari Finn
A former Windows Insider MVP, Kari started in computing in the mid 80’s writing code for VAX / VMS systems. Since then, he’s worked in a variety of IT positions. He specializes in Windows image capture, customization, repair and deployment as well as Hyper-V virtualization. Kari is a proud Team Member at number #1 Windows site TenForums.com.