-
Notifications
You must be signed in to change notification settings - Fork 822
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
mounting of /mnt/wslg as user runtime dir breaks all users except that with uid=1000 #9025
Comments
As a note for this: As part of other work I've been doing, I have tried overriding the [email protected] to run the attached script rather than the default This keeps anything the logged-in user does, including deleting the contents of the /run/user/uid directory, from affecting the /mnt/wslg/runtime-dir directory, and also makes the latter's contents available to other users without interference from the other contents of the runtime directory, as can be seen here with two users logged in: As an approach that avoids many of the possible pitfalls of assuming the UID of the WSL default user matches that of the WSLg runtime user and of exposing the contents of the WSLg runtime directory to user error, I thought it might be worth bringing to y'all's attention. Script: |
Can you explain the parameters and give a hit why i get the error
|
Would be nice to see a fix for this as this affects me as well. |
@cerebrate Thanks to your great explanations, I've finally been able to figure out why a few things had been breaking on my end (my current WSL UID:GID being 1001:1001). |
Version
WSL version: 0.70.0.0
WSL Version
Kernel Version
5.15.68.1-20221008-2-microsoft-custom-WSL2+
Distro Version
Debian sid
Other Software
No response
Repro Steps
ls -la /run/user
ls -la /run/user/1000
wsl -u root
).ls -la /run/user
ls -la /run/user/<uid>
, where uid is that of the user the second session was started as (0, in the case of root)Expected Behavior
The user runtime directory should have the user and group ownership of the user for whom it was created.
Actual Behavior
The user runtime directory always has user and group ownership by the default (uid=1000) user, regardless of for whom it is created.
This is obviously related to #8918, in that it's an issue caused by the automatic bind mounting of
/mnt/wslg
over the user runtime directory. However, in this case, it's doing this not only for uid 1000, which is compatible with the WSLg contents due to their common uid, but also for every other uid. In their cases, not only do systemd user sessions fail to start (detecting the incorrect ownership of the runtime directory, as per my bug arkane-systems/bottle-imp#21), but the other users will in many cases not be able to make use of the runtime directory due to permissions errors (incorrect ownership combined with therwx------
permissions on/mnt/wslg
).(My suggestion would be to eliminate of this bind mount in all cases where the uid is not 1000. This does mean that WSL sessions started as other users will not have direct access to WSLg services, but this is the normal situation under native Linux and users still have the usual tools to manage that.
There are some issues caused by having this bind mount even when the uid is 1000 given that systemd expects to manage the user runtime directory, but those are covered in #8918.)
Diagnostic Logs
No response
The text was updated successfully, but these errors were encountered: