From 5f95e33e2300d897554b90ae47cdd808c61edff9 Mon Sep 17 00:00:00 2001 From: Craig Loewen Date: Tue, 16 Apr 2024 15:42:13 -0400 Subject: [PATCH 01/16] Update wsl-config.md (#1949) --- WSL/wsl-config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WSL/wsl-config.md b/WSL/wsl-config.md index 8a2c6c0b..c23160d0 100644 --- a/WSL/wsl-config.md +++ b/WSL/wsl-config.md @@ -217,7 +217,7 @@ This file can contain the following options that affect the VM that powers any W | swap | size | 25% of memory size on Windows rounded up to the nearest GB | How much swap space to add to the WSL 2 VM, 0 for no swap file. Swap storage is disk-based RAM used when memory demand exceeds limit on hardware device. | | swapFile | path | `%USERPROFILE%\AppData\Local\Temp\swap.vhdx` | An absolute Windows path to the swap virtual hard disk. | | pageReporting | boolean | `true` | Default `true` setting enables Windows to reclaim unused memory allocated to WSL 2 virtual machine. | -| guiApplications | boolean* | `true` | Boolean to turn on or off support for GUI applications ([WSLg](https://github.com/microsoft/wslg)) in WSL. Only available for Windows 11.| +| guiApplications | boolean | `true` | Boolean to turn on or off support for GUI applications ([WSLg](https://github.com/microsoft/wslg)) in WSL.| | debugConsole | boolean* | `false` | Boolean to turn on an output console Window that shows the contents of `dmesg` upon start of a WSL 2 distro instance. Only available for Windows 11.| | nestedVirtualization | boolean* | `true` | Boolean to turn on or off nested virtualization, enabling other nested VMs to run inside WSL 2. Only available for Windows 11.| | vmIdleTimeout | number* | `60000` | The number of milliseconds that a VM is idle, before it is shut down. Only available for Windows 11.| From 60a755b3a69f22c3286953a9c134f6b6d359b8ed Mon Sep 17 00:00:00 2001 From: Matt Wojciakowski Date: Tue, 16 Apr 2024 15:49:03 -0400 Subject: [PATCH 02/16] Add kernel requirement for connect-usb.md (#1950) --- WSL/connect-usb.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/WSL/connect-usb.md b/WSL/connect-usb.md index 8a5d2920..e9f3c713 100644 --- a/WSL/connect-usb.md +++ b/WSL/connect-usb.md @@ -1,7 +1,7 @@ --- title: Connect USB devices description: Learn how to connect a USB device to your WSL 2 Linux distribution using usbipd-win. -ms.date: 01/04/2024 +ms.date: 04/16/2024 ms.topic: article --- @@ -20,7 +20,7 @@ Setting up the USB/IP project on your Windows machine will enable common develop > [!NOTE] > To check your Windows version and build number, select **Windows logo key + R**, type **winver**, select **OK**. You can update to the latest Windows version by selecting **Start** > **Settings** > **Windows Update** > **[Check for updates](ms-settings:windowsupdate)**. -> To check your Linux kernel version, open your Linux distribution and enter the command: `uname -a`. To manually update to the latest kernel, open PowerShell and enter the command: 'wsl --update`. +> To check your Linux kernel version, open your Linux distribution and enter the command: `uname -a`. To manually update to the latest kernel, open PowerShell and enter the command: `wsl --update`. > [!IMPORTANT] > WSL now supports both Windows 10 and Windows 11 via the Microsoft Store, meaning that Windows 10 users now have access to the latest kernel versions without needing to compile from source. See [WSL in the Microsoft Store is now generally available on Windows 10 and 11](https://devblogs.microsoft.com/commandline/the-windows-subsystem-for-linux-in-the-microsoft-store-is-now-generally-available-on-windows-10-and-11/) for info on how to update to the Store-supported version of WSL. If you are unable to update to the Store-supported version of WSL and automatically receive kernel updates, see the [USBIPD-WIN project repo](https://github.com/dorssel/usbipd-win/wiki/WSL-support) for instructions on connecting USB devices to a Linux distribution running on WSL 2 by building your own USBIP enabled WSL 2 kernel. @@ -29,6 +29,12 @@ Setting up the USB/IP project on your Windows machine will enable common develop Support for connecting USB devices is not natively available in WSL, so you will need to install the open-source usbipd-win project. +**Kernel requirements** + +To use USBIPD with Windows Subsystem for Linux (WSL), you need to have a [Linux kernel version of 5.10.60.1 or higher](https://github.com/dorssel/usbipd-win/wiki/WSL-support/6befeedd4c8e2a49468e4b03532c9a20478f8677). If the installed kernel version is older than 5.10.60.1, then it can be updated by first shutting down any running instances of WSL with `wsl --shutdown`, then running the command: `wsl --update`. + +**Install USBIPD on WSL** + 1. Go to the [latest release page for the usbipd-win project](https://github.com/dorssel/usbipd-win/releases). 2. Select the .msi file, which will download the installer. (You may get a warning asking you to confirm that you trust this download). 3. Run the downloaded usbipd-win_x.msi installer file. From 44f624ac8f11b4c6461ecb59b5540ff8c3cfa1f7 Mon Sep 17 00:00:00 2001 From: Keith Horton Date: Wed, 22 May 2024 10:44:31 -0700 Subject: [PATCH 03/16] Update networking.md (#1962) Adding the OS requirements for networking features to make it clear when the features are available. --- WSL/networking.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WSL/networking.md b/WSL/networking.md index 23779ad9..ae7ade5a 100644 --- a/WSL/networking.md +++ b/WSL/networking.md @@ -74,7 +74,7 @@ Using `listenaddress=0.0.0.0` will listen on all [IPv4 ports](https://stackoverf ## Mirrored mode networking -You can [set `networkingMode=mirrored` under `[wsl2]` in the `.wslconfig` file](./wsl-config.md#configuration-settings-for-wslconfig) to enable mirrored mode networking. Enabling this changes WSL to an entirely new networking architecture which has the goal of 'mirroring' the network interfaces that you have on Windows into Linux, to add new networking features and improve compatibility. +On machines running Windows 11 22H2 and higher you can [set `networkingMode=mirrored` under `[wsl2]` in the `.wslconfig` file](./wsl-config.md#configuration-settings-for-wslconfig) to enable mirrored mode networking. Enabling this changes WSL to an entirely new networking architecture which has the goal of 'mirroring' the network interfaces that you have on Windows into Linux, to add new networking features and improve compatibility. Here are the current benefits to enabling this mode: @@ -91,11 +91,11 @@ This new mode addresses networking issues seen with using a NAT (Network Address ## DNS Tunneling -Setting [`dnsTunneling=true` under `[wsl2]` in the `.wslconfig` file](./wsl-config.md#configuration-settings-for-wslconfig) has WSL use a virtualization feature to answer DNS requests from within WSL, instead of requesting them over a networking packet. This feature is aimed to improve compatibility with VPNs, and other complex networking set ups. +On machines running Windows 11 22H2 and higher, setting [`dnsTunneling=true` under `[wsl2]` in the `.wslconfig` file](./wsl-config.md#configuration-settings-for-wslconfig) has WSL use a virtualization feature to answer DNS requests from within WSL, instead of requesting them over a networking packet. This feature is aimed to improve compatibility with VPNs, and other complex networking set ups. ## Auto Proxy -Setting [`autoProxy=true` under `[wsl2]` in the `.wslconfig` file](./wsl-config.md#configuration-settings-for-wslconfig) enforces WSL to use Windows' HTTP proxy information. If you have a proxy already set up in Windows, enabling this feature will make that proxy be set automatically in WSL as well. +On machines running Windows 11 22H2 and higher, setting [`autoProxy=true` under `[wsl2]` in the `.wslconfig` file](./wsl-config.md#configuration-settings-for-wslconfig) enforces WSL to use Windows' HTTP proxy information. If you have a proxy already set up in Windows, enabling this feature will make that proxy be set automatically in WSL as well. ## WSL and firewall From 609a8ef26345167241bb2a58656666a307dbba58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C4=83t=C4=83lin=20Emil=20Fetoiu?= Date: Tue, 2 Jul 2024 14:06:11 -0700 Subject: [PATCH 04/16] Doc updates for dnsTunneling and autoProxy (#1970) * dns and proxy doc updates * add dnsTunnelingIpAddress setting * mention generateHosts option * move bullet point * rephrase docker desktop point --------- Co-authored-by: Catalin-Emil Fetoiu --- WSL/troubleshooting.md | 8 +++++--- WSL/wsl-config.md | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/WSL/troubleshooting.md b/WSL/troubleshooting.md index fc05283b..b2ec5a4a 100644 --- a/WSL/troubleshooting.md +++ b/WSL/troubleshooting.md @@ -267,6 +267,8 @@ When enabled, the following apply to proxy settings on your Linux distributions: - The Linux environment variable, `NO_PROXY`, is set to bypass any HTTP/S proxies found in the Windows configuration targets. - Every environment variable, except `WSL_PAC_URL`, is set to both lower case and upper case. For example: `HTTP_PROXY` and `http_proxy`. +There is a known issue caused by ZScaler configurations, where ZScaler repeatedly enables and disables Windows proxy configurations, leading to WSL repeatedly showing the "An Http proxy change has been detected on the host" notification. + Learn more in the Command Line blog: [WSL September 2023 update](https://devblogs.microsoft.com/commandline/windows-subsystem-for-linux-september-2023-update/#autoproxy). ### Networking considerations with DNS tunneling @@ -275,7 +277,6 @@ When WSL can’t connect to the internet, it might be because the DNS call to th DNS Tunneling can be configured using the `dnsTunneling` setting in the [experimental section of the WSL Configuration file](/windows/wsl/wsl-config#experimental-settings). When applying this setting, note these considerations: -- Native Docker can have connectivity issues in WSL when DNS tunneling is enabled – if the network has a policy to block DNS traffic to: 8.8.8.8 - If you use a VPN with WSL, turn on DNS tunneling. Many VPNs use NRPT policies, which are only applied to WSL DNS queries when DNS tunneling is enabled. - The `/etc/resolv.conf` file in your Linux distribution has a 3 DNS servers maximum limitation, while Windows may use more than 3 DNS servers. Using DNS tunneling removes this limitation – all Windows DNS servers can now be used by Linux. - WSL will use Windows DNS suffixes in the following order (similar to the order used by the Windows DNS client): @@ -283,8 +284,9 @@ DNS Tunneling can be configured using the `dnsTunneling` setting in the [experim 2. Supplemental DNS suffixes 3. Per-interface DNS suffixes 4. If DNS encryption (DoH, DoT) is enabled on Windows, encryption will be applied to DNS queries from WSL. If users want to enable DoH, DoT inside Linux, they need to disable DNS tunneling. -- DNS queries from Docker containers (either Docker Desktop or native Docker running in WSL) will bypass DNS tunneling. DNS tunneling cannot be leveraged to apply host DNS settings and policies to Docker DNS traffic. -- Docker Desktop has its own way (different from DNS tunneling) of applying host DNS settings and policies to DNS queries from Docker containers. +- DNS queries from Docker containers managed by Docker Desktop will bypass DNS tunneling. Docker Desktop has its own way (different from DNS tunneling) of applying host DNS settings and policies to DNS queries from Docker containers. +- In order for DNS tunneling to be succesfully enabled, the generateResolvConf option in the wsl.conf file should not be disabled. +- When DNS tunneling is enabled, the generateHosts option in the wsl.conf file is ignored (the Windows DNS hosts file is not copied in the Linux /etc/hosts file). The policies in the Windows hosts file will be applied to DNS queries from Linux, without the need for the file to be copied in Linux. Learn more in the Command Line blog: [WSL September 2023 update](https://devblogs.microsoft.com/commandline/windows-subsystem-for-linux-september-2023-update/#dns-tunneling). diff --git a/WSL/wsl-config.md b/WSL/wsl-config.md index c23160d0..16f34389 100644 --- a/WSL/wsl-config.md +++ b/WSL/wsl-config.md @@ -224,8 +224,8 @@ This file can contain the following options that affect the VM that powers any W | dnsProxy | bool | true | Only applicable to networkingMode = NAT. Boolean to inform WSL to configure the DNS Server in Linux to the NAT on the host. Setting to false will mirror DNS servers from Windows to Linux. | | networkingMode** | string | NAT | If the value is `mirrored` then this turns on mirrored networking mode. Default or unrecognized strings result in NAT networking. | | firewall** | bool | true | Setting this to true allows the Windows Firewall rules, as well as rules specific to Hyper-V traffic, to filter WSL network traffic. | -| dnsTunneling** | bool | false | Changes how DNS requests are proxied from WSL to Windows | -| autoProxy* | bool | false | Enforces WSL to use Windows’ HTTP proxy information | +| dnsTunneling** | bool | true | Changes how DNS requests are proxied from WSL to Windows | +| autoProxy* | bool | true | Enforces WSL to use Windows’ HTTP proxy information | Entries with the `path` value must be Windows paths with escaped backslashes, e.g: `C:\\Temp\\myCustomKernel` @@ -247,6 +247,7 @@ These settings are opt-in previews of experimental features that we aim to make |`sparseVhd`| bool | false | When set to true, any newly created VHD will be set to sparse automatically. | |`useWindowsDnsCache`**| bool | false | Only applicable when `wsl2.dnsTunneling` is set to true. When this option is set to false, DNS requests tunneled from Linux will bypass cached names within Windows to always put the requests on the wire. | |`bestEffortDnsParsing`**| bool | false | Only applicable when `wsl2.dnsTunneling` is set to true. When set to true, Windows will extract the question from the DNS request and attempt to resolve it, ignoring the unknown records. | +|`dnsTunnelingIpAddress`**| string | 10.255.255.254 | Only applicable when `wsl2.dnsTunneling` is set to true. Specifies the nameserver that will be configured in the Linux resolv.conf file when DNS tunneling is enabled. | |`initialAutoProxyTimeout`*| string | 1000 | Only applicable when `wsl2.autoProxy` is set to true. Configures how long (in milliseconds) WSL will wait for retrieving HTTP proxy information when starting a WSL container. If proxy settings are resolved after this time, the WSL instance must be restarted to use the retrieved proxy settings. | |`ignoredPorts`**| string | null | Only applicable when `wsl2.networkingMode` is set to `mirrored`. Specifies which ports Linux applications can bind to, even if that port is used in Windows. This enables applications to listen on a port for traffic purely within Linux, so those applications are not blocked even when that port is used for other purposes on Windows. For example, WSL will allow binding to port 53 in Linux for Docker Desktop, as it is listening only to requests from within the Linux container. Should be formatted in a comma separated list, e.g: `3000,9000,9090` | |`hostAddressLoopback`**| bool | false | Only applicable when `wsl2.networkingMode` is set to `mirrored`. When set to `True`, will allow the Container to connect to the Host, or the Host to connect to the Container, by an IP address that's assigned to the Host. The `127.0.0.1` loopback address can always be used,this option allows for all additionally assigned local IP addresses to be used as well. Only IPv4 addresses assigned to the host are supported. | From ede4321718962c238e04e2736d1885628d2fa729 Mon Sep 17 00:00:00 2001 From: FantasqueX Date: Thu, 4 Jul 2024 01:39:03 +0800 Subject: [PATCH 05/16] Fix docker run command (#1956) Current one will get error "/usr/bin/ls: /usr/bin/ls: cannot execute binary file" --- WSL/use-custom-distro.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WSL/use-custom-distro.md b/WSL/use-custom-distro.md index 92132f75..542648be 100644 --- a/WSL/use-custom-distro.md +++ b/WSL/use-custom-distro.md @@ -43,7 +43,7 @@ In this example, we'll use Docker inside of a WSL distribution to obtain the tar 3. Run the CentOS container inside Docker: ```bash - docker run -t centos bash ls / + docker run -t centos ls / ``` 4. Grab the CentOS container ID using grep and awk: From 1c664368ef45d0e4baa365ac06e1b45b3929dbb7 Mon Sep 17 00:00:00 2001 From: Craig Loewen Date: Tue, 16 Jul 2024 15:30:06 -0400 Subject: [PATCH 06/16] Updated production faq (#1954) --- WSL/faq.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WSL/faq.yml b/WSL/faq.yml index 852c6a94..4550370e 100644 --- a/WSL/faq.yml +++ b/WSL/faq.yml @@ -167,7 +167,7 @@ sections: - question: | Can I use WSL for production scenarios? answer: | - WSL has been designed and built to use with inner loop development workflows. There are design features in WSL that make it great for this purpose but may make it challenging for production-related scenarios compared to other products. Our goal is to make clear how WSL differs from a regular VM environment, so you can make the decision on whether it fits your business needs. + Yes, however WSL has been designed and built to use with inner loop development workflows. There are design features in WSL that make it great for this purpose but may make it challenging for production-related scenarios compared to other products. Our goal is to make clear how WSL differs from a regular VM environment, so you can make the decision on whether it fits your business needs. The main differences between WSL and a traditional production environment are: From f31a8879d2b1e48f9ea061e0f00e15ba8a8e047f Mon Sep 17 00:00:00 2001 From: Joshua Cooper Date: Tue, 16 Jul 2024 12:33:43 -0700 Subject: [PATCH 07/16] Update wsl-config.md (#1959) Matching the formatting of * near the Key column instead of the value column established lower in the table. --- WSL/wsl-config.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WSL/wsl-config.md b/WSL/wsl-config.md index 16f34389..676d1050 100644 --- a/WSL/wsl-config.md +++ b/WSL/wsl-config.md @@ -218,9 +218,9 @@ This file can contain the following options that affect the VM that powers any W | swapFile | path | `%USERPROFILE%\AppData\Local\Temp\swap.vhdx` | An absolute Windows path to the swap virtual hard disk. | | pageReporting | boolean | `true` | Default `true` setting enables Windows to reclaim unused memory allocated to WSL 2 virtual machine. | | guiApplications | boolean | `true` | Boolean to turn on or off support for GUI applications ([WSLg](https://github.com/microsoft/wslg)) in WSL.| -| debugConsole | boolean* | `false` | Boolean to turn on an output console Window that shows the contents of `dmesg` upon start of a WSL 2 distro instance. Only available for Windows 11.| -| nestedVirtualization | boolean* | `true` | Boolean to turn on or off nested virtualization, enabling other nested VMs to run inside WSL 2. Only available for Windows 11.| -| vmIdleTimeout | number* | `60000` | The number of milliseconds that a VM is idle, before it is shut down. Only available for Windows 11.| +| debugConsole* | boolean | `false` | Boolean to turn on an output console Window that shows the contents of `dmesg` upon start of a WSL 2 distro instance. Only available for Windows 11.| +| nestedVirtualization* | boolean | `true` | Boolean to turn on or off nested virtualization, enabling other nested VMs to run inside WSL 2. Only available for Windows 11.| +| vmIdleTimeout* | number | `60000` | The number of milliseconds that a VM is idle, before it is shut down. Only available for Windows 11.| | dnsProxy | bool | true | Only applicable to networkingMode = NAT. Boolean to inform WSL to configure the DNS Server in Linux to the NAT on the host. Setting to false will mirror DNS servers from Windows to Linux. | | networkingMode** | string | NAT | If the value is `mirrored` then this turns on mirrored networking mode. Default or unrecognized strings result in NAT networking. | | firewall** | bool | true | Setting this to true allows the Windows Firewall rules, as well as rules specific to Hyper-V traffic, to filter WSL network traffic. | From b2c28d6eeb0e88cfae8e137adc08b7c959402a9a Mon Sep 17 00:00:00 2001 From: Craig Loewen Date: Tue, 16 Jul 2024 15:35:20 -0400 Subject: [PATCH 08/16] Update about.md to fix small typo (#1983) Closes #1973 --- WSL/about.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WSL/about.md b/WSL/about.md index 1df9de93..5d653f31 100644 --- a/WSL/about.md +++ b/WSL/about.md @@ -9,7 +9,7 @@ ms.topic: article Windows Subsystem for Linux (WSL) is a feature of Windows that allows you to run a Linux environment on your Windows machine, without the need for a separate virtual machine or dual booting. WSL is designed to provide a seamless and productive experience for developers who want to use both Windows and Linux at the same time. -- Use WSL to install and run various Linux distributions, such as Ubuntu, Debian, Kali, and more. [Install Linux distributions](./install.md) and receive automatic updates from the [Microsoft Store](./compare-versions.md#wsl-in-the-microsoft-store), [import Linux distributions not available in the Microsoft Store](./use-custom-distro.md), or [build your own customer Linux distribution](./build-custom-distro.md). +- Use WSL to install and run various Linux distributions, such as Ubuntu, Debian, Kali, and more. [Install Linux distributions](./install.md) and receive automatic updates from the [Microsoft Store](./compare-versions.md#wsl-in-the-microsoft-store), [import Linux distributions not available in the Microsoft Store](./use-custom-distro.md), or [build your own custom Linux distribution](./build-custom-distro.md). - Store files in an isolated Linux file system, specific to the installed distribution. - Run command-line tools, such as BASH. - Run common BASH command-line tools such as `grep`, `sed`, `awk`, or other ELF-64 binaries. From 3b19bdfec588bca0959c1867a512fdecc6978bfa Mon Sep 17 00:00:00 2001 From: Craig Loewen Date: Tue, 16 Jul 2024 15:39:55 -0400 Subject: [PATCH 09/16] Update install-manual.md (#1981) --- WSL/install-manual.md | 1 + 1 file changed, 1 insertion(+) diff --git a/WSL/install-manual.md b/WSL/install-manual.md index 47bee86d..cfffc970 100644 --- a/WSL/install-manual.md +++ b/WSL/install-manual.md @@ -122,6 +122,7 @@ There are some scenarios in which you may not be able (or want) to, install WSL If the Microsoft Store app is not available, you can download and manually install Linux distributions using these links: - [Ubuntu](https://aka.ms/wslubuntu) +- [Ubuntu 24.04](https://wslstorestorage.blob.core.windows.net/wslblob/Ubuntu2404-240425.AppxBundle) - [Ubuntu 22.04 LTS](https://aka.ms/wslubuntu2204) - [Ubuntu 20.04](https://aka.ms/wslubuntu2004) - [Ubuntu 20.04 ARM](https://aka.ms/wslubuntu2004arm) From c120b7ed04c948f6bbb7774d61e0726e1e0e255c Mon Sep 17 00:00:00 2001 From: Craig Loewen Date: Tue, 16 Jul 2024 15:42:17 -0400 Subject: [PATCH 10/16] Update filesystems.md to clarify Linux path (#1984) --- WSL/filesystems.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WSL/filesystems.md b/WSL/filesystems.md index c565ba18..7d63ec93 100644 --- a/WSL/filesystems.md +++ b/WSL/filesystems.md @@ -16,7 +16,7 @@ We recommend against working across operating systems with your files, unless yo For example, when storing your WSL project files: -- Use the Linux file system root directory: `\\wsl$\Ubuntu\home\\Project` +- Use the Linux file system root directory: `/home//Project` - Not the Windows file system root directory: `/mnt/c/Users//Project$` or `C:\Users\\Project` When you see `/mnt/` in the file path of a WSL command line, it means that you are working from a mounted drive. So the Windows file system C:/ drive (`C:\Users\\Project`) will look like this when mounted in a WSL command line: `/mnt/c/Users//Project$`. It is possible to store your project files on a mounted drive, but your performance speed will improve if you store them directly on the `\\wsl$` drive. From 8bc2d12494ec9ce457727167792d0e83493a60f0 Mon Sep 17 00:00:00 2001 From: Craig Loewen Date: Tue, 16 Jul 2024 15:43:17 -0400 Subject: [PATCH 11/16] Update faq.yml to include note about setting username for moving distros (#1982) * Update faq.yml to include note about setting username for moving distros * Add set your default user account to faq --------- Co-authored-by: Matt Wojciakowski --- WSL/faq.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/WSL/faq.yml b/WSL/faq.yml index 4550370e..c5961109 100644 --- a/WSL/faq.yml +++ b/WSL/faq.yml @@ -2,8 +2,7 @@ metadata: title: FAQ's about Windows Subsystem for Linux description: "Find answers to frequently asked questions (FAQs) about the Windows Subsystem for Linux, such as 'What can I do with WSL?'." - keywords: BashOnWindows, bash, wsl, windows, windowssubsystem, faq - ms.date: 11/20/2023 + ms.date: 07/16/2024 ms.topic: faq ms.localizationpriority: high title: Frequently Asked Questions about Windows Subsystem for Linux @@ -209,8 +208,13 @@ sections: wsl --unregister # Import your VHD backup + wsl --import-in-place + # Set your default user account + + You can set up your default user account by [setting a wsl.conf value of user.default=](/windows/wsl/wsl-config#user-settings) + - name: WSL 2 questions: From d5bf098be506d5653ad1a9f3e28a68ec2b77146d Mon Sep 17 00:00:00 2001 From: Ben Hillis Date: Tue, 16 Jul 2024 13:19:24 -0700 Subject: [PATCH 12/16] Update wsl-config.md (#1951) * Update wsl-config.md Add a description for defaultVhdSize option. * Minor rewording * Add note about max related to issue --------- Co-authored-by: Matt Wojciakowski --- WSL/wsl-config.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/WSL/wsl-config.md b/WSL/wsl-config.md index 676d1050..ce284f64 100644 --- a/WSL/wsl-config.md +++ b/WSL/wsl-config.md @@ -1,7 +1,7 @@ --- title: Advanced settings configuration in WSL description: A guide to the wsl.conf and .wslconfig files used for configuring settings when running multiple Linux distributions on Windows Subsystem for Linux. -ms.date: 01/17/2024 +ms.date: 07/16/2024 ms.topic: article ms.custom: seo-windows-dev adobe-target: true @@ -224,8 +224,9 @@ This file can contain the following options that affect the VM that powers any W | dnsProxy | bool | true | Only applicable to networkingMode = NAT. Boolean to inform WSL to configure the DNS Server in Linux to the NAT on the host. Setting to false will mirror DNS servers from Windows to Linux. | | networkingMode** | string | NAT | If the value is `mirrored` then this turns on mirrored networking mode. Default or unrecognized strings result in NAT networking. | | firewall** | bool | true | Setting this to true allows the Windows Firewall rules, as well as rules specific to Hyper-V traffic, to filter WSL network traffic. | -| dnsTunneling** | bool | true | Changes how DNS requests are proxied from WSL to Windows | -| autoProxy* | bool | true | Enforces WSL to use Windows’ HTTP proxy information | +| dnsTunneling** | boolean | true | Changes how DNS requests are proxied from WSL to Windows | +| autoProxy* | boolean | true | Enforces WSL to use Windows’ HTTP proxy information | +| defaultVhdSize | size | `1TB` | Set the Virtual Hard Disk (VHD) size that stores the Linux distribution (for example, Ubuntu) file system. Can be used to limit the maximum size that a distribution file system is allowed to take up. | Entries with the `path` value must be Windows paths with escaped backslashes, e.g: `C:\\Temp\\myCustomKernel` From 7f51960830e3a4985a41b9b875139161c7653902 Mon Sep 17 00:00:00 2001 From: Craig Loewen Date: Tue, 16 Jul 2024 16:24:20 -0400 Subject: [PATCH 13/16] Update use-custom-distro.md (#1985) Fixes #1640 --- WSL/use-custom-distro.md | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/WSL/use-custom-distro.md b/WSL/use-custom-distro.md index 542648be..cdf22e87 100644 --- a/WSL/use-custom-distro.md +++ b/WSL/use-custom-distro.md @@ -34,29 +34,25 @@ In this example, we'll use Docker inside of a WSL distribution to obtain the tar 1. Open the command line (Bash) for a Linux distribution that you've already installed from the Microsoft Store (Ubuntu in this example). -2. Start the Docker service: - - ```bash - sudo service docker start - ``` +2. Ensure you have Docker Desktop running (Or if you have Docker installed in the WSL distro start the service with `sudo service docker start` ) 3. Run the CentOS container inside Docker: ```bash - docker run -t centos ls / + docker run -t --name wsl_export centos ls / ``` -4. Grab the CentOS container ID using grep and awk: +4. Export the container ID to a tar file on your mounted c-drive: ```bash - dockerContainerID=$(docker container ls -a | grep -i centos | awk '{print $1}') + docker export wsl_export > /mnt/c/temp/centos.tar ``` -5. Export the container ID to a tar file on your mounted c-drive: +5. Clean up the container - ```bash - docker export $dockerContainerID > /mnt/c/temp/centos.tar - ``` + ```bash + docker rm wsl_export + ``` ![Example of running the commands above](./media/run-any-distro-tarfile.png) From 99a82ad26842da5525defa1a0a97e426af6552a7 Mon Sep 17 00:00:00 2001 From: Jimm Chen <38829153+chjfth@users.noreply.github.com> Date: Wed, 17 Jul 2024 04:43:59 +0800 Subject: [PATCH 14/16] Extensively clarify "Identify IP address" section. (#1978) * Extensively clarify "Identify IP address" section. * Move IP address scenario explanation to Networking doc * Simplify commands and link to Networking page * Fix warning typo --------- Co-authored-by: Matt Wojciakowski --- WSL/basic-commands.md | 8 +++++--- WSL/networking.md | 44 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/WSL/basic-commands.md b/WSL/basic-commands.md index 3359fd25..d98a3401 100644 --- a/WSL/basic-commands.md +++ b/WSL/basic-commands.md @@ -156,7 +156,7 @@ For example: wsl --shutdown ``` -Immediately terminates all running distributions and the WSL 2 lightweight utility virtual machine. This command may be necessary in instances that require you to restart the WSL 2 virtual machine environment, such as [changing memory usage limits](/windows/wsl/disk-space) or making a change to your [.wslconfig file](./manage.md#). +Immediately terminates all running distributions and the WSL 2 lightweight utility virtual machine. This command may be necessary in instances that require you to restart the WSL 2 virtual machine environment, such as [changing memory usage limits](/windows/wsl/disk-space) or making a change to your [.wslconfig file](./manage.md). ## Terminate @@ -168,8 +168,10 @@ To terminate the specified distribution, or stop it from running, replace ` hostname -I +``` + +If querying the default distribution, this part of the command designating the distribution can be omitted: `-d `. Be sure to use a capital `-I` flag and not a lower-case `-i`. + +Under the hood, host command `wsl.exe` launches the target instance and executes Linux command `hostname -I`. This command then prints the IP address of the WSL instance to `STDOUT`. The `STDOUT` text content is then relayed back to wsl.exe. Finally, wsl.exe displays that output to the command line. + +A typical output might be: + +```powershell +172.30.98.229 +``` + +**Scenario Two:** A program running inside a Linux distribution via WSL2 (instance) wants to know the Windows host's IP address, so that a Linux program can connect to a Windows host server program. + +The WSL2 Linux user can use command: + +```bash +ip route show | grep -i default | awk '{ print $3}' +``` + +A typical output might be: + +``` +172.30.96.1 +``` + +So the `172.30.96.1` is the host IP address for Windows, in this example. + +> [!NOTE] +> These above IP address querying action is typically required when WSL2 is running with the default [NAT network mode](#default-networking-mode-nat). +> When the WSL2 is running with the new [mirrored mode](#mirrored-mode-networking), the Windows host and WSL2 VM can connect to each other using `localhost` (127.0.0.1) as the destination address, so the trick of using a query peer's IP address is not required. + ## Default networking mode: NAT By default, WSL uses a NAT (Network Address Translation) based architecture for networking. Keep the following considerations in mind when working with a NAT-based networking architecture: From 0e018b05b4361175cd77238b0bcf974e35202609 Mon Sep 17 00:00:00 2001 From: Matt Wojciakowski Date: Wed, 17 Jul 2024 12:36:32 -0700 Subject: [PATCH 15/16] Remove postman example Due to Postman security vulnerabilities --- WSL/systemd.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WSL/systemd.md b/WSL/systemd.md index 57ee6b53..47590728 100644 --- a/WSL/systemd.md +++ b/WSL/systemd.md @@ -1,7 +1,7 @@ --- title: Use systemd to manage Linux services with WSL description: Learn how to use systemd to manage Linux services with Windows Subsystem for Linux. -ms.date: 06/16/2023 +ms.date: 07/17/2024 ms.topic: article --- @@ -60,7 +60,7 @@ Microsoft partnered with Canonical to bring systemd support to WSL. See Craig Lo A few examples of Linux applications that depend on systemd are: -- [snap](https://snapcraft.io/): a software packaging and deployment system developed by Canonical for operating systems that use the Linux kernel and the systemd init system. The packages are called "snaps", the command line tool for building snaps is called "Snapcraft", the central repository where snaps can be downloaded/installed is called the "Snap Store", and the daemon required to run snaps (download from the store, mount into place, confine, and run apps out of them) is called "snapd". The entire system is sometimes referred to as "snappy." Try running the command: `snap install spotify` or `snap install postman`. +- [snap](https://snapcraft.io/): a software packaging and deployment system developed by Canonical for operating systems that use the Linux kernel and the systemd init system. The packages are called "snaps", the command line tool for building snaps is called "Snapcraft", the central repository where snaps can be downloaded/installed is called the "Snap Store", and the daemon required to run snaps (download from the store, mount into place, confine, and run apps out of them) is called "snapd". The entire system is sometimes referred to as "snappy." Try running the command: `snap install spotify`. - [microk8s](https://microk8s.io/): an open-source, low-ops, minimal production Kubernetes that automates deployment, scaling, and management of containerized apps. Follow the instructions to [Install MicroK8s on WSL2](https://microk8s.io/docs/install-wsl2), check out the [Get Started Tutorial](https://microk8s.io/docs/getting-started), or watch the video on [Kubernetes on Windows with MicroK8s and WSL 2](https://ubuntu.com/blog/kubernetes-on-windows-with-microk8s-and-wsl-2). From e084871f3428bae59d85ae78aa777610b49e5b22 Mon Sep 17 00:00:00 2001 From: Craig Loewen Date: Thu, 25 Jul 2024 12:32:50 -0400 Subject: [PATCH 16/16] Updated faq to include group policy fix (#1991) * Updated faq to include group policy fix * Apply concise language * Update WSL/faq.yml --------- Co-authored-by: Matt Wojciakowski --- WSL/faq.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/WSL/faq.yml b/WSL/faq.yml index c5961109..d021d4a5 100644 --- a/WSL/faq.yml +++ b/WSL/faq.yml @@ -294,3 +294,9 @@ sections: - Our [command-line team blog](https://devblogs.microsoft.com/commandline/) - Twitter. Please follow [@craigaloewen](https://twitter.com/craigaloewen) on Twitter to learn of news, updates, etc. + + - question: | + How to resolve `Error: 0x800704ec This program is blocked by group policy. For more information, contact your system administrator.`? + answer: | + This error is caused by a group policy blocking WSL. To resolve, first run the command `wsl --update` to update to the latest Store version. If that doesn't resolve the issue, contact your administrator. Learn more about the difference between the inbox WSL and Store version of WSL: [WSL in the Microsoft Store](/windows/wsl/compare-versions#wsl-in-the-microsoft-store). +