fix(rootless): task service DOCKER_HOST points at the install user's socket

The rootless task-processor service env used id -u $sudo_user_name (the
manager, e.g. 1001) for DOCKER_HOST/XDG_RUNTIME_DIR, but the rootless daemon
runs as the docker install user, so its socket lives at
/run/user/<install-user-uid>/docker.sock (e.g. 1002). The manager-uid path
doesn't exist. Use id -u $CFG_DOCKER_INSTALL_USER so the env matches the
actual rootless socket (same values dockerCommandRunInstallUser uses).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
librelad 2026-05-24 14:52:41 +01:00
parent d93bc9a864
commit c9445b4e78

View File

@ -24,12 +24,17 @@ installLibrePortalWebUITaskService()
# back to /var/run/docker.sock (which rootless does not create) and any
# `docker …` call inside the task would fail. Rootful gets no extras —
# the default /var/run path is already correct.
#
# The rootless daemon runs as the DOCKER INSTALL USER, so its socket lives in
# that user's runtime dir — not the manager's. Use the docker install user's
# uid here (matches dockerCommandRunInstallUser); pointing at the manager's
# uid was wrong — that socket doesn't exist.
local service_env_block=""
if [[ "$CFG_DOCKER_INSTALL_TYPE" == "rootless" ]]; then
local libreportal_uid
libreportal_uid="$(id -u "$sudo_user_name")"
service_env_block="Environment=DOCKER_HOST=unix:///run/user/${libreportal_uid}/docker.sock
Environment=XDG_RUNTIME_DIR=/run/user/${libreportal_uid}"
local docker_install_uid
docker_install_uid="$(id -u "$CFG_DOCKER_INSTALL_USER")"
service_env_block="Environment=DOCKER_HOST=unix:///run/user/${docker_install_uid}/docker.sock
Environment=XDG_RUNTIME_DIR=/run/user/${docker_install_uid}"
fi
# Create systemd service file