The post-restore script 20configure fails on line 39

The NextCloud restore procedure fails and returns this log. The data appears to be present and online. Does anyone have any ideas why?

restic --option=rclone.program=/usr/local/bin/rclone-wrapper restore --json 22b44c553829783bf2a6268880a5b54b27c42fcab2e9d75109ad8a4f3c488e9f --target . --exclude state/environment --exclude-xattr security.* Trying to pull Package restic · GitHub … Getting image source signatures Copying blob sha256:cad10f3c9a04fa33cea3a8c6571b4b8fbc1bc0c2034d86a6172c9710854b3f6f Copying blob sha256:a341fdd03c9fbadf170c343d2cf96e55af03ed868da34a933fbaeabba2cbcca8 Copying config sha256:4ff44f5b3544ef16ba555202369705b486850e219a6b95a24182b4ded94e7460 Writing manifest to image destination _acontrol_task request attempt failed (WS reached EOF while waiting for module/nextcloud3/task/bb5ad5ad-2fb3-4323-92e5-80d0ba506942). Retrying… _acontrol_task request recovered successfully at attempt 2 The configure-module subtask failed! File “/home/nextcloud3/.config/actions/restore-module/20configure”, line 39, in agent.assert_exp(configure_retval[‘exit_code’] == 0, “The configure-module subtask failed!”)

Hi Mauro, happy Labour Day first!

There can be important details in nextcloud3 logs. Look at System Logs page, with nextcloud3 log filter enabled.

2 Likes

Hi Davide, thank you for attention

Thanks for your attention. Below is the log I observed when I started the backup recovery (it’s currently nextcloud1 because I tried a fresh install).

I’m only including the log portion.

Thanks.

2026-05-02T16:51:43+02:00 [1:nextcloud1:podman] c983b51f6232ba2a4fc3bda9244e9b5fe7dd132a0d51eeb628c405da7e6cf6f3
2026-05-02T16:51:43+02:00 [1:nextcloud1:systemd] Started Podman nextcloud-nginx.service.
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
2026-05-02T16:51:43+02:00 [1:nextcloud1:systemd] Started libcrun container.
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] /docker-entrypoint.sh: Configuration complete; ready for start up
2026-05-02T16:51:43+02:00 [1:nextcloud1:podman] 3da405884e5dab26eeed839877ec85ac6359074fb6e0a575a045abecb9a3ad79
2026-05-02T16:51:43+02:00 [1:nextcloud1:systemd] Started Podman nextcloud-notify_push.service.
2026-05-02T16:51:43+02:00 [1:nextcloud1:agent@nextcloud1] task/module/nextcloud1/0832fad4-1bc0-4487-ada1-f601ba322852: configure-module/80configure_collabora is starting
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] 2026/05/02 14:51:43 [notice] 1#1: using the "epoll" event method
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] 2026/05/02 14:51:43 [notice] 1#1: nginx/1.29.2
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] 2026/05/02 14:51:43 [notice] 1#1: built by gcc 14.2.0 (Alpine 14.2.0)
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] 2026/05/02 14:51:43 [notice] 1#1: OS: Linux 5.14.0-611.5.1.el9_7.x86_64
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] 2026/05/02 14:51:43 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 524288:524288
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] 2026/05/02 14:51:43 [notice] 1#1: start worker processes
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] 2026/05/02 14:51:43 [notice] 1#1: start worker process 25
2026-05-02T16:51:43+02:00 [1:nextcloud1:nextcloud-nginx] 2026/05/02 14:51:43 [notice] 1#1: start worker process 26
2026-05-02T16:51:45+02:00 [1:nextcloud1:agent@nextcloud1] task/module/nextcloud1/0832fad4-1bc0-4487-ada1-f601ba322852: action "configure-module" status is "aborted" (1) at step 80configure_collabora
2026-05-02T16:51:45+02:00 [1:nextcloud1:agent@nextcloud1] _acontrol_task request recovered successfully at attempt 2
2026-05-02T16:51:45+02:00 [1:nextcloud1:agent@nextcloud1] The configure-module subtask failed!
2026-05-02T16:51:45+02:00 [1:nextcloud1:agent@nextcloud1]   File "/home/nextcloud1/.config/actions/restore-module/20configure", line 39, in <module>
2026-05-02T16:51:45+02:00 [1:nextcloud1:agent@nextcloud1]     agent.assert_exp(configure_retval['exit_code'] == 0, "The configure-module subtask failed!")
2026-05-02T16:51:45+02:00 [1:nextcloud1:agent@nextcloud1] task/module/nextcloud1/4d6338ba-d627-4f05-a7d6-39f564a410ce: action "restore-module" status is "aborted" (2) at step 20configure
2026-05-02T16:52:02+02:00 [1:nextcloud1:nextcloud-db]
2026-05-02T16:52:02+02:00 [1:nextcloud1:nextcloud-db]
2026-05-02T16:52:02+02:00 [1:nextcloud1:nextcloud-db] 2026-05-02 14:52:02+00:00 [Note] [Entrypoint]: Stopping temporary server
2026-05-02T16:52:02+02:00 [1:nextcloud1:nextcloud-db] 2026-05-02 14:52:02 0 [Note] mariadbd (initiated by: unknown): Normal shutdown

Did you configure Collabora? If so, is Collabora still accessible using the same host name (FQDN) that was used for the backup?

Yes, I configured Collabora with the FQDN “collabora.canducci-adv.it” (a record in stored in the public DNS - it responds to pings). The collabora container is on the same server and appears to be accessible from NextCloud, as files stored in NC, such as .doc or .xls, are opened regularly. The FQDN hasn’t changed since it was stored before the backup. I use Encrypt’s certificate, and from the NS8 Web GUI, it appears to be active.

IIUC, you’re restoring a separate Nextcloud instance alongside the production one on the same node. I’m not sure whether this scenario is supported or will work reliably.

What do you think, @stephdl?

I think it should work. First, if I remember correctly, we can connect multiple Nextcloud instances to the same Collabora instance. Also, during the restore, we normally shouldn’t run into any port conflicts on the Nextcloud side—so it should work.

I can try to reproduce the issue since I’m currently working on the upgrade to Nextcloud 33.

By the way, @davidep: I upgraded on my server and the heavy cron load is not happening.

reading ns8-nextcloud/imageroot/actions/configure-module/80configure_collabora at main · NethServer/ns8-nextcloud · GitHub

I would bet a concurrency race, the previous action is the systemd restart action ???

This is supposition or guess !!!

The wait-startup script was not waiting long enough for Nextcloud to be fully ready before returning control to the system.

It relied on the command occ status --output json and only checked whether the installed field was set to true. However, Nextcloud can be marked as installed while still being in maintenance mode (for example, during database schema migrations). As a result:

The script exited prematurely, assuming Nextcloud was ready
The systemd service (50systemd) returned immediately
The next script (80configure_collabora) started before the database had fully completed its initialization
This caused the Collabora configuration to fail

From the logs, 80configure_collabora started at 16:51:43, while the database only finished initializing at 16:52:02 — 19 seconds later. That’s clearly too early.

PROPOSED SOLUTION:

Replace the check with the command occ status -e, which returns a meaningful exit code:

Exit code 0: Nextcloud is fully operational (installed + not in maintenance mode + database migrations completed)
Exit code 1: Maintenance mode is enabled
Exit code 2: Database upgrade required

This approach ensures the script waits until all three conditions are met before proceeding, instead of relying solely on the installed flag. It removes ambiguity and guarantees that subsequent services only start when Nextcloud is truly ready.

ALTERNATIVE APPROACH: Full JSON Check

Another option is to keep using occ status --output json, but validate all relevant fields instead of just one:

ret, out = occ([“status”, “–output”, “json”])
status = json.loads(out)

if status[“installed”] and not status[“maintenance”] and not status[“needsDbUpgrade”]:
break

print(
f"wait-startup: waiting for nextcloud-app ({i}): "
f"installed={status.get(‘installed’)}, "
f"maintenance={status.get(‘maintenance’)}, "
f"needsDbUpgrade={status.get(‘needsDbUpgrade’)}",
file=sys.stderr
)

This approach:

Retrieves the full status in JSON format instead of relying on a simple exit code
Explicitly checks three conditions:

  • installed: true — Nextcloud is installed
  • maintenance: false — Not in maintenance mode
  • needsDbUpgrade: false — No pending database migrations

Logs the actual values, which helps with troubleshooting:
wait-startup: waiting for nextcloud-app (3): installed=true, maintenance=true, needsDbUpgrade=false
wait-startup: waiting for nextcloud-app (7): installed=true, maintenance=false, needsDbUpgrade=false

Pros: More verbose and detailed, making debugging easier
Cons: Requires JSON parsing, which is heavier than relying on a simple exit code

1 Like

see log of Nextcloud restoration with collabora · GitHub

the complete transaction, now we can see the database upgrade before to go to set/enable collabora

see the QA Bug: post-restore script 20configure fails on line 39 - Nextcloud database not ready · Issue #7988 · NethServer/dev · GitHub

note: this will upgrade to nextcloud 33, running smoothly on my server