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

WSL version 2.0.12 makes $XDG_RUNTIME_DIR not user accessible when guiApplications=false #10846

Closed
1 of 2 tasks
elsaco opened this issue Nov 29, 2023 · 5 comments
Closed
1 of 2 tasks

Comments

@elsaco
Copy link

elsaco commented Nov 29, 2023

Windows Version

10.0.19045.3693

WSL Version

20.12.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.133.1-microsoft-standard-WSL2

Distro Version

Ubuntu 23.10

Other Software

No response

Repro Steps

Set guiApplications = false and restart WSL

Expected Behavior

$XDG_RUNTIME_DIR user accessible

Actual Behavior

elsaco@mantic:~$ ls -lnd $XDG_RUNTIME_DIR
drwx------ 2 0 0 4096 Nov  6 19:10 /run/user/1000/
elsaco@mantic:~$ ls -la $XDG_RUNTIME_DIR
ls: cannot open directory '/run/user/1000/': Permission denied

It breaks systemd:

elsaco@mantic:~$ systemctl --user status
Failed to connect to bus: Permission denied

From debug console:

WSL (2) ERROR: ConfigHandleInteropMessage:595: getenv(XDG_RUNTIME_DIR) failed

Diagnostic Logs

No response

Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

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. Thank you!

Open similar issues:

Closed similar issues:

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

@OneBlue
Copy link
Collaborator

OneBlue commented Nov 29, 2023

Thank you for reporting this @elsaco. I can't reproduce the issue.

Can you share /logs and the output of cat /etc/wsl.conf ?

@fknittel
Copy link

fknittel commented Dec 5, 2023

I've found a work-around. Once per wsl distribution and user you need to fix the permissions of the directory used to mount the ephemeral XDG_RUNTIME directory /mnt/wslg/run/user/

Example:

$ id -u
1000
$ sudo chown 1000:1000 /mnt/wslg/run/user/1000

After that, reboot your wsl and everything should be fine:

wsl.exe --shutdown

Does that work for you @elsaco?

In my opinion, /mnt/wslg/run/user shouldn't be bind-mounted to /run/user for guiApplications=false, because /mnt/wslg is not what /init expects it to be (initially doesn't exist and gets created on /).

@sgraf812
Copy link

sgraf812 commented Feb 14, 2024

This is a serious issue for me as well. Apparently I need to run @fknittel's workaround after every update.

My wsl.conf:

[network]
generateHosts = true
generateResolvConf = false

[wsl2]
#firewall = true 

[filesystem]
#umask = 0022

[user]
default=sgraf

[boot]
systemd=true

@jeffrson
Copy link

For me, /run/user is empty, so "1000" does not exist there at all, which breaks some applications because nevertheless XDG_RUNTIME_DIR is set to /run/user/1000/

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

No branches or pull requests

5 participants