[systemd-devel] WSL Ubuntu creates XDG_RUNTIME_DIR with incorrect permissions

Mantas Mikulėnas grawity at gmail.com
Mon Nov 27 07:04:42 UTC 2023


On Mon, Nov 27, 2023 at 6:02 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? 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.
>

In Ubuntu it is *likely* to be systemd invoked through PAM (not systemd as
in init/pid1, but one of the additional components), but in general it is
*not guaranteed* to be a systemd component (some Linux distributions use
alternative PAM modules to do this).

In a 100% systemd-based system, 1) pam_systemd requests systemd-logind to
create a user session (your syslog line 1), 2) systemd-logind starts the
user@<uid> system system service; 3) as a dependency this also starts the
user-runtime-dir@<uid> system service; 4) the user-runtime-dir@ service
creates the runtime directory for you. In older versions it was slightly
different; logind did it internally.

-- 
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20231127/93729a8e/attachment.htm>


More information about the systemd-devel mailing list