Make your own WSL Distro

By

Vineel Sai

profile
linuxwslwindows

Banner

WSL is a feature in Windows 10 and later versions that allows users to run Linux programs natively on Windows, without the need for a virtual machine or a dual-boot setup. With WSL, users can install a Linux distribution of their choice, and access the Linux command-line interface directly from the Windows terminal. This allows for easier integration between the two operating systems, making it possible to develop and test Linux applications on a Windows machine. WSL has become increasingly popular among developers, as it provides a convenient and efficient way to use both Windows and Linux tools and workflows simultaneously.

Import tar file

  • You can import any distro you want from rootfs of the distro
wsl --import <Distro> <InstallLocation> <FileName>
  • Here <Distro> is the name of the distro you want to import it can be anything you want, <InstallLocation> is the path where ext4.vhdx which contains your linux file system, <FileName> is the tar export of distro you want to use as WSL.

  • Then you can simply import the tar file to get your own Arch WSL

wsl --import Arch $HOME\Arch\ rootfs.tar

Export tar file

  • You can extract the tar file from a docker container
# Here is a example with Arch Linux docker create --name arch arch:latest docker export -o rootfs.tar arch docker rm -f arch
  • Or you can extract the tar file from a existing WSL using the command
wsl --export Arch $HOME\Downloads\rootfs.tar

Delete the distro

  • To delete the imported distro just run the command
wsl --unregister Arch

Check out WSL Distros I made