File is locked - how to unlock

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

If you’re running the ownCloud 8.2.x branch make sure that you’re using at least 8.2.2 (previous versions had a bug causing this issue).

Manually disable locking state:

  • put ownCloud 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:
    DELETE FROM oc_file_locks WHERE 1
  • disable maintenance mode (undo first step).

Automatically reset locking state:
Normally ownCloud should reset the locked state on its own via background jobs. So make sure your cron-jobs run properly (you admin page tells you when cron ran the last time): https://doc.owncloud.org/server/9.0/admin_manual/configuration_server/background_jobs_configuration.html

Permanent solution (if it happens regularly)

5 Likes