[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 :

$CONFIG = array (
  'instanceid' => 'xx',
  'passwordsalt' => 'xx',
  'secret' => 'xx',
  'trusted_domains' => 
  array (
    0 => '',
  'datadirectory' => '/var/www/html/nextcloud/data',
  'overwrite.cli.url' => '',
  'dbtype' => 'mysql',
  'version' => '',
  '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/

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

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

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


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:


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


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

@budy, thanks for help!

systemctl stop apache2.service

I’m at first time in database, so I did only this:
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;

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.

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

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

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: