[systemd-devel] WSL Ubuntu creates XDG_RUNTIME_DIR with incorrect permissions
Andrei Borzenkov
arvidjaar at gmail.com
Mon Nov 27 09:37:25 UTC 2023
On Mon, Nov 27, 2023 at 1:06 AM Thomas Larsen Wessel <mrvelle at gmail.com> wrote:
>>
>> WSL does not use systemd by default.
>
>
> According to this article, it systemd has been default on WSL Ubuntu since june 2023. https://learn.microsoft.com/en-us/windows/wsl/systemd
>
> "Systemd is now the default for the current version of Ubuntu that will be installed using the wsl --install command default."
>
> Also when I look in the /var/log/auth.log, there are many lines with systemd, e.g.:
>
> Nov 25 22:30:14 ELCON45223 systemd-logind[155]: New session 6 of user velle.
> Nov 25 22:30:14 ELCON45223 systemd: pam_unix(systemd-user:session): session opened for user velle(uid=1000) by (uid=0)
>
> Could someone please help me understand exactly which part creates this XDG_RUNTIME_DIR folder?
/run/user/$UID for the "console" session (the one you get when
starting a WSL instance) is created by WSL before systemd. Adding "ls
-l /run/user" to user-runtime-dir at 1000.service ExecStartPre:
Nov 27 12:34:22 tumbleweed unknown: WSL (2) ERROR:
WaitForBootProcess:3237: /sbin/init failed to start within 10000
Nov 27 12:34:22 tumbleweed unknown: ms
Nov 27 12:34:22 tumbleweed unknown: WSL (2): Creating login session for andrei
...
Nov 27 12:34:22 tumbleweed systemd[1]: Created slice User Slice of UID 1000.
Nov 27 12:34:22 tumbleweed systemd[1]: Starting User Runtime Directory
/run/user/1000...
Nov 27 12:34:22 tumbleweed ls[520]: total 0
Nov 27 12:34:22 tumbleweed ls[520]: drwxr-xr-x 4 andrei users 120 Nov
27 12:34 1000
Nov 27 12:34:22 tumbleweed systemd-logind[160]: New session 11 of user andrei.
Nov 27 12:34:22 tumbleweed systemd[1]: Finished User Runtime Directory
/run/user/1000.
So logind invokes user-runtime-dir at 1000.service, but it sees the
existing directory and does nothing. I would suggest asking this
question on WSL support channels.
> Is it part of the systemd repo or not? And if the answer is (or may be) different between Ubuntu and WSL Ubuntu, I would be happy if you share what you know about any any of those cases :) Right now, I barely know where to report this issue.
>
>
> On Sun, Nov 26, 2023 at 10:07 AM Andrei Borzenkov <arvidjaar at gmail.com> wrote:
>>
>> On 26.11.2023 02:39, Thomas Larsen Wessel wrote:
>> > I set up WSL on Windows 10 and created an instance from the default Ubuntu
>> > 22.04 image.
>> >
>> > I ran some (non-GUI) software that somehow relies on Qt, and apparently Qt
>> > does some checks on the XDG environment, so I got the following.
>> >
>> > *Warning: QStandardPaths: wrong permissions on runtime directory
>> > /run/user/1000/, 0755 instead of 0700*
>> >
>> > And yes, all the user folders are set to 755, including much of their
>> > content, which violates the XDG Base Directory Specification. (screenshot:
>> > https://i.imgur.com/ISn3ebh.png).
>> >
>> > As far as I can understand, its some part of systemd, that creates this
>> > folder. So is this an issue with systemd?
>> >
>>
>> WSL does not use systemd by default.
>>
>> > The validate_runtime_directory in pam_systemd already does a number of
>> > checks on XDG_RUNTIME_DIR. How about also checking if the permissions are
>> > correct/valid?
>> >
>> > Sincerely, Thomas
>> >
>>
More information about the systemd-devel
mailing list