Unwanted file locks server side in nextcloud

NethServer Version: 7 final
Module: nextcloud

I have an issue where nextcloud is locking some files so they cannot be synced, I note that the NS config for nextcloud lacks the maintenance lock line… obviously, this is different from my standalone owncloud installs… one ‘fix’ I see is to delete the file locks from the database while in maintenance mode… what is the best way to address this with the NS nextcloud module?

also, the docs state we’re using mariadb and the config states mysql…

Nextcloud recommends to use Redis for locks (editing config.php)
Nextcloud uses mysql string for both MySQL/MariaDB. (MariaDB is backward compatible with mysql).

1 Like


Before installing Redis or phpmyadmin… in the interest of keeping a ‘default’ server I have little interest in installing those tools at this time, I would prefer to put nc into maintenance mode and ‘connect directly’ to the database to delete the locks, so I can see if I can figure why the files were locked in the first place, it shouldn’t have happened, there is one account and two clients on this server.

So, is there a specified way of accessing mariadb for NS?

I’m reading through here now;

So, add maintenance true line to nextcloud config, get the mysql pwd from;
use mysql commands to open nextcloud db, the “DELETE FROM oc_file_locks WHERE 1” command empties the entire table, not sure that’s right…, quit mysql, change maintenance to false in nextcloud config… done, files are unlocked and sync properly… for now.

Seems like if memcache is going to be an issue, we, NS, should address this at install with an ‘official’ redis install… ?

I rather try to avoid installing such things like redis or memcached.

Which solution do you think is better? Disable the lock option or install redis by default?

Well, I have redis everywhere… pretty sure every one of my ns6.8 installs have redis.

Redis is used only for ntopng right now, because ntopng can’t work without it.

Would you like to try connecting Nextcloud to redis?

Some people reported that issue recently, the effect of that is the client can’t sync any other file. Sadly I didn’t find the cause tough.
I fixed it using occ scan all but we need a smarter and pre-emptive fix, actually NextCloud guys suggest redis

Certainly I can, but, 1; like you, I’d like to avoid installing redis unnecessarily and 2; would like to be sure this is a real issue and will have to be addressed going forward, and… why are we bandaiding it, instead of NC ‘fixing’ it. I’m not sure what triggered these locks, haven’t seen them since in my install, and NC is stating it should only be necessary for large deployments, which doesn’t seem to apply to home or small business.

1 Like

I tried to do this, but I have no ida how to login to the database.
I have never used mariadb.
Can someone post the procedure here?
Thanks :smiley:

If you are using Nextcloud 11.0.2 or later (e.g. 12), and logged in as root:

sudo -u apache /opt/rh/rh-php56/root/usr/bin/php /usr/share/nextcloud/occ maintenance:mode --on
mysql nextcloud
DELETE FROM oc_file_locks WHERE 1;
sudo -u apache /opt/rh/rh-php56/root/usr/bin/php /usr/share/nextcloud/occ maintenance:mode --off

thanks :smiley:
worked like a charm <3