Distrod 是一个适用于 WSL 2 的元分发版,可在一分钟内为您安装 Ubuntu、Arch、Debian、Gentoo 等系统,并内置自动启动功能。
Distrod 是一个适用于 WSL 2 的元分发版,可在一分钟内为您安装 Ubuntu、Arch、Debian、Gentoo 等系统,并内置自动启动功能。
Distrod is a systemd-based meta-distro for WSL2 that allows you to install Ubuntu, Arch Linux, Gentoo and many other distros with systemd in a minute, or make your current distro run systemd.
Distrod also provides built-in auto-start feature and port forwarding service.
This allows you to start systemd-managed services, such as ssh, on Windows startup and make it accessible from outside Windows.
With Distrod, you can
Run systemd in WSL 2
You can do the both of the following
Install any image available from linuxcontainers.org as a WSL 2 distro in 1 minute[^1].
(See Integration test on Linux (distro_name))
* linuxcontainers.org is a vendor-neutral project that offers distro images for containers, which is unrelated to Distrod. LXC/LXD is one of its projects. Systemd runs in the installed distro, so you can also try LXC/LXD in WSL!
Make sure that your default WSL version is 2.
> wsl --set-default-version 2
Download and unzip the latest distrod_wsl_launcher-x86_64.zip from release, and double-click the extracted .exe file.
Follow the wizard to install a new distro.
[Optional] To make your distro start on Windows startup, run the following command.
sudo /opt/distrod/bin/distrod enable --start-on-windows-boot
You also might want to forward ports of services such as ssh to the outside of Windows.
In that case, you can enable the built-in port proxy service provided by Distrod.
NOTE: On Windows 11, portproxy.service doesn't work on Windows startup, which should be fixed soon. See Known bus.
echo 22 | sudo tee /opt/distrod/conf/tcp4_ports # update the portproxy.service's configuration
sudo systemctl enable --now portproxy.service # enable and start it
For more detailed instruction, see Forward Ports to outside of Windows.
By this installation, systemd is enabled in your WSL 2 distro.
Download and run the latest installer script.
curl -L -O "https://raw.githubusercontent.com/nullpo-head/wsl-distrod/main/install.sh"
chmod +x install.sh
sudo ./install.sh install
This script installs distrod, but doesn't enable it yet.
Enable distrod in your distro
You have two options. If you want to automatically start your distro on Windows startup, enable distrod by the following command
/opt/distrod/bin/distrod enable --start-on-windows-boot
Otherwise,
/opt/distrod/bin/distrod enable
You can run enable with --start-on-windows-boot again if you want to enable autostart later.
Restart your distro
Close your WSL's terminal. Open a new Command Prompt window, and run the following command.
wsl --terminate Distrod
After re-opening a new WSL window, your shell runs in a systemd session.
If you are using Windows Terminal, Windows Terminal will automatically find and register Distrod for you. Just open the tab named "Distrod".
If you are using other terminals, please update your terminal settings to launch the Distrod. For reference, the following command launches a distro by name in WSL
> wsl --distribution Distrod
Inside a Distrod session, download and run the latest installer script.
curl -L -O "https://raw.githubusercontent.com/nullpo-head/wsl-distrod/main/install.sh"
chmod +x install.sh
sudo ./install.sh update
In a nutshell, Distrod is a binary that creates a simple container that runs systemd as an init process, and starts your WSL sessions within that container. To realize that, Distrod does the following things.
/opt/distrod/bin/distrod and other resources in the rootfs.Does WSLg works on Distrod?
Yes! Distrod doesn't prevent anything about WSLg. Distrod sets up sockets for X11 and environment variables properly.
However, WSLg itself has some quirks even on non-Distrod WSL2 distros. Try many things until a GUI app runs.
For example, to run xeyes without failure, I had to run it three times on the non-Distrod official Ubuntu 20.04.
暂无开放 Issues,或尚未同步最近议题。