Install Arch Linux on WSL
The archlinux-wsl project offers monthly WSL (Windows Subsystem for Linux) images that aim to provide the simplest but complete system to offer an outright Arch Linux experience with WSL.
Installation
From a Windows system with WSL 2 installed, use one of the following installation methods.
Automated install
Run the following command in a PowerShell prompt:
> wsl --install archlinux
You can then run Arch Linux in WSL via the archlinux
application from the Start menu, or by running wsl -d archlinux
in a PowerShell prompt.
Manual install
WSL 2.4.4 or greater
Download the latest Arch Linux .wsl image and double-click on it to start the installation.
You can then run Arch Linux in WSL via the archlinux
application from the Start menu, or by running wsl -d archlinux
in a PowerShell prompt.
WSL prior to 2.4.4
Download the latest Arch Linux .wsl image and run the following command in a PowerShell prompt:
> wsl --import Distro_name Install_location WSL_image
For instance:
> wsl --import archlinux C:\Users\Username\Documents\WSL\archlinux C:\Users\Username\Downloads\archlinux-2025.04.01.121271.wsl
You can then run Arch Linux in WSL via the archlinux
application from the Start menu, or by running wsl -d archlinux
in a PowerShell prompt. Make sure to execute the first setup script by running /usr/lib/wsl/first-setup.sh
right after the first launch.
Tips and tricks
Set default user
To set a different default user than root
(which should be created beforehand), append the following to the /etc/wsl.conf
file:
[user] default=username
The change will apply at the next session. To terminate your current session, run the following command in a PowerShell prompt:
> wsl --terminate archlinux
Run graphical applications with WSLg
WSLg (Windows Subsystem for Linux GUI) is a project that aims to enable support for running Linux graphical applications (X11 and Wayland) from WSL.
To be able to run graphical applications with WSLg, one must create the following symlinks:
$ ln -sf /mnt/wslg/.X11-unix/* /tmp/.X11-unix/ $ ln -sf /mnt/wslg/runtime-dir/wayland-0* /run/user/user_uid/
This can be added to ~/.bashrc
for the symlinks to be created automatically when starting a session.
Troubleshooting
systemd support
The Arch Linux WSL image provides systemd support.
However, there are known pending issues that may require additional actions for systemd to work properly.
systemd-firstboot.service hanging
The systemd-firstboot.service
job hangs at first boot, preventing any other systemd services to start.
While waiting for the actual root cause of this issue (and a proper fix for it) to be identified, a workaround is automatically applied by the first-setup script when running the image for the first time, so you should not have to do anything on that front.
See archlinux/archlinux-wsl#3 for more details.
systemd requires plain cgroup v2 support
Currently, WSL starts systems with cgroup v1 support by default but systemd >= 256 dropped support for it and requires plain cgroup v2 support.
While waiting for WSL to start systems with plain cgroup v2 support by default, you can force it by disabling cgroup v1 support in the %USERPROFILE%/.wslconfig
file on your Windows system (create it if it does not exists) with the following content:
[wsl2] kernelCommandLine = cgroup_no_v1=all systemd.unified_cgroup_hierarchy=1
Failure when running Docker containers
One might face the following error when running a Docker container from WSL:
Error response from daemon: path / is mounted on / but it is not a shared or slave mount Error: failed to start containers
This is because Docker expects the root (/
) directory to be mounted with rshared propagation.
To do so, run:
# mount --make-rshared /