User Tools

Site Tools


wsl

Installation

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# OR
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Disable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

Create rootfs from Docker image

sudo su -
mkdir rootfs && docker export $(docker create archlinux) | tar -C rootfs -xf -
cd rootfs && tar czf ../rootfs.tar.gz --hard-dereference * && cd ..

Create rootfs from ISO

sudo su -
unsquash -d rootfs /path/to/distro.sfs to extract file system
cd rootfs && tar czf ../rootfs.tar.gz --hard-dereference * && cd ..

Create Distribution Archive

  1. Copy distribution exe from exe directory into same dirctory as rootfs.tar.gz
  2. Run zip distro.zip distro.exe rootfs.tar.gz

Install Distribution

  1. Create directory for distribution
  2. Extract distro.zip into it
  3. Run distro.exe to install
  4. Run distro.exe –help to configure distribution

WSL2 genie-systemd

Debian/Ubuntu
# Debian
wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
# Ubuntu 18.04
wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
# Ubuntu 20.04
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
curl -s https://packagecloud.io/install/repositories/arkane-systems/wsl-translinux/script.deb.sh | sudo bash
sudo apt-get update
sudo apt-get install dotnet-runtime-3.0
sudo apt install systemd-genie

# generic shortcut
wsl.exe ~ -d Ubuntu-20.04 genie -c zsh
# wsltty shortcut
C:\Users\ctran\AppData\Local\wsltty\bin\mintty.exe --WSL="Ubuntu-20.04" --configdir="C:\Users\ctran\AppData\Roaming\wsltty" -~ genie -c zsh
Arch
# Manual (latest version)
sudo pacman -S dotnet-sdk systemd
git clone https://aur.archlinux.org/yay.git
cd yay && makepkg -si
wget https://github.com/arkane-systems/genie/archive/1.24.tar.gz
tar xf 1.24.tar.gz && cd genie-1.24
make && sudo make install
yay -S daemonize
sudo vim /usr/local/lib/genie/deviated-preverts.conf
  { "systemd": "/usr/lib/systemd/systemd" }

# Automatic (Older AUR version)
yay -S genie-systemd

# generic shortcut
wsl.exe ~ -d Arch genie -s
# wsltty shortcut
C:\Users\ctran\AppData\Local\wsltty\bin\mintty.exe --WSL="Arch" --configdir="C:\Users\ctran\AppData\Roaming\wsltty" -~  genie -s

Arch pacman keys

sudo pacman-key --init
sudo pacman-key --populate archlinux
sudo pacman-key --refresh-keys
sudo pacman -S archlinux-keyring
pacman -S base-devel
git clone https://aur.archlinux.org/yay.git
cd yay && makepkg -si

NAT fix

# Required for Debian
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

cgroup fix

# Required for Debian and Ubuntu
sudo mkdir /sys/fs/cgroup/systemd
sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd

References

wsl.txt · Last modified: 2020/08/29 12:27 by jkendall