-
Notifications
You must be signed in to change notification settings - Fork 8
WSL related environment variables not sourced if distribution is started without command #3
Comments
We need to check DamionGans#33 for this issue. The problem is that they just deleted that part simply in fe4562f |
Now that makes sense. The command print the variables from ~/.systemd-env as ENV=VAR and therefor statisfy I just checked what the line does with |
I just added the code snippet into the enter script. I hadn't notived that all ENV=VAR pairs are single quoted. As a result they appears single quoted in the environment section. |
Update: I assume None of those approaches works:
|
Can you try |
Basicly this is ist a different set of delimiters. Sure I can try them as soon as I remember/find how to skip the "entrypoint script" for the wsl distro. I messed smth up while testing it. Probably forget a quote somewhere -> pebkac... Update: |
No breakage on:
I did a |
I just modified the start script to add an additional variable that is not passed in by the /etc/sudoers.d configuration. The additional environment variable IS present. It just doesn't seem to work for the |
Did you added DISPLAY and XAUTHORITY variables to pass? |
Because that value is set by pam_systemd which cannot be used with current env process (Login via /bin/login and load additional env values) |
I added DISPLAY to the sudoers profile, but not XAUTHORITY, as it is neither required for WSLg, nor for my xrdp based custom image. It is only rendered into the suoderes profile, if With WSLg the wsl system distribution, provides Wayland and exposes the .x11-unix/X0 unix daemon socket and the /dev/dxg vgpu (used by mesa >v21.0 automaticly) to the wsl user distribution . Each user distribution has its own sibling system distribution. It also seem to be responsible to inject the required set of variables into the user distribution. Even with the "wrong" I haven't tested to set the DISPLAY to "nameserver:screen" and forward X11 output to a x11 server running on the Windows host,
Sounds reasonable. Offtopic: Btw. I feel adding the start script to |
Do whatever you want. |
This issue can be closed. We discussed in depth about the topic and I come to understand that it's not realy an issue, but rather the way things under the hood work. |
As the title says: the file
~/.systemd-env
is only sourced, if the wsl distribution started with a command, e.g.:Though, they the file is not sourced, if it is started like this
wsl -d Ubuntu-20.04
. This is due toexec /usr/bin/nsenter -t "$SYSTEMD_PID" -a /bin/login -p -f "$SUDO_USER"
beeing called if no command is provided.The text was updated successfully, but these errors were encountered: