initrd binary to experiment with WSLg in Windows 10

Overview

initrdg

initrd binary to experiment with WSLg in Windows 10

⚠️ Disclaimer: At time of this writing, WSLg (GUI support in WSL) is not available in Windows 10. This project is just to experiment with that. This is not a replacement of actual WSLg shipped in Windows 11. Please use this only for fun and experimental purposes. Also backup your WSL setup before using this program. This may totally destroy your current WSL environment.

Table of contents

Assumptions

This program assumes some certain aspects by default which are as following:

  • WSL msix is extracted at C:\WSL path. Feel free to change the folder path. But you also have to change the path in SystemDistro.reg file and the environment variable listed in how to use section.

  • This project has been tested in Windows 10 21H1 Version 10.0.19043.928. The messages between initrd and Lxss service are varied with Windows versions. Feel free to modify this project for your own Windows version.

  • Every binaries are compiled in Alpine Linux and with musl libc & gcc. Feel free to use any compiler toolchain and libc.

Preparation

  • Download WSL msixbundle package from WSL Release page. In that msixbundle, extract the ARM64 or X64 msix according to your CPU architecture. Extract the msix in C:\WSL path (default) or at your choice (need modification). Use any program that can extract from ZIP format e.g. unzip, 7zip etc.
  • In C:\WSL directory, convert the system.vhd to ext4.vhdx file. Because Lxss service expects the WSL distribution in exactly ext4.vhdx named file. Use this command in Powershell.
Convert-VHD -Path "system.vhd" -DestinationPath "ext4.vhdx"
  • Double click on the SystemDistro.reg file to register the ext4.vhdx file with "system" named distribution in WSL2 environment. Make sure there is no distribution with "system" name before that.

  • Backup and Rename the initrd.img file in C:\Windows\System32\lxss\tools directory to something else. Clone this repository. Run make command in any GNU/Linux distribution to compile the initrd.img file. Copy the newly compiled initrd.img file to that C:\Windows\System32\lxss\tools directory.

  • Check out Win10 branch in my fork of wslg. Run make command in WSLGd directory to compile WSLGd static executable. Remember the full path of that for later use.

How to use

  • Run your preferred GNU/Linux distribution in WSL2.

  • Execute wsl.exe -d system to run the newly registered "system" distribution.

  • Run the following commands in both your running distribution and "system" distribution as well. This step may not required in future, just thoughts. The <guid> is retrieved from hcsdiag.exe list command output.

export WAYLAND_DISPLAY=wayland-0
export DISPLAY=:0
export XDG_RUNTIME_DIR=/mnt/wsl/runtime-dir
export PULSE_SERVER=/mnt/wsl/PulseServer
export WSL2_INSTALL_PATH="C:\\WSL"
export WSL2_VM_ID=<guid>
  • Run previously compiled WSLGd binary in "system" distribution. The WSLGd will invoke C:\WSL\msrdc.exe executable and show a warning window to accept network connections. Click on "Connect" button to allow it.

  • Now run any GUI program in your distribution 🎉

Differences with initrd

This project is not an replacement of initrd binary which already exists in Windows 10 and 11 systems. This does NOT do:

  • Import or export distributions in WSL2.
  • Convert distributions from WSL1 to WSL2 or vice-versa.
  • Create or attach swap file.
  • Execute localhost or telemetry processes.
  • Compact memory.

Acknowledgments

Everyone in the discussions:

Free and Open source projects:

License

This project is licensed under GNU General Public License version 3 or any later version at your option. See LICENSE file for further details.

Owner
Biswapriyo Nath
Biswapriyo Nath
An experiment of running a lot of wasm apps on esp32 M5 atom matrix board

Wasms This is a POC project to run many wasm apps on a single esp32 board (in my case, M5 Atom Matrix, with a nice neopixel 5x5 display matrix). All I

Dmitry Kabak 10 Nov 10, 2021
Clio is an embryonic experiment in UI for Common Lisp programs.

Clio Clio is an embryonic experiment in UI for Common Lisp programs. Building and running Clio Make sure you have the prerequisites: Visual Studio 201

mikel evins 1 Nov 15, 2021
The simple UEFI application to create a Windows Platform Binary Table (WPBT) from the UEFI shell.

WPBT Builder This is a simple UEFI application to create a Windows Platform Binary Table (WPBT) from the UEFI shell. Motivation WPBT is one of the Adv

Satoshi Tanda 55 Nov 13, 2021
A simple processor emulator written in c++ that can parse and execute x32 code. x32 is binary code made by me for this processor.

A SIMPLE PROCESSOR EMULATOR AND CODE EXECUTOR The Repository This is a fairly new project and is still heavy in development. If you find and bugs feel

Luka Golob 5 Aug 11, 2021
A HEIF/HEIC addon for Pillow using libheif library through CFFI, with binary wheels.

pillow_heif A HEIF/HEIC addon for Pillow using libheif library through CFFI, with binary wheels(Python 3.6-3.9, linux/macos - x64,aarch64). Based most

Alexander Piskun 5 Nov 21, 2021
A program for converting instructions from Ben Eater's 8 Bit computer design to binary.

8Bit-Assembler A program for converting instructions from Ben Eater's 8 Bit computer design to binary. We used C because is used for it's mid-level-ne

Marek Borik 2 Nov 21, 2021
cbmconvert: create, extract and convert 8-bit Commodore binary archives

cbmconvert: create, extract and convert 8-bit Commodore binary archives cbmconvert extracts files from most known archive file formats that are used o

Marko Mäkelä 5 Dec 6, 2021
A template to build a 3DS firmware binary which just has an Arm9 section

minifirm A template to build a 3DS firmware binary which just has an Arm9 section. Install dependencies $ sudo apt install gcc-arm-none-eabi binutils-

HIDE 1 Nov 19, 2021
A Native Binary Emulator Library and Utility

binmulator A Native Binary Emulator Library and Utility Most emulators for malware detection are written in Python and fail when certain emulated API

c3rb3ru5 1 Nov 20, 2021
Using D2XX driver to capture UART data to a binary file

What is it This is the sample code to read UART data using any baud rate that FTDI supports and save them to a binary file. How to use Usage: ./larger

pandy song 1 Nov 24, 2021
BSOD: Binary-only Scalable fuzzing Of device Drivers

bsod-kernel-fuzzing This repository contains the implementations described in "BSOD: Binary-only Scalable fuzzing Of device Drivers". The paper and th

Fabian Toepfer 106 Nov 17, 2021
Windows 2000 styled installer for Panther based distributions of Microsoft Windows (WIM files).

An advanced installer for Microsoft Windows that mimics the looks of the Windows XP and older installers. Takes any modern (Vista and newer) Windows ISO or WIM file and creates a old styled Windows Setup experience on the go.

null 2 Nov 20, 2021
Windows 7/2008 R2 EoP

Windows RpcEptMapper Service EoP exploit Clément Labro (@itm4n) released in November 12, 2020 all the details for a vulnerability on Windows 7 and Win

neosysforensics 13 Mar 29, 2021
Gaming Input Peripherals Device Firewall for Windows.

HidHide ⚠️ Compiling a signed BETA release is in the works, please be patient! ⚠️ Introduction Microsoft Windows offers support for a wide range of hu

Virtual Gamepad Emulation Framework 151 Dec 5, 2021
Asteroids Clone for Windows

Asteroids Clone for Windows This game is a simple Asteroids clone primarily intended to demonstrate the capabilities and flexibility of w64devkit. It

Christopher Wellons 15 Aug 9, 2021
A program that allows you to hide certain windows when sharing your full screen

Invisiwind Invisiwind (short for Invisible Window) is an application that allows you to hide certain windows when sharing your full screen.

Joshua T. 45 Dec 4, 2021
A beginner friendly desktop UI for Tasmota flashed devices for Windows, macOS and Linux.

TasmoManager A beginner friendly desktop UI for Tasmota flashed devices for Windows, macOS and Linux. Features Native Tasmota device discovery (via ta

Tom Butcher 33 Nov 15, 2021
Slackware for Windows Subsystem for Linux (WSL)

WSLackware: Slackware on Windows! Slackware for Windows Subsystem for Linux (WSL) WSLackware is an unofficial version of Slackware for Windows Subsyst

Mohsen Seifi 22 Nov 23, 2021