Skip to content

Commit 5ce1bee

Browse files
authored
Resolve conflict in wsl-config.md (#2190)
1 parent b65a462 commit 5ce1bee

1 file changed

Lines changed: 29 additions & 31 deletions

File tree

WSL/wsl-config.md

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
---
22
title: Advanced settings configuration in WSL
33
description: A guide to the wsl.conf and .wslconfig files used for configuring settings when running multiple Linux distributions on Windows Subsystem for Linux.
4-
ms.date: 12/16/2024
4+
ms.date: 05/19/2025
55
ms.topic: article
6-
ms.custom: seo-windows-dev
7-
adobe-target: true
86
---
97

108
# Advanced settings configuration in WSL
@@ -62,12 +60,12 @@ You will then need to close your WSL distribution using `wsl.exe --shutdown` fro
6260

6361
wsl.conf section label: `[automount]`
6462

65-
| key | value | default | notes |
63+
| Key | Value | Default | Notes |
6664
|:-----------|:---------|:--------|:------|
67-
| `enabled` | boolean | `true` | `true` causes fixed drives (i.e `C:/` or `D:/`) to be automatically mounted with DrvFs under `/mnt`. `false` means drives won't be mounted automatically, but you could still mount them manually or via `fstab`. |
68-
| `mountFsTab` | boolean | `true` | `true` sets `/etc/fstab` to be processed on WSL start. /etc/fstab is a file where you can declare other filesystems, like an SMB share. Thus, you can mount these filesystems automatically in WSL on start up. |
69-
| `root`| string | `/mnt/` | Sets the directory where fixed drives will be automatically mounted. By default this is set to `/mnt/`, so your Windows file system C-drive is mounted to `/mnt/c/`. If you change `/mnt/` to `/windir/`, you should expect to see your fixed C-drive mounted to `/windir/c`.|
70-
| `options` | comma-separated list of values, such as uid, gid, etc, see automount options below | empty string | The automount option values are listed below and are appended to the default DrvFs mount options string. **Only DrvFs-specific options can be specified.**|
65+
| `enabled` | boolean | `true` | `true` causes fixed drives (i.e `C:/` or `D:/`) to be automatically mounted with DrvFs under `/mnt`. `false` means drives won't be mounted automatically, but you could still mount them manually or via `fstab`. |
66+
| `mountFsTab` | boolean | `true` | `true` sets `/etc/fstab` to be processed on WSL start. /etc/fstab is a file where you can declare other filesystems, like an SMB share. Thus, you can mount these filesystems automatically in WSL on start up. |
67+
| `root` | string | `/mnt/` | Sets the directory where fixed drives will be automatically mounted. By default this is set to `/mnt/`, so your Windows file system C-drive is mounted to `/mnt/c/`. If you change `/mnt/` to `/windir/`, you should expect to see your fixed C-drive mounted to `/windir/c`. |
68+
| `options` | comma-separated list of values, such as uid, gid, etc, see automount options below | `""` | The automount option values are listed below and are appended to the default DrvFs mount options string. **Only DrvFs-specific options can be specified.** |
7169

7270
The automount options are applied as the mount options for all automatically mounted drives. To change the options for a specific drive only, use the `/etc/fstab` file instead. Options that the mount binary would normally parse into a flag are not supported. If you want to explicitly specify those options, you must include every drive for which you want to do so in `/etc/fstab`.
7371

@@ -77,17 +75,17 @@ Setting different mount options for Windows drives (DrvFs) can control how file
7775

7876
| Key | Description | Default |
7977
|:----|:----|:----|
80-
| `uid` | The User ID used for the owner of all files | The default User ID of your WSL distro (on first installation this defaults to 1000)
81-
| `gid` | The Group ID used for the owner of all files | The default group ID of your WSL distro (on first installation this defaults to 1000)
82-
| `umask` | An octal mask of permissions to exclude for all files and directories | `022`
83-
| `fmask` | An octal mask of permissions to exclude for all files | `000`
84-
| `dmask` | An octal mask of permissions to exclude for all directories | `000`
85-
| `metadata` | Whether metadata is added to Windows files to support Linux system permissions | `disabled`
86-
| `case` | Determines directories treated as case sensitive and whether new directories created with WSL will have the flag set. See [case sensitivity](./case-sensitivity.md) for a detailed explanation of the options. Options include `off`, `dir`, or `force`. | `off`
78+
| `uid` | The User ID used for the owner of all files | The default User ID of your WSL distro (on first installation this defaults to 1000) |
79+
| `gid` | The Group ID used for the owner of all files | The default group ID of your WSL distro (on first installation this defaults to 1000) |
80+
| `umask` | An octal mask of permissions to exclude for all files and directories | `022` |
81+
| `fmask` | An octal mask of permissions to exclude for all files | `000` |
82+
| `dmask` | An octal mask of permissions to exclude for all directories | `000` |
83+
| `metadata` | Whether metadata is added to Windows files to support Linux system permissions | `disabled` |
84+
| `case` | Determines directories treated as case sensitive and whether new directories created with WSL will have the flag set. See [case sensitivity](./case-sensitivity.md) for a detailed explanation of the options. Options include `off`, `dir`, or `force`. | `off` |
8785

8886
By default, WSL sets the uid and gid to the value of the default user. For example, in Ubuntu, the default user is uid=1000, gid=1000. If this value is used to specify a different gid or uid option, the default user value will be overwritten. Otherwise, the default value will always be appended.
8987

90-
User file-creation mode mask (umask) sets permission for newly created files. The default is 022, only you can write data but anyone can read data. Values can be changed to reflect different permission settings. For example, `umask=077` changes permission to be completely private, no other user can read or write data. To further specify permission, fmask (files) and dmask (directories) can also be used.
88+
The above umask, fmask, etc. options will only apply when the Windows drive is mounted with metadata. By default metadata is not enabled. You can [find more info about this here](./file-permissions).
9189

9290
> [!NOTE]
9391
> The permission masks are put through a logical OR operation before being applied to files or directories.
@@ -100,7 +98,7 @@ DrvFs is a filesystem plugin to WSL that was designed to support interop between
10098

10199
wsl.conf section label: `[network]`
102100

103-
| key | value | default | notes|
101+
| Key | Value | Default | Notes |
104102
|:----|:----|:----|:----|
105103
| `generateHosts` | boolean | `true` | `true` sets WSL to generate `/etc/hosts`. The `hosts` file contains a static map of hostnames corresponding IP address. |
106104
| `generateResolvConf` | boolean | `true` | `true` sets WSL to generate `/etc/resolv.conf`. The `resolv.conf` contains a DNS list that are capable of resolving a given hostname to its IP address. |
@@ -112,7 +110,7 @@ wsl.conf section label: `[interop]`
112110

113111
These options are available in Insider Build 17713 and later.
114112

115-
| key | value | default | notes|
113+
| Key | Value | Default | Notes |
116114
|:----|:----|:----|:----|
117115
| `enabled` | boolean | `true` | Setting this key will determine whether WSL will support launching Windows processes. |
118116
| `appendWindowsPath` | boolean | `true` | Setting this key will determine whether WSL will add Windows path elements to the $PATH environment variable. |
@@ -123,7 +121,7 @@ wsl.conf section label: `[user]`
123121

124122
These options are available in Build 18980 and later.
125123

126-
| key | value | default | notes|
124+
| Key | Value | Default | Notes |
127125
|:----|:----|:----|:----|
128126
| `default` | string | The initial username created on first run | Setting this key specifies which user to run as when first starting a WSL session. |
129127

@@ -133,9 +131,9 @@ The Boot setting is only available on Windows 11 and Server 2022.
133131

134132
wsl.conf section label: `[boot]`
135133

136-
| key | value | default | notes|
134+
| Key | Value | Default | Notes |
137135
|:----|:----|:----|:----|
138-
| `command` | string | "" | A string of the command that you would like to run when the WSL instance starts. This command is run as the root user. e.g: `service docker start`.|
136+
| `command` | string | `""` | A string of the command that you would like to run when the WSL instance starts. This command is run as the root user. e.g: `service docker start`. |
139137

140138
### Example wsl.conf file
141139

@@ -203,28 +201,28 @@ This file can contain the following options that affect the VM that powers any W
203201

204202
.wslconfig section label: `[wsl2]`
205203

206-
| key | value | default | notes|
204+
| Key | Value | Default | Notes |
207205
|:----|:----|:----|:----|
208206
| `kernel` | path | The Microsoft built kernel provided inbox | An absolute Windows path to a custom Linux kernel. |
209207
| `kernelModules` | path | An absolute Windows path to a custom Linux kernel modules VHD. |
210208
| `memory` | size | 50% of total memory on Windows | How much memory to assign to the WSL 2 VM. |
211209
| `processors` | number | The same number of logical processors on Windows | How many logical processors to assign to the WSL 2 VM. |
212210
| `localhostForwarding` | boolean | `true` | Boolean specifying if ports bound to wildcard or localhost in the WSL 2 VM should be connectable from the host via `localhost:port`. |
213-
| `kernelCommandLine` | string | Blank | Additional kernel command line arguments. |
214-
| `safeMode` | boolean | `false` | Run WSL in "Safe Mode" which disables many features and is intended to be used to recover distributions that are in bad states. Only available for Windows 11 and WSL version 0.66.2+. |
215-
| `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. |
211+
| `kernelCommandLine` | string | `""` | Additional kernel command line arguments. |
212+
| `safeMode`* | boolean | `false` | Run WSL in "Safe Mode" which disables many features and is intended to be used to recover distributions that are in bad states. Only available for Windows 11 and WSL version 0.66.2+. |
213+
| `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. |
216214
| `swapFile` | path | `%USERPROFILE%\AppData\Local\Temp\swap.vhdx` | An absolute Windows path to the swap virtual hard disk. |
217215
| `pageReporting` | boolean | `true` | Default `true` setting enables Windows to reclaim unused memory allocated to WSL 2 virtual machine. |
218-
| `guiApplications` | boolean | `true` | Boolean to turn on or off support for GUI applications ([WSLg](https://github.com/microsoft/wslg)) in WSL.|
219-
| `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.|
220-
| `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.|
221-
| `vmIdleTimeout`* | number | `60000` | The number of milliseconds that a VM is idle, before it is shut down. Only available for Windows 11.|
216+
| `guiApplications` | boolean | `true` | Boolean to turn on or off support for GUI applications ([WSLg](https://github.com/microsoft/wslg)) in WSL. |
217+
| `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. |
218+
| `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. |
219+
| `vmIdleTimeout`* | number | `60000` | The number of milliseconds that a VM is idle, before it is shut down. Only available for Windows 11. |
222220
| `dnsProxy` | boolean | `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. |
223221
| `networkingMode`** | string | `NAT` | If the value is `mirrored` then this turns on mirrored networking mode. Default or unrecognized strings result in NAT networking. |
224222
| `firewall`** | boolean | `true` | Setting this to true allows the Windows Firewall rules, as well as rules specific to Hyper-V traffic, to filter WSL network traffic. |
225223
| `dnsTunneling`** | boolean | `true` | Changes how DNS requests are proxied from WSL to Windows |
226224
| `autoProxy`* | boolean | `true` | Enforces WSL to use Windows’ HTTP proxy information |
227-
| `defaultVhdSize` | size | `1099511627776` (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. |
225+
| `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. |
228226

229227
Entries with the `path` value must be Windows paths with escaped backslashes, e.g: `C:\\Temp\\myCustomKernel`
230228

@@ -240,7 +238,7 @@ These settings are opt-in previews of experimental features that we aim to make
240238

241239
.wslconfig section label: `[experimental]`
242240

243-
| Setting name | Value | Default | Notes |
241+
| Key | Value | Default | Notes |
244242
|:----|:----|:----|:----|
245243
|`autoMemoryReclaim`| string | `dropCache` | Automatically releases cached memory after detecting idle CPU usage. Set to `gradual` for slow release, and `dropCache` for instant release of cached memory. |
246244
|`sparseVhd`| bool | `false` | When set to true, any newly created VHD will be set to sparse automatically. |

0 commit comments

Comments
 (0)