The Basics
- Nextcloud Server version (e.g., 29.x.x):
- 31.0.5
- Operating system and version (e.g., Ubuntu 24.04):
- OMV 7.7.9-1 on Debian 6.12.27-1
- Web server and version (e.g, Apache 2.4.25):
- Apache 2.4.63
- Reverse proxy and version _(e.g. nginx 1.27.2)
- Traefik 3.4.1
- PHP version (e.g, 8.3):
- 8.3.21
- Is this the first time you’ve seen this error? (Yes / No):
- Yes
- When did this problem seem to first start?
- 2025-06-11 06:13:37.091 CEST
- Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
- AIO
- Are you using CloudfIare, mod_security, or similar? (Yes / No)
- No
Summary of the issue you are facing:
Nextcloud is not reachable since this morning, HTTP 502.
In the nextcloud-aio-database Container the log says:
Restoring from database dump.
+ rm -rf /var/lib/postgresql/data/PG_VERSION /var/lib/postgresql/data/base /var/lib/postgresql/data/global /var/lib/postgresql/data/pg_commit_ts /var/lib/postgresql/data/pg_dynshmem /var/lib/postgresql/data/pg_hba.conf /var/lib/postgresql/data/pg_ident.conf /var/lib/postgresql/data/pg_logical /var/lib/postgresql/data/pg_multixact /var/lib/postgresql/data/pg_notify /var/lib/postgresql/data/pg_replslot /var/lib/postgresql/data/pg_serial /var/lib/postgresql/data/pg_snapshots /var/lib/postgresql/data/pg_stat /var/lib/postgresql/data/pg_stat_tmp /var/lib/postgresql/data/pg_subtrans /var/lib/postgresql/data/pg_tblspc /var/lib/postgresql/data/pg_twophase /var/lib/postgresql/data/pg_wal /var/lib/postgresql/data/pg_xact /var/lib/postgresql/data/postgresql.auto.conf /var/lib/postgresql/data/postgresql.conf /var/lib/postgresql/data/postmaster.opts
+ export PGPORT=11000
+ PGPORT=11000
+ psql -d postgresql://oc_nextcloud:d4daeb0f2258e71ff6777b7860473160074644b85db940c6@127.0.0.1:11000/nextcloud_database -c 'select now()'
+ exec docker-entrypoint.sh postgres
chmod: /var/run/postgresql: Operation not permitted
psql: error: connection to server at "127.0.0.1", port 11000 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
+ echo 'Waiting for the database to start.'
Waiting for the database to start.
+ sleep 5
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default "max_connections" ... 100
selecting default "shared_buffers" ... 128MB
selecting default time zone ... Europe/Berlin
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... sh: locale: not found
2025-06-11 06:04:26.520 CEST [31] WARNING: no usable system locales were found
ok
syncing data to disk ... + psql -d postgresql://oc_nextcloud:d4daeb0f2258e71ff6777b7860473160074644b85db940c6@127.0.0.1:11000/nextcloud_database -c 'select now()'
psql: error: connection to server at "127.0.0.1", port 11000 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
+ echo 'Waiting for the database to start.'
Waiting for the database to start.
+ sleep 5
+ psql -d postgresql://oc_nextcloud:d4daeb0f2258e71ff6777b7860473160074644b85db940c6@127.0.0.1:11000/nextcloud_database -c 'select now()'
psql: error: connection to server at "127.0.0.1", port 11000 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
+ echo 'Waiting for the database to start.'
Waiting for the database to start.
+ sleep 5
+ psql -d postgresql://oc_nextcloud:d4daeb0f2258e71ff6777b7860473160074644b85db940c6@127.0.0.1:11000/nextcloud_database -c 'select now()'
psql: error: connection to server at "127.0.0.1", port 11000 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
+ echo 'Waiting for the database to start.'
Waiting for the database to start.
+ sleep 5
+ psql -d postgresql://oc_nextcloud:d4daeb0f2258e71ff6777b7860473160074644b85db940c6@127.0.0.1:11000/nextcloud_database -c 'select now()'
psql: error: connection to server at "127.0.0.1", port 11000 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
+ echo 'Waiting for the database to start.'
Waiting for the database to start.
+ sleep 5
+ psql -d postgresql://oc_nextcloud:d4daeb0f2258e71ff6777b7860473160074644b85db940c6@127.0.0.1:11000/nextcloud_database -c 'select now()'
psql: error: connection to server at "127.0.0.1", port 11000 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
+ echo 'Waiting for the database to start.'
Waiting for the database to start.
+ sleep 5
+ psql -d postgresql://oc_nextcloud:d4daeb0f2258e71ff6777b7860473160074644b85db940c6@127.0.0.1:11000/nextcloud_database -c 'select now()'
psql: error: connection to server at "127.0.0.1", port 11000 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
+ echo 'Waiting for the database to start.'
Waiting for the database to start.
+ sleep 5
…
2025-06-11 06:06:10.845 CEST [123] LOG: database system was shut down at 2025-06-11 06:06:09 CEST
2025-06-11 06:06:10.845 CEST [124] FATAL: the database system is starting up
psql: error: connection to server at "127.0.0.1", port 11000 failed: FATAL: the database system is starting up
+ echo 'Waiting for the database to start.'
Waiting for the database to start.
+ sleep 5
2025-06-11 06:06:11.129 CEST [13] LOG: database system is ready to accept connections
+ psql -d postgresql://oc_nextcloud:d4daeb0f2258e71ff6777b7860473160074644b85db940c6@127.0.0.1:11000/nextcloud_database -c 'select now()'
now
-------------------------------
2025-06-11 06:06:15.859089+02
(1 row)
+ GREP_STRING='Name: oc_appconfig; Type: TABLE; Schema: public; Owner:'
+ grep -qa 'Name: oc_appconfig; Type: TABLE; Schema: public; Owner:' /mnt/data/database-dump.sql
++ grep -a 'Name: oc_appconfig; Type: TABLE; Schema: public; Owner:' /mnt/data/database-dump.sql
++ head -1
++ grep -oP 'Owner:.*$'
++ sed 's|Owner:||;s|[[:space:]]||g'
+ DB_OWNER=oc_nextcloud
+ '[' oc_nextcloud = nextcloud ']'
+ '[' oc_nextcloud '!=' oc_nextcloud ']'
+ echo 'Restoring the database from database dump'
Restoring the database from database dump
+ psql nextcloud_database -U nextcloud
SET
SET
SET
SET
SET
set_config
…
ALTER TABLE
GRANT
+ '[' -n '' ']'
+ pg_ctl stop -m fast
waiting for server to shut down....2025-06-11 06:13:05.083 CEST [13] LOG: received fast shutdown request
2025-06-11 06:13:05.199 CEST [13] LOG: aborting any active transactions
2025-06-11 06:13:05.201 CEST [13] LOG: background worker "logical replication launcher" (PID 128) exited with exit code 1
.2025-06-11 06:13:07.023 CEST [284] FATAL: the database system is shutting down
..............................2025-06-11 06:13:37.091 CEST [293] FATAL: the database system is shutting down
............................ failed
pg_ctl: server does not shut down
The database import failed. Please restore a backup and try again.
For further clues on what went wrong, look at the logs above.
Steps to replicate it (hint: details matter!):
- Restart Container nextcloud-aio-database leads to the same error
- Stop all containers in Nextcloud AIO und then start containers leads to the same error.
Log entries
The database-import.log in volume nextcloud_aio_database_dump ends with
ALTER TABLE
ALTER TABLE
GRANT
+ '[' -n '' ']'
+ pg_ctl stop -m fast
waiting for server to shut down....2025-06-11 06:13:05.083 CEST [13] LOG: received fast shutdown request
2025-06-11 06:13:05.199 CEST [13] LOG: aborting any active transactions
2025-06-11 06:13:05.201 CEST [13] LOG: background worker "logical replication launcher" (PID 128) exited with exit code 1
.2025-06-11 06:13:07.023 CEST [284] FATAL: the database system is shutting down
..............................2025-06-11 06:13:37.091 CEST [293] FATAL: the database system is shutting down
............................ failed
pg_ctl: server does not shut down
Nextcloud
Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log
located in your data directory). Feel free to use a pastebin/gist service if necessary.
PASTE HERE
Web Browser
If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.
PASTE
Web server / Reverse Proxy
The output of your Apache/nginx/system log in /var/log/____
:
PASTE HERE
Configuration
Nextcloud
The output of occ config:list system
or similar is best, but, if not possible, the contents of your config.php
file from /path/to/nextcloud
is fine (make sure to remove any identifiable information!):
PASTE HERE
Apps
The output of occ app:list
(if possible).
Tips for increasing the likelihood of a response
- Use the
preformatted text
formatting option in the editor for all log entries and configuration output. - If screenshots are useful, feel free to include them.
- If possible, also include key error output in text form so it can be searched for.
- Try to edit log output only minimally (if at all) so that it can be ran through analyzers / formatters by those trying to help you.