systemd: fix static drop-ins as reported by systemctl --failed

systemd 258 enhances the systemd-creds userdb mechanism and now fails when the /etc/userdb directory is missing.

1. Remove the systemd-userdb-load-credentials.service script as no service (addon) require the creation of static users

    # systemctl --failed
    ● systemd-userdb-load-credentials.service loaded failed failed Load JSON user/group Records from Credentials

2. Create the symbolic link to allow the /storage/.cache/userdb to be utilised (but no default directory to be created)

    # userdbctl services
    SERVICE                      LISTENING
    io.systemd.DropIn            yes
    io.systemd.DynamicUser       yes
    io.systemd.Multiplexer       yes
    io.systemd.NameServiceSwitch yes
    4 services listed.

    # ls -l /storage/.cache/userdb
    lrwxrwxrwx    1 root     root             6 Sep 21 09:48 473.user -> testuser.user
    -rw-r--r--    1 root     root           250 Sep 21 09:27 testuser.user

    # id u
    uid=473(testuser) gid=473 groups=473

    # userdbctl
       NAME                            DISPOSITION        UID   GID REALNAME                     HOME                  SHELL
       ...
    ┌─ ↓ begin system users ↓          system               1     - First system user            -                     -
       ...
       testuser                        regular            473   473 -                            /                     /bin/false
    └─ ↑ end system users ↑            system             999     - Last system user             -                     -

- https://systemd.io/USER_RECORD/
- https://man7.org/linux/man-pages/man8/nss-systemd.8.html
- https://man7.org/linux/man-pages/man7/systemd.system-credentials.7.html
This commit is contained in:
Rudi Heitbaum
2025-09-20 14:05:19 +00:00
parent d4b012e579
commit de28e491c7

View File

@@ -199,6 +199,9 @@ post_makeinstall_target() {
safe_remove ${INSTALL}/usr/lib/systemd/system/systemd-time-wait-sync.service safe_remove ${INSTALL}/usr/lib/systemd/system/systemd-time-wait-sync.service
safe_remove ${INSTALL}/usr/lib/systemd/systemd-time-wait-sync safe_remove ${INSTALL}/usr/lib/systemd/systemd-time-wait-sync
# remove the userdbctl load-credentials script - no service (addon) require the creation of static users
safe_remove ${INSTALL}/usr/lib/systemd/system/systemd-userdb-load-credentials.service
# tune journald.conf # tune journald.conf
sed -e "s,^.*Compress=.*$,Compress=no,g" -i ${INSTALL}/etc/systemd/journald.conf sed -e "s,^.*Compress=.*$,Compress=no,g" -i ${INSTALL}/etc/systemd/journald.conf
sed -e "s,^.*MaxFileSec=.*$,MaxFileSec=0,g" -i ${INSTALL}/etc/systemd/journald.conf sed -e "s,^.*MaxFileSec=.*$,MaxFileSec=0,g" -i ${INSTALL}/etc/systemd/journald.conf
@@ -271,6 +274,8 @@ post_makeinstall_target() {
safe_remove ${INSTALL}/etc/udev/rules.d safe_remove ${INSTALL}/etc/udev/rules.d
ln -sf /storage/.config/udev.rules.d ${INSTALL}/etc/udev/rules.d ln -sf /storage/.config/udev.rules.d ${INSTALL}/etc/udev/rules.d
ln -sf /storage/.cache/userdb ${INSTALL}/etc/userdb
# journald # journald
ln -sf /storage/.cache/journald.conf.d ${INSTALL}/usr/lib/systemd/journald.conf.d ln -sf /storage/.cache/journald.conf.d ${INSTALL}/usr/lib/systemd/journald.conf.d
} }