with apologies

WSL2 / Windows 11

Richard Mortier · March 13, 2023 · #old #tech #wsl2

I naively thought I could just use WSL2 on Windows on my new laptop. But it turned out this was the year of Linux on the Laptop for me. For posterity here’s the crib sheet though.

wsl --set-default-version 2
sudo apt update && sudo apt upgrade -yy

sudo apt install locales
sudo locale-gen en_GB.UTF-8

sudo apt install -yy emacs-gtk direnv gedit
git clone ./..rc-files
./scripts/install.sh

Some Windows native packages using Chocolatey

choco install signal skype wire slack zoom
choco install git
choco install rustup.install rust-analyzer python
choco install docker
choco install powertyos dropbox googledrive wiztree

However, choco install texlive didn’t work so well, so I fell back to WSL2: sudo apt install latexmk texlive-latex-base texlive-xetex ttf-mscorefonts-installer.

Use MS Powertoys to remap keyboard for CAPSLOCK, .

Timesync is a bit broken, cf https://stackoverflow.com/a/72318510.

Unfortunately it all went pear-shaped when I tried to rsync files across from MacOS into Windows/WSL2.

I mapped the network drive via Network and Sharing Center > Settings > Network & internet > Advanced network settings > Advanced sharing settings > Public networks > Network discovery = ON

…and then


for d in admin christs docs rc-files research src teaching me ; do
  echo "=== $d" 
  rsync -uavzsP --log-file=$d.$(date -Iseconds) -e ssh mort@IPADDRESS:/Users/mort/$d/ ./$d 
done

…but found that moving files to the host mashed things a bit (rw bits carried, but x not; hidden files not; no content translation; owner carried) while moving host files to wsl was sort-of ok (owner carried, rw bits carried) except that group and other access bits are all set to whatever the user access bits were.

See https://stackoverflow.com/questions/41513597/how-do-i-access-the-wsl-linux-file-system-from-windows for more, perahps.

https://www.howtogeek.com/193013/how-to-create-an-encrypted-container-file-with-bitlocker-on-windows/

Getting Docker installed was also rather painful:

# remove old distribution dockers
sudo apt remove docker.io containerd runc && sudo apt autoremove

# install dependencies to use an alternative package repo
sudo apt-get update && sudo apt-get install ca-certificates curl gnupg lsb-release

# install the new package repo
sudo mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# install up-to-date Docker
sudo apt-get update && sudo apt-get install \
  docker-ce \
  docker-ce-cli \
  containerd.io \
  docker-buildx-plugin \
  docker-compose-plugin

Finally, some further references that may or may not be useful: