Skip to content

Commit 8c5c2ea

Browse files
Added .wslconfig changes to wsl-config.md (#669)
* Added .wslconfig changes to wsl-config.md * Updated info in wsl-config.md
1 parent 9f6a60b commit 8c5c2ea

1 file changed

Lines changed: 40 additions & 6 deletions

File tree

WSL/wsl-config.md

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ For example:
211211

212212
To reinstall, find the distribution in the Microsoft store and select "Launch".
213213

214-
## Configure launch settings with wslconf
214+
## Configure per distro launch settings with wslconf
215215

216216
> **Available in Windows Build 17093 and later**
217217
@@ -237,13 +237,13 @@ generateHosts = true
237237
generateResolvConf = true
238238
```
239239

240-
## Configuration Options
240+
### Configuration Options
241241

242242
In keeping with .ini conventions, keys are declared under a section.
243243

244244
WSL supports two sections: `automount` and `network`.
245245

246-
### automount
246+
#### automount
247247

248248
Section: `[automount]`
249249

@@ -258,7 +258,7 @@ By default, WSL sets the uid and gid to the value of the default user (in Ubuntu
258258

259259
**Note:** These options are applied as the mount options for all automatically mounted drives. To change the options for a specific drive only, use /etc/fstab instead.
260260

261-
### Mount options
261+
#### Mount options
262262

263263
Setting different mount options for Windows drives (DrvFs) can control how file permissions are calculated for Windows files. The following options are available:
264264

@@ -272,7 +272,7 @@ Setting different mount options for Windows drives (DrvFs) can control how file
272272

273273
**Note:** The permission masks are put through a logical OR operation before being applied to files or directories.
274274

275-
### network
275+
#### network
276276

277277
Section label: `[network]`
278278

@@ -281,7 +281,7 @@ Section label: `[network]`
281281
| generateHosts | boolean | `true` | `true` sets WSL to generate `/etc/hosts`. The `hosts` file contains a static map of hostnames corresponding IP address. |
282282
| generateResolvConf | boolean | `true` | `true` set 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. |
283283

284-
### interop
284+
#### interop
285285

286286
Section label: `[interop]`
287287

@@ -291,3 +291,37 @@ These options are available in Insider Build 17713 and later.
291291
|:----|:----|:----|:----|
292292
| enabled | boolean | `true` | Setting this key will determine whether WSL will support launching Windows processes. |
293293
| appendWindowsPath | boolean | `true` | Setting this key will determine whether WSL will add Windows path elements to the $PATH environment variable. |
294+
295+
#### user
296+
297+
Section label: `[user]`
298+
299+
These options are available in Build 18980 and later.
300+
301+
| key | value | default | notes|
302+
|:----|:----|:----|:----|
303+
| default | string | The initial username created on first run | Setting this key specifies which user to run as when first starting a WSL session. |
304+
305+
## Configure global options with .wslconfig
306+
307+
> **Available in Windows Build 19041 and later**
308+
309+
You can configure global WSL options by placing a `.wslconfig` file into the root directory of your users folder: `C:\Users\<yourUserName>\.wslconfig`. This file can contain the following options:
310+
311+
### WSL 2 Settings
312+
313+
These settings affect the VM that powers any WSL 2 distribution.
314+
315+
| key | value | default | notes|
316+
|:----|:----|:----|:----|
317+
| kernel | string | The Microsoft built kernel provided inbox | An absolute Windows path to a custom Linux kernel. |
318+
| memory | size | 80% of your total memory on Windows | How much memory to assign to the WSL 2 VM. |
319+
| processors | number | The same number of processors on Windows | How many processors to assign ot the WSL 2 VM. |
320+
| 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. |
321+
| kernelCommandLine | string | Blank | Additional kernel command line arguments. |
322+
| 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. |
323+
| swapFile | size | %USERPROFILE%\AppData\Local\Temp\swap.vhdx | An absolute Windows path to the swap virtual hard disk. |
324+
325+
Entries with the `path` value must be Windows paths with escaped backslashes, e.g: `C:\\Temp\\myCustomKernel`
326+
327+
Entries with the `size` value must be a size followed by a unit, for example `8GB` or `512MB`.

0 commit comments

Comments
 (0)