Nextcloud, fresh install, rsync error starting service

I’m not sure why I end up in the loop described below. Why would Nextcloud service be trying to delete the folder where the DB is stored?

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 33.0.3
  • Operating system and version (e.g., Ubuntu 24.04):
    • Debian v12
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • none
  • Is this the first time you’ve seen this error? (Yes / No):
    • This is a brand new install, and my first time trying
  • When did this problem seem to first start?
    • Today
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • Docker Compose on TrueNAS run on a UGreen NAS
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • no

Summary of the issue you are facing:

several attempts at installing Nextcloud using Postgres as the DB always end with the Nextcloud service getting stuck in a loop with the errors shown in the log below



Steps to replicate it (hint: details matter!):

Log entries

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.

nextcloud-1  | 2026-05-24T04:05:22.150384714Z => Configuring PHP session handler...
nextcloud-1  | 2026-05-24T04:05:22.153858690Z ==> Using Redis as PHP session handler...
nextcloud-1  | 2026-05-24T04:05:22.186967068Z Initializing nextcloud 32.0.9.2 ...
nextcloud-1  | 2026-05-24T04:05:22.221094703Z rsync: [generator] delete_file: rmdir(pgdata) failed: Device or resource busy (16)
nextcloud-1  | 2026-05-24T04:05:25.483900698Z rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.4.1]

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!):

the best I can offer at this point is the compose.yaml I am using.

networks:
  nextcloud-net:
    enable_ipv6: False
    external: False
    labels:
      tn.network.internal: 'true'
    name: nextcloud-net


services:
  nextcloud:
    image: nextcloud:32
    cap_add:
      - CHOWN
      - DAC_OVERRIDE
      - FOWNER
      - NET_BIND_SERVICE
      - NET_RAW
      - SETGID
      - SETUID
    cap_drop:
      - ALL
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy
    environment:
      # NEXTCLOUD_ADMIN_PASSWORD: <password>
      # NEXTCLOUD_ADMIN_USER: <username>
      NEXTCLOUD_DATA_DIR: /var/www/html/data
      NEXTCLOUD_TRUSTED_DOMAINS: 127.0.0.1 localhost nextcloud 192.168.1.5
      NVIDIA_VISIBLE_DEVICES: void
      PHP_MEMORY_LIMIT: 512M
      PHP_UPLOAD_LIMIT: 3G
      POSTGRES_DB: nextcloud
      POSTGRES_HOST: postgres:5432
      POSTGRES_PASSWORD: <password>
      POSTGRES_USER: nextcloud
      REDIS_HOST: redis
      REDIS_HOST_PASSWORD: <password>
      REDIS_HOST_PORT: '6379'
      TZ: America/New_York
      UMASK: '002'
      UMASK_SET: '002'
      allow_local_remote_servers: 'true'
      social_login_auto_redirect: 'true'
    group_add:
      - 568
    networks:
      nextcloud-net: {}
    platform: linux/amd64
    ports:
      - 8099:80
    restart: unless-stopped
    user: '0:0'
    volumes:
      - read_only: False
        target: /tmp
        type: volume
        volume:
          nocopy: False
      - /mnt/Apps/NextCloud:/var/www/html
      - /mnt/Storage/NextCloud/var/www/html/data


  postgres:
    image: postgres:alpine
    cap_drop:
      - ALL
    environment:
      NVIDIA_VISIBLE_DEVICES: void
      PGDATA: /var/lib/postgresql/17/docker
      PGPORT: '5432'
      POSTGRES_DB: nextcloud
      POSTGRES_PASSWORD: <password>
      POSTGRES_USER: nextcloud
      TZ: America/New_York
      UMASK: '002'
      UMASK_SET: '002'
      POSTGRES_HOST_AUTH_METHOD: trust
    group_add:
      - 568
    healthcheck:
      interval: 30s
      retries: 5
      start_interval: 2s
      start_period: 15s
      test:
        - CMD
        - pg_isready
        - '-h'
        - 127.0.0.1
        - '-p'
        - '5432'
        - '-U'
        - nextcloud
        - '-d'
        - nextcloud
      timeout: 5s
    networks:
      nextcloud-net: {}
    platform: linux/amd64
    restart: unless-stopped
    shm_size: 256M
    stop_grace_period: 60s
    user: '999:999'
    volumes:
      - /mnt/Apps/NextCloud/pgdata:/var/lib/postgresql


  redis:
    cap_drop:
      - ALL
    command:
      - '--port'
      - '6379'
      - '--requirepass'
      - <password>
    environment:
      NVIDIA_VISIBLE_DEVICES: void
      REDIS_PASSWORD: <password>
      TZ: America/New_York
      UMASK: '002'
      UMASK_SET: '002'
    group_add:
      - 568
    healthcheck:
      interval: 30s
      retries: 5
      start_interval: 2s
      start_period: 15s
      test:
        - CMD
        - redis-cli
        - '-h'
        - 127.0.0.1
        - '-p'
        - '6379'
        - '-a'
        - cqXA7Sb4ttvi1vA
        - ping
      timeout: 5s
    image: valkey/valkey:9.1.0
    networks:
      nextcloud-net: {}
    platform: linux/amd64
    restart: unless-stopped
    stop_grace_period: 60s
    user: '568:568'
    volumes:
      - read_only: False
        source: redis-data
        target: /data
        type: volume
        volume:
          nocopy: False


volumes:
  redis-data: {}

So it seems like Nextcloud tries to delete anything that it doesn’t know about in the “/var/www/html” folder. I changed the mount point to put those files in a subfolder and now it starts and is stable.

Now I get a bouncing login for the admin account I created, but that is a different issue

Because your Nextcloud and DB containers have overlapping host volumes. They should be completely independent.

See the docs for the Nextcloud Micro-services Docker Image.

Or consider using the Nextcloud AIO image, for an alternative turnkey stack