microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.57k stars 823 forks source link

`$XDG_RUNTIME_DIR`, `$WAYLAND_DISPLAY` and other variables not getting exported with `systemd 256 (256-1ubuntu1)` #11825

Closed dhtzs closed 4 months ago

dhtzs commented 4 months ago

Windows Version

Microsoft Windows [Version 10.0.22631.3880]

WSL Version

2.3.11.0

Are you using WSL 1 or WSL 2?

Kernel Version

6.6.36.3-1

Distro Version

Ubuntu 24.10 (Oracular Oriole - development branch)

Other Software

$ systemctl --version
systemd 256 (256-1ubuntu1)
+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT -GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBCRYPTSETUP_PLUGINS +LIBFDISK +PCRE2 +PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +BPF_FRAMEWORK -XKBCOMMON +UTMP +SYSVINIT +LIBARCHIVE

Repro Steps

  1. Enable systemd.
    $ cat /etc/wsl.conf
    [boot]
    systemd=true
  2. Execute wsl --shutdown.
  3. Start a WSL instance and notice the missing variables.

Expected Behavior

$ env
DISPLAY=:0
GOPATH=/home/dhtzs/go
GOROOT=/usr/local/go
HOME=/home/dhtzs
HOSTTYPE=x86_64
LANG=C.UTF-8
LESS=-R
LOGNAME=dhtzs
NAME=Dimitris
OLDPWD=/mnt/c/Users/dhtzs
PAGER=less
PATH=/home/dhtzs/.nvm/versions/node/v22.4.0/bin:/home/dhtzs/.cargo/bin:/home/dhtzs/.autojump/bin:/home/dhtzs/Android/Sdk/platform-tools:/home/dhtzs/go/bin:/usr/local/go/bin:/home/dhtzs/.local/bin:/home/dhtzs/Android/Sdk/platform-tools:/home/dhtzs/go/bin:/usr/local/go/bin:/home/dhtzs/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0:/mnt/c/WINDOWS/System32/OpenSSH:/mnt/c/Program Files/Python/Python312/Scripts:/mnt/c/Program Files/Python/Python312:/mnt/c/Program Files/Python/Python27/Scripts:/mnt/c/Program Files/Python/Python27:/mnt/c/Program Files/dotnet:/mnt/c/Program Files/PowerShell/7:/mnt/c/Program Files/nodejs:/mnt/c/Program Files/Amazon/AWSCLIV2:/mnt/c/Program Files/Android/platform-tools:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Go/bin:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Amazon/AWSCLIV2/:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/PowerShell/7/:/mnt/c/Users/dhtzs/AppData/Local/Programs/Python/Python312/Scripts/:/mnt/c/Users/dhtzs/AppData/Local/Programs/Python/Python312/:/mnt/c/Users/dhtzs/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/dhtzs/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/dhtzs/.dotnet/tools:/mnt/c/Users/dhtzs/AppData/Roaming/npm:/mnt/c/Program Files/PHP:/mnt/c/Program Files/Java/jdk-22/bin:/mnt/c/Program Files/Maven/bin:/mnt/c/Users/dhtzs/go/bin:/mnt/c/Users/dhtzs/AppData/Local/Programs/Microsoft VS Code/bin:/home/dhtzs/.fzf/bin
PULSE_SERVER=unix:/mnt/wslg/PulseServer
PWD=/mnt/c/Users/dhtzs
SHELL=/usr/bin/zsh
SHLVL=2
TERM=tmux-256color
TERM_PROGRAM=tmux
TERM_PROGRAM_VERSION=3.4
TMUX=/tmp/tmux-1000/default,243,0
TMUX_PANE=%0
TMUX_PLUGIN_MANAGER_PATH=/home/dhtzs/.tmux/plugins/
USER=dhtzs
WAYLAND_DISPLAY=wayland-0
WSL2_GUI_APPS_ENABLED=1
WSLENV=WT_SESSION:WT_PROFILE_ID:
WSL_DISTRO_NAME=Ubuntu
WSL_INTEROP=/run/WSL/9_interop
WT_PROFILE_ID={2c4de342-38b7-51cf-b940-2309a097f518}
WT_SESSION=c573f84f-fdf0-49ca-883e-95a0e5714ae9
XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir
ZSH=/home/dhtzs/.oh-my-zsh
ZSH_TMUX_AUTOSTARTED=true
ZSH_TMUX_CONFIG=/home/dhtzs/.tmux.conf
ZSH_TMUX_TERM=tmux-256color
_=/usr/bin/env
_ZSH_TMUX_FIXED_CONFIG=/home/dhtzs/.oh-my-zsh/plugins/tmux/tmux.extra.conf
P9K_TTY=old
_P9K_TTY=/dev/pts/1
AUTOJUMP_SOURCED=1
AUTOJUMP_ERROR_PATH=/home/dhtzs/.local/share/autojump/errors.log
P9K_SSH=0
_P9K_SSH_TTY=/dev/pts/1
BAT_THEME=Dracula
PERSONAL=/mnt/c/Personal
PEN=/mnt/c/Personal/Pentesting
PEN_LISTS=/mnt/c/Personal/Pentesting/Lists
PEN_RECON=/mnt/c/Personal/Pentesting/Reconnaissance
PEN_REPORTS=/mnt/c/Personal/Pentesting/Reports
PEN_TOOLS=/mnt/c/Personal/Pentesting/Tools
PROJ=/mnt/c/Personal/Projects
REP=/mnt/c/Personal/Repositories
NVM_CD_FLAGS=-q
NVM_DIR=/home/dhtzs/.nvm
NVM_BIN=/home/dhtzs/.nvm/versions/node/v22.4.0/bin
NVM_INC=/home/dhtzs/.nvm/versions/node/v22.4.0/include/node

Actual Behavior

$ env
DISPLAY=:0
GOPATH=/home/dhtzs/go
GOROOT=/usr/local/go
HOME=/home/dhtzs
HOSTTYPE=x86_64
LANG=C.UTF-8
LESS=-R
LOGNAME=dhtzs
NAME=Dimitris
OLDPWD=/mnt/c/Users/dhtzs
PAGER=less
PATH=/home/dhtzs/.nvm/versions/node/v22.4.0/bin:/home/dhtzs/.cargo/bin:/home/dhtzs/.autojump/bin:/home/dhtzs/Android/Sdk/platform-tools:/home/dhtzs/go/bin:/usr/local/go/bin:/home/dhtzs/.local/bin:/home/dhtzs/Android/Sdk/platform-tools:/home/dhtzs/go/bin:/usr/local/go/bin:/home/dhtzs/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0:/mnt/c/WINDOWS/System32/OpenSSH:/mnt/c/Program Files/Python/Python312/Scripts:/mnt/c/Program Files/Python/Python312:/mnt/c/Program Files/Python/Python27/Scripts:/mnt/c/Program Files/Python/Python27:/mnt/c/Program Files/dotnet:/mnt/c/Program Files/PowerShell/7:/mnt/c/Program Files/nodejs:/mnt/c/Program Files/Amazon/AWSCLIV2:/mnt/c/Program Files/Android/platform-tools:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Go/bin:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Amazon/AWSCLIV2/:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/PowerShell/7/:/mnt/c/Users/dhtzs/AppData/Local/Programs/Python/Python312/Scripts/:/mnt/c/Users/dhtzs/AppData/Local/Programs/Python/Python312/:/mnt/c/Users/dhtzs/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/dhtzs/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/dhtzs/.dotnet/tools:/mnt/c/Users/dhtzs/AppData/Roaming/npm:/mnt/c/Program Files/PHP:/mnt/c/Program Files/Java/jdk-22/bin:/mnt/c/Program Files/Maven/bin:/mnt/c/Users/dhtzs/go/bin:/mnt/c/Users/dhtzs/AppData/Local/Programs/Microsoft VS Code/bin:/home/dhtzs/.fzf/bin
PULSE_SERVER=unix:/mnt/wslg/PulseServer
PWD=/mnt/c/Users/dhtzs
SHELL=/usr/bin/zsh
SHLVL=2
TERM=tmux-256color
TERM_PROGRAM=tmux
TERM_PROGRAM_VERSION=3.4
TMUX=/tmp/tmux-1000/default,243,0
TMUX_PANE=%0
TMUX_PLUGIN_MANAGER_PATH=/home/dhtzs/.tmux/plugins/
USER=dhtzs
WAYLAND_DISPLAY=wayland-0
WSL2_GUI_APPS_ENABLED=1
WSLENV=WT_SESSION:WT_PROFILE_ID:
WSL_DISTRO_NAME=Ubuntu
WSL_INTEROP=/run/WSL/9_interop
WT_PROFILE_ID={2c4de342-38b7-51cf-b940-2309a097f518}
WT_SESSION=c573f84f-fdf0-49ca-883e-95a0e5714ae9
XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir
ZSH=/home/dhtzs/.oh-my-zsh
ZSH_TMUX_AUTOSTARTED=true
ZSH_TMUX_CONFIG=/home/dhtzs/.tmux.conf
ZSH_TMUX_TERM=tmux-256color
_=/usr/bin/env
_ZSH_TMUX_FIXED_CONFIG=/home/dhtzs/.oh-my-zsh/plugins/tmux/tmux.extra.conf
P9K_TTY=old
_P9K_TTY=/dev/pts/1
AUTOJUMP_SOURCED=1
AUTOJUMP_ERROR_PATH=/home/dhtzs/.local/share/autojump/errors.log
P9K_SSH=0
_P9K_SSH_TTY=/dev/pts/1
BAT_THEME=Dracula
PERSONAL=/mnt/c/Personal
PEN=/mnt/c/Personal/Pentesting
PEN_LISTS=/mnt/c/Personal/Pentesting/Lists
PEN_RECON=/mnt/c/Personal/Pentesting/Reconnaissance
PEN_REPORTS=/mnt/c/Personal/Pentesting/Reports
PEN_TOOLS=/mnt/c/Personal/Pentesting/Tools
PROJ=/mnt/c/Personal/Projects
REP=/mnt/c/Personal/Repositories
NVM_CD_FLAGS=-q
NVM_DIR=/home/dhtzs/.nvm
NVM_BIN=/home/dhtzs/.nvm/versions/node/v22.4.0/bin
NVM_INC=/home/dhtzs/.nvm/versions/node/v22.4.0/include/node

Diagnostic Logs

pulseaudio.log stderr.log weston.log WslLogs-2024-07-23_18-14-30.zip

Environmental variables with/without systemd: https://www.diffchecker.com/vPp4cPHt/

github-actions[bot] commented 4 months ago

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Diagnostic information
.wslconfig found
Detected appx version: 2.3.11.0