Repository navigation
Closed
Description
systemd version the issue has been seen with
252.5
Used distribution
NixOS unstable
Linux kernel version used
6.1.15
CPU architectures issue was seen on
x86_64
Component
systemd
Expected behaviour you didn't see
I'd expect that the service credentials (provisioned through, e.g., LoadCredential=) are accessible from any ExecStartPre= command line regardless of its position. Therefore, I'd expect that the following command prints the contents of /etc/os-release and then exits successfully:
systemd-run -P --wait \
-p 'DynamicUser=yes' \
-p 'LoadCredential=os:/etc/os-release' \
-p 'ExecStartPre=systemctl --version' \
-p 'ExecStartPre=systemd-creds cat os' \
trueUnexpected behaviour you saw
The command above yields the following output:
Running as unit: run-u127.service
systemd 252 (252.5)
+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
Failed to open credentials directory '/run/credentials/run-u127.service': Permission denied
Failed to open credentials directory: Permission denied
Finished with result: exit-code
Service runtime: 74ms
CPU time consumed: 33ms
IP traffic received: 0B
IP traffic sent: 0B
IO bytes read: 0B
IO bytes written: 0B
Swapping the position of the two ExecStartPre= command lines works as expected:
systemd-run -P --wait \
-p 'DynamicUser=yes' \
-p 'LoadCredential=os:/etc/os-release' \
-p 'ExecStartPre=systemd-creds cat os' \
-p 'ExecStartPre=systemctl --version' \
trueOutput:
Running as unit: run-u128.service
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
BUILD_ID="23.05.20230308.c90c402"
DOCUMENTATION_URL="https://nixos.org/learn.html"
HOME_URL="https://nixos.org/"
ID=nixos
LOGO="nix-snowflake"
NAME=NixOS
PRETTY_NAME="NixOS 23.05 (Stoat)"
SUPPORT_URL="https://nixos.org/community.html"
VERSION="23.05 (Stoat)"
VERSION_CODENAME=stoat
VERSION_ID="23.05"
systemd 252 (252.5)
+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
Finished with result: success
Main processes terminated with: code=exited/status=0
Service runtime: 111ms
CPU time consumed: 46ms
IP traffic received: 0B
IP traffic sent: 0B
IO bytes read: 0B
IO bytes written: 0B
Steps to reproduce the problem
See above.
Additional program output to the terminal or log subsystem illustrating the issue
No response
Activity
[-]Credentials only accessible to very first `ExecStartPre=`[/-][+]Credentials only accessible to very first `ExecStartPre=` when using sandboxing (mount namespace)[/+]creds: make available to all ExecStartPre= and ExecStart= processes
creds: make available to all ExecStartPre= and ExecStart= processes
creds: make available to all ExecStartPre= and ExecStart= processes
creds: make available to all ExecStartPre= and ExecStart= processes
creds: make available to all ExecStartPre= and ExecStart= processes
creds: make available to all ExecStartPre= and ExecStart= processes
creds: make available to all ExecStartPre= and ExecStart= processes
creds: make available to all ExecStartPre= and ExecStart= processes
creds: make available to all ExecStartPre= and ExecStart= processes
creds: make available to all ExecStartPre= and ExecStart= processes
creds: make available to all ExecStartPre= and ExecStart= processes
creds: make available to all ExecStartPre= and ExecStart= processes