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)

6 Likes
Fehler - File ist locked - kein Sync
Can't delete files
Problems to upload 2 GB+ files
My files aren't syncing the way I would expect. How should I troubleshoot?
After upgrade to 8.2.1.4 error when syncing big fil
Benutzer kann geteielte Datei nicht löschen
File Locked / Datei kann nicht gelöscht werden
Locked File in Owncloud version 10
Trouble Syncing Files
Could not move folder
Popup keeps informing me on error
Locked File in Owncloud version 10
Owncloud Sync error lock-unlock files
ownCloud ignore my MP4 and .rar files on sync
Issues deleting my folders and files on an encrypted profile (OC10.x)
Lock files issues - 65K entries in table oc_file_locks
Cannot files:scan a user
File Locked, how to reset using docker
After update to 9.1.2 some files have a yellow exclamation mark
Error uploading files larger than 40gb
423 locked file when trying to update
Couldn’t move (foldername)
Error 423 Owncloud
Server refuses to delete some files
[Terminé] Erreur à la Suppression du fichier
[Résolu] Server replied: locked
Errors when running sudo -u www-data php occ files:scan --all --repair
Error deleting last empty folder
Too many files on /data compared to local drive
OwnCloud - Error log
Shared folders are not sync with the Desktop Client
Owncloud & Docker : Unable to run CLI correctly
After update to 9.1.2 some files have a yellow exclamation mark
Problem restoring files
Mailbird on ownCloud
Can not delete one file!?
Owncloud newbie needs help desperatly
Login impossible after downgrade to 8.2