You canāt access files because they are locked and you find such errors in your logfile:
{"reqId":"0DijSqEkfOg2iyh9VD8J","remoteAddr":"xx.xx.xx.xx","app":"webdav","message":"Exception: {\"Message\":\"HTTP\\\/1.1 423 \\\"path\\\/file.extension\\\" is locked\",\"Exception\":\"OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Exception\\\\FileLocked\",\"Code\":0,\"Trace\":\"#0
Manually disable locking state:
- put Nextcloud in maintenance mode: edit
config/config.phpand change this line:
'maintenance' => true, - Empty table
oc_file_locks, the<dbname>and<dbtableprefix>as well as the and<dbpassword>can be found in theconfig/config.phpfile of your setup.- Use either tools such as phpmyadmin or connect directly to your database
<dbname>and run:
DELETE FROM <dbname>.<dbtableprefix>file_locks WHERE true; - Use the command line (terminal) and run the command as your with your :
mysql -u <dbuser> -p <dbpassword> DELETE FROM <dbname>.<dbtableprefix>file_locks WHERE true; - And docker users, they need to run the command within
<dbcontainername>container:
docker exec -ti <dbcontainername> mysql -u <dbuser> -p <dbpassword> DELETE FROM <dbname>.<dbtableprefix>file_locks WHERE 1;
- Use either tools such as phpmyadmin or connect directly to your database
- disable maintenance mode (undo first step).
- Make sure your cron-jobs run properly (you admin page tells you when cron ran the last time): Background jobs ā Nextcloud latest Administration Manual latest documentation
- Run a file check to update the filecache table, in case due to the locking errors, some files were not indexed properly:
sudo -u www-data php occ files:scan --all
Permanent solution (if it happens regularly)
- on your own server: Use redis for this feature. It is faster and so far no problems have been reported. You can follow the instructions for memory-caching in the docs: Memory caching ā Nextcloud latest Administration Manual latest documentation
- Shared hosting (others who canāt install redis): You can disable the file locking, edit your configuration file
config/config.php:
'filelocking.enabled' => false,
However, disabling this feature is not a good solution. You can run into problems when several processes try to write to a file (especially online editors in the web-interface). In single-user and/or single-client environments, you can consider this as a workaround.