Search notes:

/etc/wsl.conf

/etc/wsl.conf is the configuration file for a distribution running in Windows Subsystem for Linux.
Changing the file apparently requires to restart the subsystem:
C\:> wsl --shutdown

Example

[automount]

# Set to true will automount fixed (Windows) drives (C:/ or D:/) with DrvFs under the root directory set above.
# Set to false means drives won't be mounted automatically, but need to be mounted manually or with fstab.
  enabled = true

# Sets the directory where fixed drives will be automatically mounted.
# Using the slash as mounts C:\ to /c, rather than the default /mnt/c. 
# root = /

# DrvFs-specific options:
#   My user id and group id are both 1000 (reported by command id), so set them here with
#   uid= and gid=
#   case=off seems to turn of case sensitivity in DrvFS.
  options = "metadata,uid=1000,gid=1000,umask=077,fmask=011,case=off"

# Process /etc/fstab when a WSL distribution is launched.
  mountFsTab = true

[network]
# Network host settings that enable the DNS server used by WSL 2.

# Specify hostname (overwrites content of /etc/hostname)
  hostname = DemoHost

# Setting generateHosts to false prevents WSL from the default behavior of auto-generating /etc/hosts
# The default is true
  generateHosts = false

# Setting generateResolvConf to false prevents WSL from auto-generating /etc/resolv.conf, so that I
# can use a nameserver of my own choice, for example 8.8.8.8
# The default is true
  generateResolvConf = false

[interop]

# Block launching Windows processing:
  enabled = false

# Do not add %PATH% to `$PATH`:
  appendWindowsPath = false

[user]

# Set the user when launching a distribution with WSL.
  default = DemoUser

[boot]
# Enable systemd
  systemd=true

# Set a command to run when a new WSL instance launches.
  command = service docker start

TODO

C:\> wsl --debug-shell

Welcome to CBL-Mariner 2.0.20230630 (x86_64) - Kernel 5.15.133.1-microsoft-standard-WSL2 (hvc1)
tq84host login: root (automatic login)

root@tq84host [ ~ ]# cat /mnt/wsl/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 172.31.16.1

See also

The global configuration file is %userprofile%/.wslconfig.
/etc/wsl-distribution.conf

Links

Advanced settings configuration in WSL: wsl.conf
https://devblogs.microsoft.com/commandline/automatically-configuring-wsl/

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Linux/fh...', 1745584838, '3.129.128.179', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Linux/fhs/etc/wsl_conf(120): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78