Open bjornfor opened 2 weeks ago
ddclient.service uses systemd DynamicUser, and it seems the user isn't set up at the time ExecPreStart runs.
The systemd version in NixOS 24.05:
$ systemctl --version
systemd 255 (255.9)
+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
I noticed that the ExecStartPre= line (with the shell script that fails with install: invalid user 'ddclient'
) is prefixed with "!".
man systemd.service
has this to say about the exclamation mark:
├────────┼─────────────────────────────────────────────────────────────────────────────────┤
│ "!" │ Similar to the "+" character discussed above this permits invoking command │
│ │ lines with elevated privileges. However, unlike "+" the "!" character │
│ │ exclusively alters the effect of User=, Group= and SupplementaryGroups=, i.e. │
│ │ only the stanzas that affect user and group credentials. Note that this setting │
│ │ may be combined with DynamicUser=, in which case a dynamic user/group pair is │
│ │ allocated before the command is invoked, but credential changing is left to the │
│ │ executed process itself. │
├────────┼─────────────────────────────────────────────────────────────────────────────────┤
So it explicitly says that the dynamic user/group is allocated before the command is invoked. But it isn't fully reliable?
Describe the bug
There appears to be a race in the ddclient.service startup code, causing it to fail sometimes (very seldomly):
Steps To Reproduce
services.ddclient = { enable = true; other settings; }
Expected behavior
It always works.
Notify maintainers
Metadata
NixOS 24.05.
Add a :+1: reaction to issues you find important.