wsl --statusIf needed, set default version to 2:
wsl --set-default-version 2mkdir "C:\WSL\my-linux"
⚠️ Debian image comes in.rawformat, use a tool like 7zip to extract the rootfs from the compressed and create the appropriatetarfile.
wsl --import my-linux "C:\WSL\my-linux" "C:\WSL\ubuntu-base-25.10-base-amd64.tar.gz" --version 2wsl -d my-linuxexport USERNAME=myuser
useradd ${USERNAME}
mkdir /home/${USERNAME}
cp -a /etc/skel/. /home/${USERNAME}/
chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/
chmod 755 /home/${USERNAME}/
apt update && apt upgrade -y
apt install sudo -y
usermod -aG sudo ${USERNAME}
echo -e "[user]\ndefault=${USERNAME}" | tee /etc/wsl.conf
passwd ${USERNAME}
chsh -s /bin/bash ${USERNAME}apt install nano -y
# Set the hostname in the hosts file
nano /etc/hosts
# Set the hostname without restarting
hostname myhostnameEdit the /etc/wsl.conf
[network]
hostname=myhostnameWhen running multiple WSL2 distributions with systemd=true and networkingMode=mirrored, the network often fails (Network is unreachable) because each instance's systemd-networkd and systemd-resolved compete for the shared Windows network stack.
Ensure your Windows host configuration is optimized in %USERPROFILE%\.wslconfig:
[wsl2]
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=trueSet up each distro to allow WSL to manage the DNS while enabling systemd:
[boot]
systemd=true
[network]
generateResolvConf=trueRun these commands to prevent systemd from hijacking the mirrored interface and breaking the routing table:
# 1. Prevent systemd-networkd from managing interfaces
sudo systemctl disable --now systemd-networkd
sudo systemctl disable --now systemd-networkd.socket
sudo systemctl mask systemd-networkd
# 2. Prevent systemd-resolved from conflicting with WSL DNS Tunneling
sudo systemctl disable --now systemd-resolved
sudo systemctl mask systemd-resolved
# 3. Clean up resolv.conf to use WSL's auto-generated version
sudo rm /etc/resolv.conf
# Restart WSL after this (wsl --shutdown)ip route
# If 'default' route is missing, ensure no other service is managing eth0
ps 1
# Should output /sbin/init to ensure systemd is running