[SOLVED] Can't modify/delete files with "file locked" error


I have user-level access to a Nextcloud instance (version 13) and I use it to sync files across multiple devices with the latest Nextcloud sync clients.

A very annoying problem is that my local sync clients show errors during every sync that says “server replied: Locked” for a bunch of files. I tried to “reset” this problem by deleting the files client-side, but they remain on the server when I look on the Nextcloud web interface. I also tried to delete the files server-side, but the web interface gives me an unhelpful “Error deleting file” error. This means that (1) there’s a bunch of files on the server that I can’t modify or delete, and (2) these files are no longer synced between my devices.

Can anyone please advise on how I might troubleshoot and solve this problem? Thanks!!

UPDATE: BTW, I also tried renaming the files in question, and see that the original files remain on the server in that locked stated side-by-side with the renamed file. Very frustrating! Hopefully someone can help…

This usually occurs only in combination with database related file locking. This is generally not the recommended method for this obvious reason, database (over)load and performance.

Consider installing and setting up Redis for transactional file locking: https://docs.nextcloud.com/server/14/admin_manual/configuration_files/files_locking_transactional.html

I’m not 100% sure if then the remaining database lock entries are simply ignored, but if not please search this forum for the various threads about how to unlock all files by dropping related database tables.

1 Like

Thank you @MichaIng for your swift response.

However, are your proposed solutions something I can implement as a user? Or is this something the administrator has to do? I am just a user without any administrator-level access to the server/Nextcloud instance…

If this is definitely a database problem, and if only an administrator can change it, can you advise on how to explain this situation to the administrators running the Nextcloud instance? (I am not familiar with the technicalities and terminology that you used!)


Ah okay you are on a shared host?

Redis need to be installed on the server an I am not aware of a method to do this without root access. The Redis service itself can run with limited permissions and via unix socket instead of TCP bind, but not sure how to achieve this.

I suggest then you ask the host admin and ask if a Redis server is available you can use for Nextcloud. Similar to MySQL, webserver and PHP, this should be the case for well featured shared web hostings.

€: Btw. the HowTo about to unlock with database file locking just came up again: File is locked - how to unlock

  • If you use MySQL/MariaDB for database (similarly to Redis, this requires a available server on the shared hosting) and have direct access via some GUI/phpMyAdmin or such, you can manually unlock the files, following the guide.
  • Sadly not sure if/how this can be done on SQLite.
1 Like

Sorry if I wasn’t clear earlier, I didn’t know the correct term is “shared host”, but yes that’s what I’m on, and I’m just a user.

I’ll try to contact the admin to see if they can implement Redis, and look at the guide you linked to. They’re a very small team with many users, I hope they are willing to put this on their todo list! BTW, will implementing Redis automatically unlock those files? Or will the files need to be individually unlocked by the admin? If so, should I provide the path to those files? What information do I need to give the admin to unlock those files? Thank you!

With Redis configured for transactional file locking configured, unlocking will be done automatically and much more reliable than via database, which is default.


The problem has been around for 3 years and has not been fixed yet.
Any ideas?