Skip to content

Commit b65a462

Browse files
mattwojoCarlos Niheltonzaochihthiruma0203Horsevad
authored
Main > Live (#2122)
* Final editorial review update (#2063) Fix oobe delete user path Rename best practices to recommendations Minor writing style updates * Fix backtick in build-custom-distro.md (#2062) * Remove the duplicate `feedback_product_url` value (#2040) * Update troubleshooting.md (#2034) Azure virtual machine does support Nested Virtualization, but cannot use with Trusted Launch. Hence proposing minor correction. * Update networking.md (#2033) Updated that the hostname takes a lowercase -i as the address flag. This can be seen by running hostname --help. also made the "under the hood" section more verbose with the full length ip-address command. * Add the information about the --pre-release option (#2031) * Add note for blocked Microsoft Store (#2030) * Add note for blocked Microsoft Store * Editorial update --------- Co-authored-by: Matt Wojciakowski <mattwoj@microsoft.com> * Add rule to ignore service account's contribute (#2039) * Update WSL shutdown instructions for clarity by specifying PowerShell should be run as administrator before executing the shutdown command. (#2028) * Update WSL shutdown instructions for clarity by specifying PowerShell should be run as administrator before executing the shutdown command. * Add Docker Desktop error recommendation --------- Co-authored-by: Matt Wojciakowski <mattwoj@microsoft.com> * Fix warnings (#2065) * Fix pytorch directml install command (#2066) Resolves #2044 * Add documentation for shortcut.enabled and windowsterminal.enabled (#2076) * Add documentation for shortcut.enabled and windowsterminal.enabled * Small fixes * chore: update wsl config docs (#2087) WSL default behaviour changed as of May 2024 * Put the whole command in a block (#2071) * Put the whole command in a block Without this change, the command gets inline and breaks at the beginning, confusing the reader, making them think the command begins by route instead of ip * Update WSL/networking.md --------- Co-authored-by: Craig Loewen <crloewen@microsoft.com> * Fix `contributors_to_exclude` did not work (#2068) * make sure the systemd-sysv package is installed (#1996) * make sure the systemd-sysv package is installed * Update WSL/systemd.md --------- Co-authored-by: Craig Loewen <crloewen@microsoft.com> * WSL/wsl-config.md: rewrite lead for clarity (#2021) * WSL/wsl-config.md: rewrite lead for clarity This is a rewrite of the lead section, as I feel the previous one was long-winded yet did not meaningfully summarize the most important points of the article. * Minor changes to this table format update --------- Co-authored-by: Matt Wojciakowski <mattwoj@microsoft.com> * Fixed typos (#2092) * Update wsl-database.md (#2096) * Update wsl-database.md Update the Microsoft SQL Server installation link to SQL Server on WSL 2 * Updated to fix link and streamline title. --------- Co-authored-by: Matt Wojciakowski <mattwoj@microsoft.com> * Update systemd.md (#2102) * Update systemd.md State that `wsl --version` command could throws an error if outdated and therefore it must be updated to make systemd working on the distribution. * Update formatting --------- Co-authored-by: Matt Wojciakowski <mattwoj@microsoft.com> * add section for wsl manage (#2107) * Update disk space expand command format (#2121) * Fix typo in troubleshooting.md (#2114) * Add platform id to feedback template * add kernelModules documentation (#2145) --------- Co-authored-by: Carlos Nihelton <carlosnsoliveira@gmail.com> Co-authored-by: Caozhi Li <git@licaoz.com> Co-authored-by: thiruma0203 <thiruma.msft@hotmail.com> Co-authored-by: Horsevad <Horsevad@users.noreply.github.com> Co-authored-by: Carlos Rafael Ramirez <crramirez@users.noreply.github.com> Co-authored-by: Chunyao Chan <24861096+Civon@users.noreply.github.com> Co-authored-by: Blue <OneBlue@users.noreply.github.com> Co-authored-by: alsi-lawr <alexlawrence1418@gmail.com> Co-authored-by: Craig Loewen <crloewen@microsoft.com> Co-authored-by: Zhoneym <140673973+Zhoneym@users.noreply.github.com> Co-authored-by: multiplealiases <conflictvegetable@protonmail.com> Co-authored-by: Lucas Dondo / Dondi <59975541+LucasDondo@users.noreply.github.com> Co-authored-by: Amit Khandelwal <119350246+amitkh-msft@users.noreply.github.com> Co-authored-by: Federico C. <24813315+fcucino@users.noreply.github.com> Co-authored-by: justus-camp-microsoft <campjustus@microsoft.com> Co-authored-by: Ally Zhang <931550270@qq.com> Co-authored-by: John Kennedy <jken@microsoft.com>
1 parent 78b0526 commit b65a462

10 files changed

Lines changed: 88 additions & 34 deletions

File tree

.github/ISSUE_TEMPLATE/doc-issue.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,10 @@ body:
6060
validations:
6161
required: true
6262
attributes:
63-
label: Document Id
63+
label: Document Id
64+
- type: input
65+
id: platformId
66+
validations:
67+
required: true
68+
attributes:
69+
label: Platform Id

WSL/build-custom-distro.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Build a Custom Linux Distro for WSL - Windows
33
description: Learn how to create a custom Linux distribution for Windows Subsystem for Linux.
4-
ms.date: 11/19/2024
4+
ms.date: 02/05/2025
55
ms.topic: article
66
---
77

@@ -49,9 +49,11 @@ defaultUid = 1000
4949
defaultName = my-distro
5050

5151
[shortcut]
52+
enabled = true
5253
icon = /usr/lib/wsl/my-icon.ico
5354

5455
[windowsterminal]
56+
enabled = true
5557
ProfileTemplate = /usr/lib/wsl/terminal-profile.json
5658
```
5759

@@ -63,6 +65,9 @@ WSL distribution file configuration options:
6365
| `oobe.defaultUid` | integer | `<none>` | The default UID that the distribution starts with. This is useful when the `oobe.command` script creates a new user. |
6466
| `oobe.defaultName`| string | `<none>` | The default name that the distribution is registered under. This default name can be replaced with the command: `wsl.exe --install <distro> --name <name>` |
6567
| `shortcut.icon` | string | The default WSL icon | The icon in the start menu shortcut for the distribution. Must be in `.ico` format with a maximum size of `10MB` |
68+
| `shortcut.enabled` | boolean | true | Whether a start menu shortcut should be created when the distribution is installed. |
69+
| `windowsterminal.profileTemplate` | string | `<none>` | The JSON template to generate a Windows Terminal profile for this distribution. |
70+
| `windowsterminal.enabled` | boolean | true | Whether a terminal profile should be created when the distribution is installed. If `profileTemplate` is not set, a default profile will be generated. |
6671
| `windowsterminal.profileTemplate` | string | Path to a terminal template file | The JSON template to generate a Windows Terminal profile for this distribution. |
6772

6873
You need to create an out of box experience (OOBE) first run experience for the distribution. Below is a sample bash script that you can use. This script assumes that `oobe.defaultUid` is set to `1000`:

WSL/compare-versions.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,25 @@ WSL 2 provides the benefits of WSL 1, including seamless integration between Win
5454

5555
### Full Linux kernel
5656

57-
The Linux kernel in WSL 2 is built by Microsoft from the latest stable branch, based on the source available at kernel.org. This kernel has been specially tuned for WSL 2, optimizing for size and performance to provide an amazing Linux experience on Windows. The kernel will be serviced by Windows updates, which means you will get the latest security fixes and kernel improvements without needing to manage it yourself.
57+
The Linux kernel in WSL 2 is built by Microsoft from the latest stable branch, based on the source available at [kernel.org](https://kernel.org). This kernel has been specially tuned for WSL 2, optimizing for size and performance to provide an amazing Linux experience on Windows. The kernel will be serviced by Windows updates, which means you will get the latest security fixes and kernel improvements without needing to manage it yourself.
5858

5959
The [WSL 2 Linux kernel is open source](https://github.com/microsoft/WSL2-Linux-Kernel). If you'd like to learn more, check out the blog post [Shipping a Linux Kernel with Windows](https://devblogs.microsoft.com/commandline/shipping-a-linux-kernel-with-windows/) written by the team that built it.
6060

6161
Learn more in the [Release Notes for Windows Subsystem for Linux kernel](./kernel-release-notes.md).
6262

6363
### Increased file IO performance
6464

65-
File intensive operations like git clonenpm installapt updateapt upgrade, and more are all noticeably faster with WSL 2.
65+
File intensive operations like `git clone``npm install``apt update``apt upgrade`, and more are all noticeably faster with WSL 2.
6666

67-
The actual speed increase will depend on which app you're running and how it is interacting with the file system. Initial versions of WSL 2 run up to 20x faster compared to WSL 1 when unpacking a zipped tarball, and around 2-5x faster when using git clonenpm install and cmake on various projects.
67+
The actual speed increase will depend on which app you're running and how it is interacting with the file system. Initial versions of WSL 2 run up to 20x faster compared to WSL 1 when unpacking a zipped tarball, and around 2-5x faster when using `git clone``npm install` and `cmake` on various projects.
6868

6969
### Full system call compatibility
7070

7171
Linux binaries use system calls to perform functions such as accessing files, requesting memory, creating processes, and more. Whereas WSL 1 used a translation layer that was built by the WSL team, WSL 2 includes its own Linux kernel with full system call compatibility. Benefits include:
7272

7373
- A whole new set of apps that you can run inside of WSL, such as **[Docker](tutorials/wsl-containers.md)** and more.
7474

75-
- Any updates to the Linux kernel are immediately ready for use. (You don't have to wait for the WSL team to implement updates and add the changes).
75+
- Any updates to the Linux kernel are immediately ready for use (you don't have to wait for the WSL team to implement updates and add the changes).
7676

7777
## Exceptions for using WSL 1 rather than WSL 2
7878

@@ -82,21 +82,21 @@ We recommend that you use WSL 2 as it offers faster performance and 100% system
8282
- If you will be using your WSL Linux distribution to access project files on the Windows file system, and these files cannot be stored on the Linux file system, you will achieve faster performance across the OS files systems by using WSL 1.
8383
- A project which requires cross-compilation using both Windows and Linux tools on the same files.
8484
- File performance across the Windows and Linux operating systems is faster in WSL 1 than WSL 2, so if you are using Windows applications to access Linux files, you will currently achieve faster performance with WSL 1.
85-
- Your project needs access to a serial port or USB device. *However,* USB device support is now available for WSL 2 via the USBIPD-WIN project. See [Connect USB devices](./connect-usb.md) for set up steps.
85+
- Your project needs access to a serial port or USB device. *However,* USB device support is now available for WSL 2 via the `USBIPD-WIN` project. See [Connect USB devices](./connect-usb.md) for set up steps.
8686
- WSL 2 does not include support for accessing serial ports. Learn more in the [FAQs](./faq.yml#can-i-access-the-gpu-in-wsl-2--are-there-plans-to-increase-hardware-support-) or in [WSL GitHub repo issue on serial support](https://github.com/microsoft/WSL/issues/4322).
8787
- You have strict memory requirements
8888
- WSL 2's memory usage grows and shrinks as you use it. When a process frees memory this is automatically returned to Windows. However, as of right now WSL 2 does not yet release cached pages in memory back to Windows until the WSL instance is shut down. If you have long running WSL sessions, or access a very large amount of files, this cache can take up memory on Windows. We are tracking the work to improve this experience on [the WSL GitHub repository issue 4166](https://github.com/microsoft/WSL/issues/4166).
8989
- For those using VirtualBox, be sure to use the latest version of both VirtualBox and WSL 2. See the [related FAQ](./faq.yml#will-i-be-able-to-run-wsl-2-and-other-3rd-party-virtualization-tools-such-as-vmware--or-virtualbox-).
90-
- If you rely on a Linux distribution to have an IP address in the same network as your host machine, you may need to set up a workaround in order to run WSL 2. WSL 2 is running as a hyper-v virtual machine. This is a change from the bridged network adapter used in WSL 1, meaning that WSL 2 uses a Network Address Translation (NAT) service for its virtual network, instead of making it bridged to the host Network Interface Card (NIC) resulting in a unique IP address that will change on restart. To learn more about the issue and workaround that forwards TCP ports of WSL 2 services to the host OS, see [WSL GitHub repository issue 4150, NIC Bridge mode (TCP Workaround)](https://github.com/microsoft/WSL/issues/4150).
90+
- If you rely on a Linux distribution to have an IP address in the same network as your host machine, you may need to set up a workaround in order to run WSL 2. WSL 2 is running as a Hyper-V virtual machine. This is a change from the bridged network adapter used in WSL 1, meaning that WSL 2 uses a Network Address Translation (NAT) service for its virtual network, instead of making it bridged to the host Network Interface Card (NIC) resulting in a unique IP address that will change on restart. To learn more about the issue and workaround that forwards TCP ports of WSL 2 services to the host OS, see [WSL GitHub repository issue 4150, NIC Bridge mode (TCP Workaround)](https://github.com/microsoft/WSL/issues/4150).
9191

9292
> [!NOTE]
9393
> Consider trying the VS Code [Remote WSL Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl) to enable you to store your project files on the Linux file system, using Linux command line tools, but also using VS Code on Windows to author, edit, debug, or run your project in an internet browser without any of the performance slow-downs associated with working across the Linux and Windows file systems. [Learn more](tutorials/wsl-vscode.md).
9494
9595
## WSL in the Microsoft Store
9696

97-
WSL has lifted the update functionality out of the Windows OS Image into a package that is available via the Microsoft Store. This means faster updates and servicing as soon as they're available, rather than needing to wait for an update of your Windows operating system.
97+
WSL has lifted the update functionality out of the Windows OS image into a package that is available via the Microsoft Store. This means faster updates and servicing as soon as they're available, rather than needing to wait for an update of your Windows operating system.
9898

99-
WSL was originally included in the Windows operating system as an optional component that need to be enabled in order to install a Linux distribution. WSL in the Store has the same user experience, and is the same product, but receives updates and servicing as a store package, rather than as an entire OS update. Beginning in Windows version 19044 or higher, running the `wsl.exe --install` command will install the WSL servicing update from the Microsoft Store. ([See the blog post announcing this update](https://devblogs.microsoft.com/commandline/the-windows-subsystem-for-linux-in-the-microsoft-store-is-now-generally-available-on-windows-10-and-11/)). If you are already using WSL, you can update to ensure that you're receiving the latest WSL features and servicing from the store by running `wsl.exe --update`.
99+
WSL was originally included in the Windows operating system as an optional component that need to be enabled in order to install a Linux distribution. WSL in the Store has the same user experience, and is the same product, but receives updates and servicing as a store package, rather than as an entire OS update. Beginning in Windows version 19044 or higher, running the `wsl.exe --install` command will install the WSL servicing update from the Microsoft Store. ([See the blog post announcing this update](https://devblogs.microsoft.com/commandline/the-windows-subsystem-for-linux-in-the-microsoft-store-is-now-generally-available-on-windows-10-and-11)). If you are already using WSL, you can update to ensure that you're receiving the latest WSL features and servicing from the store by running `wsl.exe --update`.
100100

101101
> [!NOTE]
102102
> If the Microsoft Store is inaccessible within your organization, you can still utilize this WSL version by appending `--web-download` to the `--update` command, such as `wsl --update --web-download`. You need to manually update WSL every time a new release becomes available using this method.

WSL/disk-space.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: How to manage WSL disk space
33
description: Learn how to check the amount of disk space available, expand the size of the Virtual Hard Disk (VHD), repair a VHD mounting or read-only error, and locate the .vhdx file and disk path for Linux distributions installed with WSL 2.
4-
ms.date: 11/19/2024
4+
ms.date: 02/05/2025
55
ms.topic: article
66
---
77

@@ -45,7 +45,32 @@ If you see that you are near to reaching the available amount of disk space allo
4545

4646
## How to expand the size of your WSL 2 Virtual Hard Disk
4747

48-
To expand the VHD size for a Linux distribution beyond the **default 1TB maximum** amount of allocated disk space, follow the steps below. *(For earlier WSL releases that have not yet been updated, this max default may be set to 512GB or 256GB).*
48+
To expand the VHD size for a Linux distribution beyond the default 1TB maximum amount of allocated disk space, you can use the `wsl --manage` command or follow the manual steps below. (Earlier WSL releases max default may be set to 512GB or 256GB).
49+
50+
### Expand VHD size using `wsl --manage`
51+
52+
The `wsl --manage` command is only available to WSL releases 2.5 and higher.
53+
54+
To resize the allocated space on your virtual disk:
55+
56+
1. Terminate all WSL instances using the command `wsl.exe --shutdown`
57+
58+
2. Run `wsl --manage <distribution name> --resize <memory string>`. Supported memory strings are of the form `<Memory Value>B/M/MB/G/GB/T/TB`. Decimal values are currently unsupported (e.g. `2.5TB`).
59+
60+
Output should look similar to the following:
61+
62+
```bash
63+
e2fsck 1.46.5 (30-Dec-2021)
64+
Pass 1: Checking inodes, blocks, and sizes
65+
resize2fs 1.46.5 (30-Dec-2021)
66+
The operation completed successfully.
67+
```
68+
69+
The virtual drive (ext4.vhdx) for this Linux distribution has now successfully been expanded to the new size.
70+
71+
### Manual expansion
72+
73+
To expand the VHD size for a Linux distribution using manual steps:
4974

5075
1. Terminate all WSL instances using the command: `wsl.exe --shutdown`
5176

@@ -112,7 +137,7 @@ old_desc_blocks = 32, new_desc_blocks = 38
112137
The filesystem on /dev/sdb is now 78643200 (4k) blocks long.
113138
```
114139

115-
The virtual drive (ext4.vhdx) for this Linux distribution has now successfully been expanded to the new size.
140+
The virtual drive (ext4.vhdx) for this Linux distribution has now successfully been expanded to the new size.
116141

117142
> [!IMPORTANT]
118143
> We recommend that you do not modify, move, or access the WSL related files located inside of your `AppData` folder using Windows tools or editors. Doing so could cause your Linux distribution to become corrupted. If you would like to access your Linux files from Windows, that is possible via the path `\\wsl$\<distribution-name>\`. Open your WSL distribution and enter `explorer.exe .` to view that folder. To learn more, see the blog post: [Accessing Linux files from Windows](https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-windows-10-version-1903/#accessing-linux-files-from-windows).

WSL/docfx.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@
5151
"ms.author": "mattwoj",
5252
"ms.reviewer": "crloewen",
5353
"searchScope": ["WSL"],
54-
"adobe-target": true
54+
"adobe-target": true,
55+
"contributors_to_exclude": [
56+
"VSC-Service-Account"
57+
]
5558
},
5659
"contributors_to_exclude": [
5760
"VSC-Service-Account"

WSL/networking.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ If you are building a networking app (for example an app running on a NodeJS or
6464

6565
If you want to access a networking app running on Windows (for example an app running on a NodeJS or SQL server) from your Linux distribution (ie Ubuntu), then you need to use the IP address of your host machine. While this is not a common scenario, you can follow these steps to make it work.
6666

67-
1. Obtain the IP address of your host machine by running this command from your Linux distribution: `ip route show | grep -i default | awk '{ print $3}'`
67+
1. Obtain the IP address of your host machine by running this command from your Linux distribution:
68+
```bash
69+
ip route show | grep -i default | awk '{ print $3}'`
70+
```
6871
2. Connect to any Windows server using the copied IP address.
6972

7073
The picture below shows an example of this by connecting to a Node.js server running in Windows via curl.

WSL/systemd.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Use systemd to manage Linux services with WSL
33
description: Learn how to use systemd to manage Linux services with Windows Subsystem for Linux.
4-
ms.date: 07/17/2024
4+
ms.date: 01/13/2025
55
ms.topic: article
66
---
77

@@ -25,7 +25,10 @@ Systemd is [now the default for the current version of Ubuntu](https://canonical
2525

2626
To enable systemd for any other Linux distributions running on WSL 2 (changing the default from using the systemv init):
2727

28-
1. Ensure that your WSL version is 0.67.6 or newer. (To check, run `wsl --version`. To update, run `wsl --update` or [download the latest version from the Microsoft Store](https://aka.ms/wslstorepage).)
28+
1. Ensure that your WSL version is 0.67.6 or newer:
29+
30+
- to check, run `wsl --version`; if the command throws `Invalid command line option: --version` error, you must update WSL;
31+
- to update, run `wsl --update` or [download the latest version from the Microsoft Store](https://aka.ms/wslstorepage).
2932

3033
2. Open a command line for your Linux distribution and enter `cd /` to access the root directory, then `ls` to list the files. You will see a directory named "etc" that contains the WSL configuration file for the distribution. Open this file so that you can make an update with the Nano text editor by entering: `nano /etc/wsl.conf`.
3134

@@ -36,11 +39,19 @@ To enable systemd for any other Linux distributions running on WSL 2 (changing t
3639
systemd=true
3740
```
3841

39-
4. Exit the Nano text editor (Ctrl + X, select Y to save your change). You will then need to close the Linux distribution. You can use the command `wsl.exe --shutdown` in PowerShell to restart all WSL instances.
42+
![Enable systemd on WSL 2](media/systemd-enable.png)
43+
44+
4. Exit the Nano text editor (Ctrl + X, type Y to save your change and confirm with the `enter` key).
45+
46+
5. You will then need to close the Linux distribution. You can use the command `wsl.exe --shutdown` in PowerShell to restart all WSL instances.
47+
48+
6. Once you restart the Linux distribution, systemd will be running. You can verify it by using the command `systemctl status` to show the _running_ state and the command `systemctl list-unit-files --type=service`, which will show the status of any services associated with your Linux distribution.
4049

41-
![Enable systemd on WSL 2](media/systemd-enable.png)
50+
If your Linux distribution is Debian/Ubuntu/Kali Rolling, you should not only have installed the systemd package, but also make sure the systemd-sysv package is installed.
4251

43-
Once your Linux distribution restarts, systemd will be running. You can confirm using the command: `systemctl list-unit-files --type=service`, which will show the status of any services associated with your Linux distribution.
52+
```bash
53+
sudo apt-get update -y && sudo apt-get install systemd systemd-sysv -y
54+
```
4455

4556
Learn more about [Advanced settings configuration in WSL](wsl-config.md), including the difference between the `wsl.conf` (distribution-specific) and `.wslconfig` (global) config files, how to update automount settings, etc.
4657

WSL/troubleshooting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ You can also:
6363
3. The WSL executable is only installed to the native system directory. When you’re running a 32-bit process on 64-bit Windows (or on ARM64, any non-native combination), the hosted non-native process actually sees a different System32 folder. (The one a 32-bit process sees on x64 Windows is stored on disk at \Windows\SysWOW64.) You can access the "native" system32 from a hosted process by looking in the virtual folder: `\Windows\sysnative`. It won’t actually be present on disk, mind you, but the filesystem path resolver will find it.
6464

6565
- **Error: This update only applies to machines with the Windows Subsystem for Linux.**
66-
- To install the Linux kernel update MSI package, WSL is required and should be enabled first. If it fails, it you will see the message: `This update only applies to machines with the Windows Subsystem for Linux`.
66+
- To install the Linux kernel update MSI package, WSL is required and should be enabled first. If it fails, you will see the message: `This update only applies to machines with the Windows Subsystem for Linux`.
6767
- There are three possible reason you see this message:
6868

6969
1. You are still in old version of Windows which doesn't support WSL 2. See step #2 for version requirements and links to update.

0 commit comments

Comments
 (0)