WSL: Difference between revisions

From Omnia
Jump to navigation Jump to search
Line 63: Line 63:
\\wsl.localhost\Ubuntu\
\\wsl.localhost\Ubuntu\
</pre>
</pre>
== Mount VHDX or VHD in WSL ==
Install Docker Desktop WSL2 on Windows with allocated maximum size (virtual size) less then default 1TB - Docker Desktop for Windows - Docker Community Forums
https://forums.docker.com/t/install-docker-desktop-wsl2-on-windows-with-allocated-maximum-size-virtual-size-less-then-default-1tb/135817/8
Is it possible to map a WSL mount into a docker container? Or use an EXT4 VHD with Docker in any other way? : r/docker
https://www.reddit.com/r/docker/comments/112b10k/is_it_possible_to_map_a_wsl_mount_into_a_docker/
Moving docker-desktop "distro" vhdx file - Docker Desktop for Windows - Docker Community Forums
https://forums.docker.com/t/moving-docker-desktop-distro-vhdx-file/137632/3
WSL2 mount VHDX virtual disk issue with Windows docker Volumes - Stack Overflow
https://stackoverflow.com/questions/65548924/wsl2-mount-vhdx-virtual-disk-issue-with-windows-docker-volumes
wsl --mount \\.\PHYSICALDRIVE2 --bare


== Issues ==
== Issues ==

Revision as of 20:49, 25 October 2024

Windows Subsystem for Linux

NOTE: THERE IS TOO MUCH OVERHEAD FOR WSL, DON'T ENABLE!

Enable

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

ref: https://www.tenforums.com/tutorials/46769-enable-disable-windows-subsystem-linux-wsl-windows-10-a.html

Disable

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

ref: https://www.tenforums.com/tutorials/46769-enable-disable-windows-subsystem-linux-wsl-windows-10-a.html

Install Ubuntu

wsl --install -d ubuntu

ref [1]

Basic Commands for WSL

Basic commands for WSL
https://learn.microsoft.com/en-us/windows/wsl/basic-commands

List Running

List running

wsl --list --running
# or
wsl -l --running

List all

wsl --list --all
wsl -l --all

Also open File Explorer, and click on the Linux in the Navigation Pane. [1]

Convert WSL and Windows Paths

$ wslpath
Usage:
    -a    force result to absolute path format
    -u    translate from a Windows path to a WSL path (default)
    -w    translate from a WSL path to a Windows path
    -m    translate from a WSL path to a Windows path, with '/' instead of '\'

EX: wslpath 'c:\users'

Windows path from WSL:

$ wslpath 'c:\users'
/mnt/c/users

WSL path from Windows:

$ wslpath -w '/'
\\wsl.localhost\Ubuntu\

Mount VHDX or VHD in WSL

Install Docker Desktop WSL2 on Windows with allocated maximum size (virtual size) less then default 1TB - Docker Desktop for Windows - Docker Community Forums
https://forums.docker.com/t/install-docker-desktop-wsl2-on-windows-with-allocated-maximum-size-virtual-size-less-then-default-1tb/135817/8
Is it possible to map a WSL mount into a docker container? Or use an EXT4 VHD with Docker in any other way? : r/docker
https://www.reddit.com/r/docker/comments/112b10k/is_it_possible_to_map_a_wsl_mount_into_a_docker/
Moving docker-desktop "distro" vhdx file - Docker Desktop for Windows - Docker Community Forums
https://forums.docker.com/t/moving-docker-desktop-distro-vhdx-file/137632/3
WSL2 mount VHDX virtual disk issue with Windows docker Volumes - Stack Overflow
https://stackoverflow.com/questions/65548924/wsl2-mount-vhdx-virtual-disk-issue-with-windows-docker-volumes


wsl --mount \\.\PHYSICALDRIVE2 --bare

Issues

Update fails with Forbidden (403)

C:\>wsl --update
Checking for updates.
Forbidden (403).
Error code: Wsl/UpdatePackage/0x80190193

Searches online indiate Defender (or other virus scanner may be to blame).

One suggests using --web-download:

wsl --update --web-download

ref: [2]

C:\>wsl --update
Checking for updates.
The most recent version of Windows Subsystem for Linux is already installed.

keywords