nextcloud: Fix install failure due to PrivateTmp=yes

Fixes: #2463.

- When FreedomBox service is run via systemd and if the unit has PrivateTmp=yes
as was recently introduced, then 'podman exec --user www-data' fails with error
'Error: unable to find user www-data: no matching entries in passwd file'.

- The problem seems isolated to this specific instance and does not seem to
effect the container start up (which happens via systemd).

Tests:

- Without the patch, start FreedomBox service via systemd and install Nextcloud.
It fails.

- With the patch, install succeeds and functional tests for Nextcloud succeed.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2024-10-21 11:06:19 -04:00
1 parent 7e2b365bac
commit 4bde5309c5
1 file changed
+2 -1
+2 -1
View File
@@ -20,6 +20,7 @@ SERVICE_NAME = 'nextcloud-freedombox'
VOLUME_NAME = 'nextcloud-freedombox'
IMAGE_NAME = 'docker.io/library/nextcloud:stable-fpm'
WWW_DATA_UID = '33'
DB_HOST = 'localhost'
DB_NAME = 'nextcloud_fbx'
DB_USER = 'nextcloud_fbx'
@@ -76,7 +77,7 @@ def _run_in_container(
env: dict[str, str] | None = None) -> subprocess.CompletedProcess:
"""Run a command inside the container."""
env_args = [f'--env={key}={value}' for key, value in (env or {}).items()]
command = ['podman', 'exec', '--user', 'www-data'
command = ['podman', 'exec', '--user', WWW_DATA_UID
] + env_args + [CONTAINER_NAME] + list(args)
return subprocess.run(command, capture_output=capture_output, check=check)