megrxu

Import Arch Tar to WSL2

We can actually import any Linux distribution to use with WSL2. By the way, I personally use Arch.

To get started, we can choose the desired image from nspawn. All we need to do is download the tar image file.

Once we have the container image, we can import it using the following command: wsl --import <Distro> <InstallLocation> <FileName>.

After that, we need to reload the local keys in order to make pacman work: pacman-key --populate.

To set WSL to use a normal user as the default and configure the init system to systemd, we need to create the file /etc/wsl.conf.

1
2
3
4
5
[user]
default=whoami

[boot]
systemd=true