- Set up a WSL development environment
- Install Docker without Docker Desktop
- Install Docker Engine on Ubuntu
- After install:
sudo service docker start
Advanced settings configuration in WSL | Microsoft Learn
/etc/wsl.conf
contents:
[boot]
command = /etc/wsl-boot.sh
/etc/wsl-boot.sh
contents:
#!/bin/bash
service docker start
Make script executable:
chmod +x /etc/wsl-boot.sh
What Is the Vmmem Process in Windows Task Manager? Here's How to Fix Its High Resource Consumption
Create global WSL config in C:\Users\<UserName>\.wslconfig
and specify memory limit, for example 6 gigabytes:
[wsl2]
memory=6GB
- WSL2 Clock is out of sync with Windows - Stack Overflow
- Often happens after laptop sleep or hibernation.
$ date
Fri Jan 20 20:44:19 CET 2023
$ sudo hwclock -s
$ date
Mon Jan 23 13:30:07 CET 2023
TODO: proper solution, either NTP server sync or cron job.
xclip
is already installed on Ubuntu 22.04, but will not work.
To copy into Windows clipboard use clip.exe
instead, example:
echo 123 | clip.exe
Some CLI tools like pass
depend on xclip
or wl-copy
.
To make it work, make system-wide shim to clip.exe
:
Create /usr/local/bin/xclip
and /usr/local/bin/wl-copy
with contents:
#!/bin/sh
clip.exe
Make both executable: chmod +x /usr/local/bin/xclip /usr/local/bin/wl-copy
Now pass
running in WSL is able to copy your secret into Windows clipboard:
$ pass -c some-website/my-password
Copied some-website/my-password to clipboard. Will clear in 45 seconds.
Shim to open file under WSL in firefox which is running on host Windows.
Create /usr/local/bin/firefox
:
#!/bin/bash
WSL_HOST_PATH="file://///wsl.localhost/Ubuntu"
ARG=$(echo "$1" | sed -r "s|^(file://)?/|$WSL_HOST_PATH/|")
"/mnt/c/Program Files/Mozilla Firefox/firefox.exe" "$ARG"
Test:
firefox $HOME
# Should serve your home directory in browser.
# file://///wsl.localhost/Ubuntu/home/alex
/var/log/docker.log
failed to start daemon: Error initializing network controller: error obtaining controller instance: unable to add return rule in DOCKER-ISOLATION-STAGE-1 chain: (iptables failed: iptables --wait -A DOCKER-ISOLATION-STAGE-1 -j RETURN: iptables v1.8.7 (nf_tables): RULE_APPEND failed (No such file or directory): rule in chain DOCKER-ISOLATION-STAGE-1
(exit status 4))
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
WSL2 DNS stops working · Issue #4285 · microsoft/WSL
May be caused by conflicting IP ranges that WSL and Docker use.
Solution: add to or create /etc/docker/daemon.json
with:
{
"bip" : "10.99.0.1/16"
}
MTU is the largest packet or frame size, specified in octets (eight-bit bytes) that can be sent in a packet- or frame-based network.
- ssl - curl hangs after client hello - Unix & Linux Stack Exchange
- WSL2 fails to make HTTPS connection if Windows is using VPN · Issue #4698 · microsoft/WSL
Hangs out on TLS handshake, Client hello (1)
.
$ curl -v https://github.com
* Trying 140.82.121.3:443...
* Connected to github.com (140.82.121.3) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
Interface eth0
before:
$ ip link list
6: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:15:5d:89:cc:39 brd ff:ff:ff:ff:ff:ff
Changing MTU for eth0
:
sudo ip link set dev eth0 mtu 1300
Interface eth0
after:
$ ip link list
6: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1300 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:15:5d:89:cc:39 brd ff:ff:ff:ff:ff:ff
Find out suitable MTU size. You need greatest number that succeeds. Here MTU of size 1300 is being tested:
$ ping -c 1 -M do -s 1300 github.com
--- github.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 22.622/22.622/22.622/0.000 ms