Update with docker-compose rsync: delete_file problem


i’m running nextcloud with docker compose, but when i stop, pull and restart it to update the packages i fall in a endless loop of:

 Initializing nextcloud ...
nextcloud       | rsync: delete_file: rmdir(logs) failed: Device or resource busy (16)
nextcloud       | rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]

I don’t know where to start searching a mistake.

Thank you very much!

I am leaving some notes here, in case someone else experiences a similar situation and is being sent here by a search engine. To find out what was going on in a similar case, I ran

docker-compose run --rm app /bin/bash

and typed the rsync command from

or similar manually, by invoking

rsync -rlD --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/

on the shell and at least reproducing the same error.

Trying to find out which resource was using it

installing lsof with apt update && apt install -y lsof didn’t yield the expected result. The file was also not accessed anywhere in the host system. What happened?

It turned out there was still a host volume mounted in that directory, so it could not be removed. Taking it out in the docker-compose.yml file helped resolving the update blocker.

May it be that you mounted the logs directory via a Docker volume, too?

I had the same issue and would like to leave a note, too.

Here a typo in the volume path in docker-compose file caused the issue.

Hello, got the same behavior recently running NC on docker with a remote CIFS share from my QNAP NAS.

I don’t know what it rsynced or why. I did a simple mount inside the docker between the mounted share of the VM and the docker directory where nextcloud expected files to be.

The result was catastrophic. It deleted all files in my share. 10 years worth of memories in the form of photos and videos down the drain.

Of course it’s not NC’s fault that I had no usable backup of that specific folder and now I’m crying alone in my living room. But hopefully I can work as a cautionary tale for some other newbie out there.