[SOLVED] Server replied: Locked, can't sync Nextcloud folders. Webdav error

Nextcloud version (13.0.4) :
Operating system and version (Ubuntu 18.04) :
Apache version (Apache 2.4.29) :
PHP version (7.1.18) :

The output of /var/www/html/nextcloud/config/config.php :

<?php
$CONFIG = array (
  'instanceid' => 'xx',
  'passwordsalt' => 'xx',
  'secret' => 'xx',
  'trusted_domains' => 
  array (
    0 => '192.168.0.138',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'overwrite.cli.url' => 'http://192.168.0.138/nextcloud',
  'dbtype' => 'mysql',
  'version' => '13.0.4.0',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'xx',
  'dbpassword' => 'xx',
  'installed' => true,
);

The output of /etc/apache2/sites-available/nextcloud.conf :

<VirtualHost *:80>
     ServerAdmin admin@example.com
     DocumentRoot /var/www/html/nextcloud/
     ServerName 192.168.0.138
     ServerAlias 192.168.0.138

     Alias /nextcloud "/var/www/html/nextcloud/"

     <Directory /var/www/html/nextcloud/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
          <IfModule mod_dav.c>
            Dav off
          </IfModule>
        SetEnv HOME /var/www/html/nextcloud
        SetEnv HTTP_HOME /var/www/html/nextcloud
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

I have a folder on my computer which synced with my Nextcloud.
In this folder I unziped on archive and after some time deleted this folder.
But this folder was already synced to my Nextcloud and now it can’t be deleted frome Nexclloud because of error:

https://paste.ubuntu.com/p/5QcnzBC5zS/

I already had this error. I solved it, but for this I need to delete this files from my Ubuntu where Nextcloud is installed.
Now I want to solve this problem properly.
How to solve such errors?

I still can’t synchronize my nextcloud correctly.
When I delete some folders there are an error.
So I have to store this folder, otherwise synchronization will be off.

Please, tell me what logs I should provide you to solve this issue

Hi,

to solve your problem, you probably will have poke around in your NC database. From the config.php, I cannot see, whether or not you are using redis for locking. If not, the locking information will be stored in the database.

My suggestion would be:

  • stop NC (Apache)
  • search the oc_filecache table for your folder and delete the row pointing to it
  • delete everything from oc_file_locks, if you can’t make out which one points to your file
  • run a full file scan against your NC instance: sudo -u apache php occ files:scan --all
  • restart apache and try again
2 Likes

@budy, thanks for help!

systemctl stop apache2.service

I’m at first time in database, so I did only this:
https://paste.ubuntu.com/p/WTYy9F6CNX/
Please, give me a little bit more information about your second step.

This is my problem folder:
MariaDB [nextcloud]> select * from oc_filecache where name like “тест”;
±-------±--------±---------------------------------------------------------------±---------------------------------±-------±---------±---------±---------±----------±-----------±--------------±----------±-----------------±--------------±------------±---------+
| fileid | storage | path | path_hash | parent | name | mimetype | mimepart | size | mtime | storage_mtime | encrypted | unencrypted_size | etag | permissions | checksum |
±-------±--------±---------------------------------------------------------------±---------------------------------±-------±---------±---------±---------±----------±-----------±--------------±----------±-----------------±--------------±------------±---------+
| 122788 | 5 | files/Изображения/Фото/Nextcloud phone/тест | cd566f03e399ac5bda5b4ecbe395e344 | 108711 | тест | 2 | 1 | 514837567 | 1537210839 | 1537210839 | 0 | 0 | 5b9ff9d78db77 | 31 | |
±-------±--------±---------------------------------------------------------------±---------------------------------±-------±---------±---------±---------±----------±-----------±--------------±----------±-----------------±--------------±------------±---------+
1 row in set (0.05 sec)

Should I delete it?

Before deleting that row, you might want to check the oc_file:locks table, if the fileid is present there as well.

I didn’t find any similarity

MariaDB [nextcloud]&gt; select * from oc_file_locks;
https://paste.ubuntu.com/p/q2kWJP3T6J/

I just fixed this issue.
I had few problem folders.
For some reason I skipped step when I need to delete from oc_filecache
I just deleted all oc_file_locks table and made file scan. Scanning was going about 35 min.

mysql
use nextcloud;
delete from oc_file_locks;
sudo -u www-data php /var/www/html/nextcloud/occ files:scan --all

After this my Nextcloud client said to me that there are no connection to server, I deleted account from NC client and added it again, than I added my sync folder, deleted problem folders from my computer and synchronization goes fine
https://i.imgur.com/i12sVPJ.png

I fixed this issue but I think it will be back and I want to solve it forever.

Are those folders on external media - e.g. a SMB volume?

No, it is usual disk mounted in /mnt/files/

It may be this issue https://github.com/nextcloud/server/issues/8723 .

1 Like

Thank you, now I see that I’m not alone!
Today I again have Server replied: Locked with no reason.

This is very serious bug which blocking work of Nextcloud.

After upgrade to 14.04 issue is still active
https://paste.debian.net/1055885/

Looks like on 15.0.2 and now on 15.0.6 everything is fine. No locks. Thanks.

1 Like

I’m on 15.0.7 and I still get this problem.

When I try to delete the offending folder in the web UI (it’s been deleted on my desktop for weeks) I get an error: