When my phone warned me that an upload had failed due to an SSL error, I thought that my SSL certificate had expired. It turns out that Let's Encrypt had renewed it. (Something else unrelated had broken in the process, but that is another issue...) But as I got into nextcloud, I noticed things were pretty slow, so I decided to perform that major upgrade I had been holding off on. Well, it turns out I was two major upgrades behind, plus a minor upgrade on my current version. Nextcloud is pretty clear on how to upgrade things, so I went back to my instructions on how to get from 19.0.2 to 19.0.9. That worked like a charm. Then came 19 -> 20. That failed miserably and got stuck in maintenance mode. I used some occ commands and fixed it, though (Maybe these?). I lost the exact commands due to my ssh session timing out and my lack of persistent history when that happens... (Note to self: Fix this!) I think it was mostly just the occ upgrade and then disabling maintanence mode. The upgrade from 20->21 went smoothly as well. Then once everything was up to date, I realized that I had a phantom file stuck. Scanning the files resulted in a 'file is locked' error.

I found some good info on how to fix up 'locked files' here.

cd /path/to/nextcloud/docker_compose_dir/
docker-compose exec --user www-data app php occ maintenance:mode --on
docker-compose exec db mysql --user=root --password=$MY_DB_ROOT_PASSWORD -D nextcloud -e 'delete from oc_file_locks where 1'
docker-compose exec --user www-data app php occ maintenance:mode --on

Other potentially useful occ commands:

docker-compose exec --user www-data app php occ files:scan --all
docker-compose exec --user www-data app php occ files:cleanup

Previous Post