107
This is the solution I found from the internet.
Manually disable locking state:
put Nextcloud in maintenance mode: editconfig/config.php
and change this line:'maintenance' => true,
Empty tableoc_file_locks
: Use tools such as phpmyadmin or connect directly to your database and run (the default table prefix isoc_
, this prefix can be different or even empty):DELETE FROM db_name.oc_file_locks WHERE true;
or if you are connected to your database already, the table name is enough:DELETE FROM oc_file_locks WHERE true;
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 6
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 19
Shared hosting (others who can’t install redis): You can disable the file locking, edit your configuration fileconfig/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.
Personal Remark: For to run the occ file scan, need to change the folder path to nextcloud www folder.
Refer –
https://help.nextcloud.com/t/file-is-locked-how-to-unlock/1883
https://www.reddit.com/r/NextCloud/comments/10t5u8e/how_do_i_rescan_all_of_my_files_to_make_it_show/