You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 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)
---------
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>
Copy file name to clipboardExpand all lines: WSL/build-custom-distro.md
+37-37Lines changed: 37 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Build a Custom Linux Distro for WSL - Windows
3
3
description: Learn how to create a custom Linux distribution for Windows Subsystem for Linux.
4
-
ms.date: 11/18/2024
4
+
ms.date: 11/19/2024
5
5
ms.topic: article
6
6
---
7
7
@@ -14,8 +14,7 @@ WSL distributions have two parts:
14
14
1) A root filesystem (distributed as a tar file)
15
15
2) A manifest entry (which contains the distribution metadata)
16
16
17
-
> [!NOTE]
18
-
> This guide only applies to [WSL release 2.4.4](https://github.com/microsoft/WSL/releases) and higher.
17
+
This guide only applies to [WSL release 2.4.4](https://github.com/microsoft/WSL/releases) and higher.
19
18
20
19
> [!NOTE]
21
20
> See [this repository](https://github.com/microsoft/WSL-DistroLauncher) for the previous appx based distribution packaging instructions.
@@ -64,12 +63,12 @@ WSL distribution file configuration options:
64
63
|`oobe.defaultUid`| integer |`<none>`| The default UID that the distribution starts with. This is useful when the `oobe.command` script creates a new user. |
65
64
|`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>`|
66
65
|`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`|
67
-
|‘windowsterminal.profileTemplate` | string | Path to a terminal template file | The JSON template to generate a Windows Terminal profile for this distribution. |
66
+
|`windowsterminal.profileTemplate`| string | Path to a terminal template file | The JSON template to generate a Windows Terminal profile for this distribution. |
68
67
69
68
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`:
70
69
71
70
```bash
72
-
#!/bin/bash
71
+
#!/bin/bash
73
72
74
73
set -ue
75
74
@@ -95,7 +94,7 @@ while true; do
95
94
if /usr/sbin/usermod "$username" -aG "$DEFAULT_GROUPS";then
96
95
break
97
96
else
98
-
/usr/bin/deluser "$username"
97
+
/usr/sbin/deluser "$username"
99
98
fi
100
99
fi
101
100
done
@@ -105,7 +104,7 @@ done
105
104
106
105
WSL automatically generates a Windows Terminal profile when a distribution is installed. Distribution maintainers can customize the generated profile generated by setting ` windowsterminal.profileTemplate` in the WSL configuration file, `/etc/wsl-distribution.conf`.
107
106
108
-
The json file follows [the terminal profile json format](https://learn.microsoft.com/en-us/windows/terminal/json-fragment-extensions#structure-of-the-json-files). Here’s an example profile:
107
+
The json file follows [the terminal profile json format](/windows/terminal/json-fragment-extensions#structure-of-the-json-files). Here’s an example profile:
109
108
110
109
```
111
110
@@ -156,15 +155,15 @@ systemd=true|false
156
155
157
156
The distribution author determines whether systemd is enabled by default by setting the `boot.systemd` value to `true` (enabled) or `false` (not enabled).
158
157
159
-
See the [best practices section](#systemd) if you chose to enable systemd by default.
158
+
See the [Systemd recommendations](#systemd-recommendations) if you chose to enable systemd by default.
160
159
161
-
See [Advanced settings configuration in WSL](./wsl-config#wslconf) for all supported settings in `/etc/wsl.conf`.
160
+
See [Advanced settings configuration in WSL](./wsl-config.md) for all supported settings in `/etc/wsl.conf`.
162
161
163
162
### Create the tar file
164
163
165
-
Once the distribution and configuration files are in place, the root filesystem can be captured in tar.
164
+
Once the distribution and configuration files are in place, the root filesystem can be captured in the tar file.
166
165
167
-
Below is the recommended way of creating the tar:
166
+
The recommended way of creating the tar file:
168
167
169
168
```
170
169
$ cd /path/to/rootfs
@@ -175,27 +174,27 @@ The root of the tar should be the root of the filesystem (not a directory contai
175
174
176
175
The recommended compression format is gzip. Other compression formats run the risk of breaking compatibility with older WSL versions.
177
176
178
-
See the [best practices section](#configuration-files) for files that should, or shouldn't be included
177
+
See the [Configuration file recommendations](#configuration-file-recommendations) for a list of files that should and shouldn't be included in the configuration.
179
178
180
-
To obtain a TAR file of an existing Linux distribution, find guidance on how to export a docker container in [Import any Linux distribution to use with WSL](./use-custom-distro.md).
179
+
To obtain a tar file of an existing Linux distribution, find guidance on how to export a docker container in [Import any Linux distribution to use with WSL](./use-custom-distro.md).
181
180
182
-
Once the tar file archive is ready, see [Overriding the distribution manifest](#adding-your-distro-to-wsl---install-for-your-enterprise-or-group) to try it out locally.
181
+
Once the tar file archive is ready, see [Test the distribution locally](#test-the-distribution-locally) to try it out locally.
183
182
184
183
## Create a .wsl file extension
185
184
186
-
The final step, once you have create a TAR file to represent your custom Linux distribution, is to change the `.tar` file file extension to a `.wsl` file extension by renaming it. Renaming this file extension will mark it as a WSL distribution. Once the TAR has be renamed from `.tar` to `.wsl`, the file will install correctly on Windows when opened (double-clicked) in File Explorer. A `oobe.defaultName` entry is required in the `/etc/wsl-distribution.conf` file for this double-click experience to function properly
185
+
The final step, once you have create a tar file to represent your custom Linux distribution, is to change the `.tar` file extension to a `.wsl` file extension by renaming it. Renaming this file extension will mark it as a WSL distribution. Once the tar has be renamed from `.tar` to `.wsl`, the file will install correctly on Windows when opened (double-clicked) in File Explorer. A `oobe.defaultName` entry is required in the `/etc/wsl-distribution.conf` file for this double-click experience to function properly.
187
186
188
187
## Distribute your WSL distribution
189
188
190
-
WSL users can view available distributions by running `wsl --list --online` and can install them directly with `wsl --install <distroName>` (replacing <distroName> with the actual name of the Linux distribution. This process is controlled by a distribution manifest file. You can add this manifest file to your customer Linux distribution for it to be included in the `wsl --install` command options.
189
+
WSL users can view available distributions by running `wsl --list --online` and can install them directly with `wsl --install <distroName>` (replacing `<distroName>` with the actual name of the Linux distribution. This process is controlled by a distribution manifest file. You can add this manifest file to your customer Linux distribution for it to be included in the `wsl --install` command options.
191
190
192
-
The custom Linux distribution TAR that you’ve created and renamed with a `.wsl` file extension can be distributed however you please. Once downloaded a user can install it directly from the command line with `wsl --install --from-file <fileLocation>` (replacing <fileLocation> with the actual location of the file). Alternatively, the `.wsl` file for your custom WSL distribution can be opened by double-clicking it.
191
+
The custom Linux distribution tar that you’ve created and renamed with a `.wsl` file extension can be distributed however you please. Once downloaded a user can install it directly from the command line with `wsl --install --from-file <fileLocation>` (replacing `<fileLocation>` with the actual location of the file). Alternatively, the `.wsl` file for your custom WSL distribution can be opened by double-clicking it.
193
192
194
193
## Distribution manifest details
195
194
196
195
The [distribution manifest](https://github.com/microsoft/WSL/blob/master/distributions/DistributionInfo.json) contains metadata about the distributions that are available for installation via `wsl --install <distribution>`.
197
196
198
-
TAR based distributions are listed under `ModernDistribution`, with the below format:
197
+
Linux distributions that are tar-based are listed under `ModernDistribution`, with the below format:
## Adding your distro to `wsl --install` for all WSL users
253
+
## Adding your distribution to `wsl --install` for all WSL users
255
254
256
-
To make your WSL distro available to all users, please open a pull request on the [WSL GitHub repository](github.com/microsoft/wsl) that modifies the [DistributionInfo.json](https://github.com/microsoft/WSL/blob/master/distributions/DistributionInfo.json) file to include your distro information.
255
+
To make your WSL distribution available to all users, open a pull request on the [WSL GitHub repository](https://github.com/microsoft/wsl) that modifies the [DistributionInfo.json](https://github.com/microsoft/WSL/blob/master/distributions/DistributionInfo.json) file to include your distribution information.
257
256
258
257
This pull request will be reviewed by the WSL team.
259
258
260
-
## Adding your distro to `wsl --install` for your enterprise or group
259
+
## Adding your distribution to `wsl --install` for your enterprise or business group
261
260
262
-
You can also make your distro available in `wsl --install` only to a select group by editing registry keys on chosen machines.
261
+
You can also make your distribution available in `wsl --install` only to a select group by editing registry keys on the chosen Windows devices.
263
262
264
263
The WSL distribution manifest can be overridden by creating registry values in `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss`.
265
264
266
265
-`DistributionListUrl`: Overrides the distribution manifest URL
267
266
-`DistributionListUrlAppend`: Add distributions from that manifest URL to the list of installable distributions
268
267
269
268
Both registry values are strings (REG_SZ) and are expected to be in URL format.
270
-
Starting with WSL 2.4.4, the `file://` protocol is supported to make local testing easier. The expected format is: `file:///C:/path/to/file`
271
269
272
-
### Testing a local distribution
270
+
Starting with WSL release 2.4.4, the `file://` protocol is supported to make local testing easier. The expected format is: `file:///C:/path/to/file`.
271
+
272
+
### Test the distribution locally
273
273
274
274
To test a distribution tar, you can use the following sample powershell script to override the distribution manifest with the new distribution. First save the script below as `override-manifest.ps1`:
Then configure the local manifest by running the following command in an elevated powershell:
314
+
Then configure the local manifest by running the following command in an elevated Powershell:
315
315
316
316
```powershell
317
317
.\override-manifest.ps1 -TarPath /path/to/tar
318
318
```
319
319
320
-
Once completed, you should see the following output from `wsl.exe --list --online`
320
+
Once completed, you should see the following output from `wsl.exe --list --online`:
321
321
322
322
```powershell
323
323
$ wsl --list --online
@@ -332,22 +332,22 @@ You can then run `wsl.exe --install test-distro-v1` to try the installation of t
332
332
333
333
When you're done, you can delete `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss\DistributionListUrl` to revert to the official manifest.
334
334
335
-
## Best practices
335
+
## WSL custom Linux distribution recommendations
336
336
337
-
### Configuration files
337
+
### Configuration file recommendations
338
338
339
-
-`/etc/wsl.conf` and `/etc/wsl-distribution.conf`should be included. They should be owned by `root:root` and their permissions should be `0644`
340
-
- If `oobe.command` is used to create a new user, its uid should be `1000`, and should `oobe.defaultUid` should be set to that value.
341
-
-`oobe.defaultName` and `shortcut.icon`should be specified in`/etc/wsl-distribution.conf`
342
-
-`/etc/resolv.conf`should NOT be included in the root filesystem
343
-
-There should be a root user in `/etc/passwd` and its uidshould be `0`
344
-
- There should be no password hashes in `/etc/shadow`
345
-
- The archive should not contain a kernel or an initramfs
339
+
-Ensure that your custom distribution includes both the `/etc/wsl.conf` and `/etc/wsl-distribution.conf`configuration files. Both files should be owned by `root:root` and their permissions should be `0644`.
340
+
- If the `oobe.command`setting is used to create a new user, both `uid` and `oobe.defaultUid` should be set to `1000`.
341
+
-Ensure that you set both `oobe.defaultName` and `shortcut.icon`in the distribution configuration file:`/etc/wsl-distribution.conf`
342
+
-Do not include the file `/etc/resolv.conf` in the root filesystem.
343
+
-Do include a root user in `/etc/passwd`. The `uid` for this root user should be `0`.
344
+
- There should be no password hashes in `/etc/shadow`.
345
+
- The archive should not contain a kernel or an initramfs.
346
346
347
-
### Systemd
347
+
### Systemd recommendations
348
348
349
349
If systemd is enabled, units that can cause issues with WSL should be disabled or masked.
350
-
The below units that are known to cause issues in WSL distributions (applies to both system and user units):
350
+
The below units are known to cause issues in WSL distributions (applies to both system and user units):
Copy file name to clipboardExpand all lines: WSL/compare-versions.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Comparing WSL Versions
3
3
description: WSL 2 provides the benefits of WSL 1, but uses an actual Linux kernel, rather than a translation layer like WSL 1, resulting in faster performance.
4
-
ms.date: 11/20/2023
4
+
ms.date: 11/19/2024
5
5
ms.topic: conceptual
6
6
ms.custom: seo-windows-dev
7
7
---
@@ -97,3 +97,6 @@ We recommend that you use WSL 2 as it offers faster performance and 100% system
97
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.
98
98
99
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`.
100
+
101
+
> [!NOTE]
102
+
> 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.
Copy file name to clipboardExpand all lines: WSL/disk-space.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: How to manage WSL disk space
3
3
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.
To repair a disk mount error in WSL, and restore it back to a usable / writeable state again, you can use the `wsl.exe --mount` command to re-mount the disk with the following steps:
164
164
165
-
1. Shutdown all WSL distributions by opening PowerShell and entering the command:
165
+
1. Shutdown all WSL distributions by opening PowerShell as administrator (in an elevated command prompt) and entering the command:
166
166
167
167
```powershell
168
168
wsl.exe --shutdown
169
169
```
170
170
171
-
2. Open PowerShell as administrator (in an elevated command prompt) and enter the mount command, replacing `<path-to-ext4.vhdx>` with the path to the distribution's .vhdx file. For help locating this file, see [How to locate the VHD file and disk path for your Linux distribution](#how-to-locate-the-vhdx-file-and-disk-path-for-your-linux-distribution).
171
+
2. Enter the mount command and replace `<path-to-ext4.vhdx>` with the path to the distribution's .vhdx file. For help locating this file, see [How to locate the VHD file and disk path for your Linux distribution](#how-to-locate-the-vhdx-file-and-disk-path-for-your-linux-distribution).
172
172
173
173
```powershell
174
174
wsl.exe --mount <path-to-ext4.vhdx> --vhd --bare
@@ -181,7 +181,7 @@ To repair a disk mount error in WSL, and restore it back to a usable / writeable
181
181
```
182
182
183
183
> [!NOTE]
184
-
> If you only have a single Linux distribution installed, you may encounter an "ext file in use" error and will need to [install](./basic-commands.md#install) an additional distribution in order to run `wsl.exe lsblk`. You can [uninstall](./basic-commands.md#unregister-or-uninstall-a-linux-distribution) the distribution once the repair is complete.
184
+
> If you only have a single Linux distribution installed, you may encounter an "ext file in use" error and will need to [install](./basic-commands.md#install) an additional distribution in order to run `wsl.exe lsblk`. You can [uninstall](./basic-commands.md#unregister-or-uninstall-a-linux-distribution) the distribution once the repair is complete. Additionally, you may need to close Docker Desktop on Windows to avoid the error `Wsl/Service/CreateInstance/MountVhd/HCS/ERROR_SHARING_VIOLATION` while running the command `wsl.exe sudo e2fsck -f /dev/sdc`.
185
185
186
186
4. Once the repair is complete, unmount the disk in PowerShell by entering:
Copy file name to clipboardExpand all lines: WSL/install.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,6 +105,8 @@ Try the most recent features or updates to WSL by joining the [Windows Insiders
105
105
- Beta channel: Ideal for early adopters, more reliable builds than the Dev channel.
106
106
- Release Preview channel: Preview fixes and key features on the next version of Windows just before its available to the general public.
107
107
108
+
If you prefer not switching your Windows installation to a preview channel, you can still test the latest preview of WSL by issuing the command: `wsl --update --pre-release`. For more information check the [WSL Releases page on GitHub](https://github.com/Microsoft/WSL/releases).
109
+
108
110
## Additional resources
109
111
110
112
-[Windows Command Line Blog: Install WSL with a single command now available in Windows 10 version 2004 and higher](https://devblogs.microsoft.com/commandline/install-wsl-with-a-single-command-now-available-in-windows-10-version-2004-and-higher/)
0 commit comments