<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Dec 8, 2023 at 6:53 PM Christopher Wong <<a href="mailto:Christopher.Wong@axis.com" target="_blank">Christopher.Wong@axis.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>





<div lang="en-SE">
<div>
<p class="MsoNormal"><span lang="SV" style="font-size:11pt">Hi Mantas,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="SV" style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt">I have from your suggestion done the following:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Putting the below in user@.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">[Service]<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">...<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Environment=XDG_RUNTIME_DIR=/run/user/%i<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Environment=SYSTEMD_LOG_LEVEL=debug<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Putting the below in user-runtime-dir@.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">[Service]<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">...<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Environment=SYSTEMD_LOG_LEVEL=debug<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt">Then I have disabled the global set-log-level debug (if this is also required, please let me know).</span></p></div></div></div></blockquote><div><br></div><div>Unlike set-environment that's not global, it only affects pid1.<br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div lang="en-SE"><div><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt">What I can see from the logs is that
<a href="mailto:user-runtime-dir@1001.service" target="_blank">user-runtime-dir@1001.service</a> seems to be started and mount /run/user/1001, but addition creation of directory under this mount is getting permission denied.
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd[1]: Created slice User Slice of UID 1001.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd[1]: Starting User Runtime Directory /run/user/1001...<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd-user-runtime-dir[36278]: Bus n/a: changing state UNSET -> OPENING<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd-user-runtime-dir[36278]: sd-bus: starting bus by connecting to /run/dbus/system_bus_socket...<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd-user-runtime-dir[36278]: Bus n/a: changing state OPENING -> AUTHENTICATING<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd-user-runtime-dir[36278]: Bus n/a: changing state AUTHENTICATING -> HELLO<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd-user-runtime-dir[36278]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus
 member=Hello cookie=1 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd-user-runtime-dir[36278]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.2536 path=n/a interface=n/a member=n/a  cookie=1 reply_cookie=1
 signature=s error-name=n/a error-message=n/a<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd-user-runtime-dir[36278]: Bus n/a: changing state HELLO -> RUNNING<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd-user-runtime-dir[36278]: Sent message type=method_call sender=n/a destination=org.freedesktop.login1 path=/org/freedesktop/login1 interface=org.freedesktop.DBus.Properties
 member=Get cookie=2 reply_cookie=0 signature=ss error-name=n/a error-message=n/a<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd-user-runtime-dir[36278]: Got message type=method_return sender=:1.323 destination=:1.2536 path=n/a interface=n/a member=n/a  cookie=15 reply_cookie=2
 signature=v error-name=n/a error-message=n/a<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd-user-runtime-dir[36278]: Sent message type=method_call sender=n/a destination=org.freedesktop.login1 path=/org/freedesktop/login1 interface=org.freedesktop.DBus.Properties
 member=Get cookie=3 reply_cookie=0 signature=ss error-name=n/a error-message=n/a<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd-user-runtime-dir[36278]: Got message type=method_return sender=:1.323 destination=:1.2536 path=n/a interface=n/a member=n/a  cookie=16 reply_cookie=3
 signature=v error-name=n/a error-message=n/a<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd-user-runtime-dir[36278]: Bus n/a: changing state RUNNING -> CLOSED<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd-user-runtime-dir[36278]: Will mount /run/user/1001 owned by 1001:118<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd-user-runtime-dir[36278]: Mounting tmpfs (tmpfs) on /run/user/1001 (MS_NOSUID|MS_NODEV "mode=0700,uid=1001,gid=118,size=99426304,nr_inodes=24274")...<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd[1]: Finished User Runtime Directory /run/user/1001.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd[1]: Starting User Manager for UID 1001...<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd[36280]: systemd 254.7-2-g9edc143 running in user mode for user 1001/ida. (-PAM -AUDIT -SELINUX -APPARMOR +IMA -SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL
 -ACL +BLKID +CURL -ELFUTILS -FIDO2 -IDN2 -IDN -IPTC +KMOD -LIBCRYPTSETUP +LIBFDISK -PCRE2 -PWQUALITY -P11KIT -QRENCODE -TPM2 +BZIP2 -LZ4 +XZ +ZLIB +ZSTD -BPF_FRAMEWORK -XKBCOMMON -UTMP -SYSVINIT default-hierarchy=unified)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd[36280]: Failed to create '/run/user/1001/systemd/inaccessible', ignoring: Permission denied<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd[36280]: Failed to create '/run/user/1001/systemd/inaccessible/reg', ignoring: Permission denied<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd[36280]: Failed to create '/run/user/1001/systemd/inaccessible/dir', ignoring: Permission denied<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd[36280]: Failed to create '/run/user/1001/systemd/inaccessible/fifo', ignoring: Permission denied<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd[36280]: Failed to create '/run/user/1001/systemd/inaccessible/sock', ignoring: Permission denied<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd[36280]: Failed to create '/run/user/1001/systemd/inaccessible/chr', ignoring: Permission denied<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Dec 08 17:33:29 host systemd[36280]: Failed to create '/run/user/1001/systemd/inaccessible/blk', ignoring: Permission denied</span></p></div></div></div></blockquote><div><br></div><div>What's the ownership of /run/user/1001 and /run/user/1001/systemd after all of this?</div><div><br></div><div>Are you rebooting between tests or just manually starting it?</div><div><br></div><div>My current guess is that due to the earlier `systemctl set-environment`, some *other* thing that's running as root inherited the /run/user/1001 path and created root-owned directories there? That's the issue with setting global environment, it needs to be unset afterwards...<br></div></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div></div>