Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DISPLAY and WAYLAND_DISPLAY not set in systemd activation environment #12436

Open
1 of 2 tasks
K900 opened this issue Jan 5, 2025 · 5 comments
Open
1 of 2 tasks

DISPLAY and WAYLAND_DISPLAY not set in systemd activation environment #12436

K900 opened this issue Jan 5, 2025 · 5 comments
Assignees
Labels

Comments

@K900
Copy link

K900 commented Jan 5, 2025

Windows Version

Microsoft Windows [Version 10.0.26100.2605]

WSL Version

2.4.8.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.167.4-1

Distro Version

NixOS unstable

Other Software

No response

Repro Steps

  1. Try to run a graphical application from a systemd user service
  2. Observe lack of DISPLAY or WAYLAND_DISPLAY in the environment

Expected Behavior

DISPLAY and WAYLAND_DISPLAY, and possibly other relevant variables are available in the environment for all user services.

Actual Behavior

They are not.

Not sure where to put notes, but fixing this should be as simple as running systemctl --user import-environment DISPLAY WAYLAND_DISPLAY <etc> with the right environment set, or making a dbus call directly. The problem is mostly that only WSL really knows when WSLg is available and what the variables should be set to.

Diagnostic Logs

No response

Copy link

github-actions bot commented Jan 5, 2025

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

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!

Closed similar issues:

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

@K900
Copy link
Author

K900 commented Jan 5, 2025

/feature

I guess?

Copy link

github-actions bot commented Jan 5, 2025

Diagnostic information
Found '/feature', adding tag 'feature'

@zcobol
Copy link

zcobol commented Jan 5, 2025

@K900 you're using NixOS unstable, did you try a released version? Using the latest from https://github.com/nix-community/NixOS-WSL/releases/download/2405.5.4/nixos-wsl.tar.gz the environment variables are properly created:

[nixos@nixos:~]$ echo $DISPLAY
:0

[nixos@nixos:~]$ echo $WAYLAND_DISPLAY
wayland-0

[nixos@nixos:~]$ wslinfo --wsl-version
2.4.8

[nixos@nixos:~]$ echo $XDG_RUNTIME_DIR
/run/user/1000/

[nixos@nixos:~]$ ls -l /run/user/1000/
total 0
srw-rw-rw- 1 nixos users   0 Jan  5 20:01 bus
drwxr-xr-x 3 nixos users  60 Jan  5 20:01 dbus-1
drwxr-xr-x 2 nixos users  80 Jan  5 20:01 pulse
drwxr-xr-x 5 nixos users 140 Jan  5 20:01 systemd
lrwxrwxrwx 1 root  root   31 Jan  5 20:01 wayland-0 -> /mnt/wslg/runtime-dir/wayland-0
lrwxrwxrwx 1 root  root   36 Jan  5 20:01 wayland-0.lock -> /mnt/wslg/runtime-dir/wayland-0.lock

@K900
Copy link
Author

K900 commented Jan 5, 2025

This is about the systemd activation environment, not your normal user shell environment. Also, I'm one of the maintainers of NixOS-WSL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants