How to unlock file in Nextcloud?

You can’t access files because they are locked and you find such errors in your logfile:

{"reqId":"0DfsdgdhdfhdfhdfD8J","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.php and change this line:
    'maintenance' => true,
  • Empty table oc_file_locks: Use tools such as phpmyadmin or connect directly to your database and run (the default table prefix is oc_, this prefix can be different or even empty):
    DELETE FROM oc_file_locks WHERE 1
  • disable maintenance mode (undo first step).
  • Make sure your cron-jobs run properly (you admin page tells you when cron ran the last time): https://docs.nextcloud.org/server/13/admin_manual/configuration_server/background_jobs_configuration.html

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: https://docs.nextcloud.org/server/13/admin_manual/configuration_server/caching_configuration.html#id4
  • 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 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 single-client environments, it’s probably less of a problem.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Can I personalize my cloud - own design, color, logo ?

Yes, this is possible with all packages. At Nextcloud you have the so-called "Theming" function....

Can I use my own domain ?

You can use your own domain/subdomain at any time with all packages. You can either order one, or...

Can I mount the cloud using Webdav without Sync Client ?

This is possible at any time. Of course, you can also use other synchronizing tools, such as...

Unlimited users/groups and own apps ?

That's right. You can set unlimited user and groups, as well as use all available apps. The only...

How can I erase my cloud and terminate my account ? Right to be Forgotten

You can terminate your service at any time, with only a few clicks in the customer panel at MY...