This year
2023
WSL2 File System Goes Into Read Only Mode Without Warning · Issue #8340 · microsoft/WSL
by ghisShutdown WSL
In powershell as administrator, run:
Write-Output ".PhysicalDrive$((Mount-VHD -Path ./ext4.vhdx -PassThru | Get-Disk).Number)"
Then attach without mounting in another WSL distro, e.g.:
wsl -d Ubuntu-22.04 --mount .PhysicalDrive1 --bare
Launch this distro:
wsl -d Ubuntu-22.04
Find the block device using command `lsblk` (e.g. /dev/sdb)
Run e2fsck: `sudo e2fsck -f /dev/sdb`
Detach the file from WSL: `wsl --unmount .PhysicalDrive1`
Detach the VHD file from Windows: `Dismount-VHD -Path ./ext4.vhdx` or from Disk Management GUI
If at any point, there are some errors, try stopping Hyper-V service from Hyper-V Manager GUI, then launching Hyper-V Management Service from Windows Services GUI.
2022
Reduce WSL2 Disk Usage - Blog - LoadForge
by ghis (via)This guide covers reducing your actual Linux install size (typically Ubuntu) as well as freeing up space the WSL2 virtual hard disks use.
2021
Troubleshooting the Windows Subsystem for Linux | Microsoft Docs
by ghis (via)If after connecting to a VPN on Windows, bash loses network connectivity, try this workaround from within bash. This workaround will allow you to manually override the DNS resolution through /etc/resolv.conf.
Take a note of the DNS server of the VPN from doing ipconfig.exe /all
Make a copy of the existing resolv.conf sudo cp /etc/resolv.conf /etc/resolv.conf.new
Unlink the current resolv.conf sudo unlink /etc/resolv.conf
sudo mv /etc/resolv.conf.new /etc/resolv.conf
Open /etc/resolv.conf and
a. Delete the first line from the file, which says "# This file was automatically generated by WSL. To stop automatic generation of this file, remove this line.".
b. Add the DNS entry from (1) above as the very first entry in the list of DNS servers.
c. Close the file.
Once you have disconnected the VPN, you will have to revert the changes to /etc/resolv.conf. To do this, do:
cd /etc
sudo mv resolv.conf resolv.conf.new
sudo ln -s ../run/resolvconf/resolv.conf resolv.conf
docker service will not start on Debian on wsl2 · Discussion #4872 · microsoft/WSL
by ghis (via)Solves issue with running docker under WSL2
1
(10 marks)