database import and backup restore failed

Nextcloud AIO version: 11.2.1
Operating system and version: Ubuntu 24.04.1 LTS
Docker version: 4.31.1

The issue you I’m facing:

After updating, nextcloud-aio-database keeps restartning

Is this the first time you’ve seen this error?: Yes

Steps to replicate it:

  1. trying restore any of the backups I saved in the last 4 months

nextcloud-aio-database log: nc_brokenrestore - Pastebin.com

What I tried (as suggested in other posts):

$ sudo docker stop nextcloud-aio-database
$ sudo docker rm nextcloud-aio-database;
$ sudo docker image prune -af

and restore a backup .

Please any hint is very appreciated.
Thank you in advance.

Massimo

Hi, have you already tried restarting the server and the tried restoring a backup?

Hi, thanks for replying.

Yes I also tried to import the backup on a virtual machine prepared from scratch.
Restore is successful, than the interface asks to update and start the containers and then the issue with the DB begins.

This is the procedure that I tried:

  1. stop the database docker, remove and prune
    $ sudo docker stop nextcloud-aio-database
    $ sudo docker rm nextcloud-aio-database;
    $ sudo docker image prune -af

  2. stop the other dockers and restart the server

  3. select the backup and start restore procedure

  4. update the dockers and start

unfortunately the problem is there:


[…]
2025-07-02T20:54:17.621867081Z CREATE INDEX
2025-07-02T20:54:17.725996018Z ALTER TABLE
2025-07-02T20:54:17.817894524Z ALTER TABLE
2025-07-02T20:54:17.966523609Z ALTER TABLE
2025-07-02T20:54:18.109140686Z ALTER TABLE
2025-07-02T20:54:18.210773973Z ALTER TABLE
2025-07-02T20:54:18.320046455Z ALTER TABLE
2025-07-02T20:54:18.420873749Z GRANT
2025-07-02T20:54:18.420895507Z + ‘[’ -n ‘’ ‘]’
2025-07-02T20:54:18.420899082Z + pg_ctl stop -m fast
2025-07-02T20:54:18.422681286Z waiting for server to shut down…2025-07-02 22:54:18.421 CEST [12] LOG: received fast shutdown request
2025-07-02T20:54:18.756543144Z 2025-07-02 22:54:18.751 CEST [12] LOG: aborting any active transactions
2025-07-02T20:54:18.761220722Z 2025-07-02 22:54:18.761 CEST [12] LOG: background worker “logical replication launcher” (PID 188) exited with exit code 1
2025-07-02T20:54:18.762279025Z 2025-07-02 22:54:18.761 CEST [183] LOG: shutting down
2025-07-02T20:54:19.150604047Z 2025-07-02 22:54:19.144 CEST [183] LOG: checkpoint starting: shutdown immediate
2025-07-02T20:54:38.228316909Z …2025-07-02 22:54:38.223 CEST [301] FATAL: the database system is shutting down
2025-07-02T20:55:08.390559375Z …2025-07-02 22:55:08.386 CEST [310] FATAL: the database system is shutting down
2025-07-02T20:55:19.734741407Z … failed
2025-07-02T20:55:19.734794062Z pg_ctl: server does not shut down
2025-07-02T20:55:28.105292897Z The database import failed. Please restore a backup and try again.

Have You seen this?https://github.com/nextcloud/all-in-one?tab=readme-ov-file#how-to-properly-reset-the-instance

For Your convenience:

#!/bin/bash
docker stop nextcloud-aio-mastercontainer
docker stop nextcloud-aio-domaincheck
docker ps --format {{.Names}}

for cntr in $(docker ps --format {{.Names}})
do
	docker stop $cntr
done
docker ps --filter "status=exited"
docker container prune
docker network rm nextcloud-aio
docker volume ls --filter "dangling=true"
docker volume prune --filter all=1
rm -rf /media/mf/kingston/*
docker volume ls --format {{.Name}}
docker image prune -a

1 Like

Hi, I just created an enhancement to the db-import process in db-import: improve the import process by using the `smart` mode and a higher timeout by szaimen · Pull Request #6617 · nextcloud/all-in-one · GitHub which should hopefully make the import process more reliable especially on your server.

This is now released with v11.4.0 Beta. Testing and feedback is welcome! See GitHub - nextcloud/all-in-one: 📦 The official Nextcloud installation method. Provides easy deployment and maintenance with most features included in this one Nextcloud instance.