File is locked - how to unlock

This error/bug has been driving me crazy. Because there was so much variety in the user posts, I created a more standardized testing environment and replicated the bug with a standardized dataset on clean new installs using both postgres & mysql. In the process I created a one-run install script that requires minimal configuration/expertise to use. Doing the file/redis maintenance options are not actually solutions if the bug is evident on clean installs (they merely temporize the issue). Any recommendations on where to look (e.g. in nextcloud codebase) to get this bug fixed would be appreciated!

I want to see nextcloud succeed, and for it to do so this issue needs fixing!

Install script/writeup: https://gitlab.com/deepthought/nextcloud-docker/tree/latest
For freenas users (script not as good, worse deadlock errors): https://github.com/ak1n/freenas-iocage-nextcloud

1 Like

I had the same problem and I solved this by updating values on table oc_file_locks. I found some values diferent from 0 like 1 and -1. Alter this and be happy.

That part for me didnā€™t work. I closed my nextcloud docker to avoid any changes. Then manually deleted the files I needed and yes. The container changed the permissions for the files creating that situation. After I moved everything manually then the problem disappeared of course.

I followed the above post and it worked perfectly.
Thanks

I had to set up a new nextcloud and had the same error.

I donā€™t use redis but memcached.
I commented out the entry for memcached in
/var/www/nextcloud/config/config.php:

#ā€˜memcache.localā€™ => ā€˜\OC\Memcache\APCuā€™,

Now the sync works properly

solved the issue for me, thanks.

  1. sudo -u www-data php occ maintenance:mode --on
    (in Nextcloud folder)
  2. sudo redis-cli -s /var/run/redis/redis.sock
  3. flushall (OK was response)
  4. exit
  5. sudo -u www-data php occ maintenance:mode --off
    (in Nextcloud folder)
  6. sudo -u www-data php occ files:scan --all
    (in Nextcloud folder)

But there was no password in redis? Is this right?

5 Likes

Thanks for pedropt laying this out so clearly. Fixed me up good!

It works for me, thanks a lot!

Just had to do this for a folder on my install. Thanks, tflidd!

A post was split to a new topic: File locking disabled, problems with versioning

add ā€˜filelocking.enabledā€™ => false, in config/config.php:
thanks

1 Like

Thanks. This was helpful.

I was wondering why so many people have this issue. it seems the only time I need to perform this is when Iā€™m doing a files:scan and the terminal session gets dumped for some reason. out side of that Iā€™ve never had a locked file.

Itā€™s too difficult for me to do it by terminal.
Could someone tell me what I have to delete by phpMyAdmin


Delete everithing?

On the overview of the tables, you normally have a button to empty (ā€˜viderā€™) a table. You need to keep the table and its structure as it is.

1 Like

@tflidd Thanks !
I put the image for the next neebee (as me)

Would like to know the risks of disabling the file lock?

One of the contributors to this topic, @mwallace, mentioned that he ā€œturned off file locking on [his installation hosted on] a shared server.ā€ To help those who have considered or have tried on this option, how should someone in similar circumstances monitor the installation for unintended effects?

1 Like

Hi all! I still experience the same issue. Tried to use solution proposed above with keys deleting in redis, however did not work. Problem occured, when I changed one of scss files to add an extra icon.
My version now is 18.0.9
I tried with enabled and sisabled file.locking in config file.
It seem to be no files within files_locks table where value of ā€˜lockā€™ was different than 0. WHen table empty also did not work. Still was given a log message that file is locked for SCSS cacher.
Restarting redis and apache was useless as well.

Why do you suggest to update the cache with occ files:scan --all and then clean the cache immediately with occ files:cleanup? I do not understand your logic.

Maybe we need to clean the cache at first and to fill it after?

Since it has been up to 39 months since the quoted users have submitted a post on this topic, I believe that it is necessary to ask for an update: has anyone experienced any problems as a result of disabling file lock? The admin is making a cautious decision regarding the file lock configuration on an installation with one user on Notes, Calendar, and Deck at a time. Please provide the version numbers in your reply to provide readers a more informed decision.