Error on syncing files - NC stops working


After transferring my NC installation to another webhoster, now NC Calendar and Contacts work well with Thunderbird / Lightning and also with DAVx and CalDAV / CardDAV on my Android.
But I have a problem syncing files. The issue began with my mistake, when I had Nextcloud file syncing on my desktop computer running with the old server and KeePassXC accessing its database file, which is synced via NC.
I added the connection to my new NC instance on the new hosting, while KeePassXC was running. As a result, NC on the new server wanted to sync the KeePass database file, while it was opened and also connected with the old NC instance.
The sync did crash: Error downloading https://…nextcloud…keepass.kdbx - server replied: Service Unavailable.

What I already have tried, to get rid of this problem:
Of course I closed KeePassXC first and made a copy of the KeePass database file. Second, I deleted the connection of NC file-syncing to the old webserver, so that there is only connection to the new installation left.
Third, I opened the NC database on the server via SQL admin and looked for locked files, but there was no such record.
Fourth, I deleted the keepass database file from the local NC sync folder. But the error remained.
Fifth, I looked to the syncing files on the server via ftp. Because syncing did not work, the keepass database file still was there. After I deleted the file, the error did not go away.
Sixth: I searched on the server as well as on lokal folders, wether there were further copies of this keepass database file. I found several of them and deleted them all.
But the error keeps on and file syncing via NC is dead!

On the server, I found nextcloud.log in the folder data. After all the above steps it gives me the following two errors repeatedly:
{“reqId”:“nnnnn”,“level”:3,“time”:“2019-06-06T15:05:43+00:00”,“remoteAddr”:“nnn.nnn.nnn.nnn”,“user”:“clara”,“app”:“PHP”,“method”:“GET”,“url”:"/remote.php/dav/files/password/keepass.kdbx",“message”:“fopen(/home/www/crm/nextcloud/data/password/files/keepass.kdbx): failed to open stream: No such file or directory at /home/www/crm/nextcloud/lib/private/Files/Storage/Local.php#284”,“userAgent”:“Mozilla/5.0 (Linux) mirall/2.3.3 (Nextcloud)”,“version”:“”}
{“reqId”:“nnnnnn”,“level”:4,“time”:“2019-06-06T15:05:43+00:00”,“remoteAddr”:“nnn.nnn.nnn.nnn”,“user”:“clara”,“app”:“webdav”,“method”:“GET”,“url”:"/remote.php/dav/files/password/keepass.kdbx",“message”:{“Exception”:“Sabre\DAV\Exception\ServiceUnavailable”,“Message”:“Could not open file”,“Code”:0,“Trace”:[{“file”:"/home/www/crm/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",“line”:85,“function”:“get”,“class”:“OCA\DAV\Connector\Sabre\File”,“type”:"->",“args”:[]},{“function”:“httpGet”,“class”:“Sabre\DAV\CorePlugin”,“type”:"->",“args”:[{“absoluteUrl”:“https://my-server/remote.php/dav/files/password/keepass.kdbx","class”:“Sabre\HTTP\Request”},{“class”:“Sabre\HTTP\Response”}]},{“file”:"/home/www/crm/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php",“line”:105,“function”:“call_user_func_array”,“args”:[[{“class”:“Sabre\DAV\CorePlugin”},“httpGet”],[{“absoluteUrl”:“https://my-server/remote.php/dav/files/password/keepass.kdbx","class”:“Sabre\HTTP\Request”},{“class”:“Sabre\HTTP\Response”}]]},{“file”:"/home/www/crm/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",“line”:479,“function”:“emit”,“class”:“Sabre\Event\EventEmitter”,“type”:"->",“args”:[“method:GET”,[{“absoluteUrl”:“https://my-server/remote.php/dav/files/password/keepass.kdbx","class”:“Sabre\HTTP\Request”},{“class”:“Sabre\HTTP\Response”}]]},{“file”:"/home/www/crm/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",“line”:254,“function”:“invokeMethod”,“class”:“Sabre\DAV\Server”,“type”:"->",“args”:[{“absoluteUrl”:“https://my-server/remote.php/dav/files/password/keepass.kdbx","class”:“Sabre\HTTP\Request”},{“class”:“Sabre\HTTP\Response”}]},{“file”:"/home/www/crm/nextcloud/apps/dav/lib/Server.php",“line”:316,“function”:“exec”,“class”:“Sabre\DAV\Server”,“type”:"->",“args”:[]},{“file”:"/home/www/crm/nextcloud/apps/dav/appinfo/v2/remote.php",“line”:35,“function”:“exec”,“class”:“OCA\DAV\Server”,“type”:"->",“args”:[]},{“file”:"/home/www/crm/nextcloud/remote.php",“line”:163,“args”:["/home/www/crm/nextcloud/apps/dav/appinfo/v2/remote.php"],“function”:“require_once”}],“File”:"/home/www/crm/nextcloud/apps/dav/lib/Connector/Sabre/File.php",“Line”:383,“CustomMessage”:"–"},“userAgent”:“Mozilla/5.0 (Linux) mirall/2.3.3 (Nextcloud)”,“version”:“”}

How can I get rid of this problem? Perhaps the database file is registered in the NC SQL database on the server and NC looks at this file and when it does not find it, it will stop syncing service?


First solution, which works on my desktop computer only:
I have given up, using Nextcloud desktop client and did install Nextcloud file syncing as a WebDAV volume. How to realize this, is described here: How to mount a WEbDAV share The desription is not complete: You will have to chwon -hR the webdav share to you as user.

But this solution does not work on my laptop because Xubuntu refuses to install webdav-fs2 due to a conflict with some libraries. Strange enough, that I even had not to install webdavfs2 on my desktop computer, because it was already there.
I will discuss the conflict in Ubuntu forum and I hope, to get a solution there.

If you are on Ubuntu, then you have also the pain of choosing nextcloud to install as “snap” or as appimage. With webdav, I overcome this ambivalence.


I have found the solution: The keepass database file has had some strange attributes with it, which have distorted the sync process on NC. As soon as NC could not process / handle this file, NC stopped syncing. The database file is positioned in the top folder of sync files and therefore it is processed at the beginning of the sync process.
First I stopped NC sync. After I had copied the database file from the local NC sync folder and did set clear user and file access rights, I deleted the original from the local folder and copied the manipulated / cleared file in there.
Then I deleted all instances of the database file in server side NC using FTP / Filezilla.
When I started NC sync again, it uploaded the local database file correctly and since that, it works as before this issue started.

BTW: The webDAV solution did only work until reboot. I am a beginner with Linux and could not find out, why there was webDAV snycing not available any more and all files were gone in the local webDAV folder. Further I found, that the webDAV folder had changed its user to root, so that I cannot full access it without sudo.
webDAV solution would be very nice… - if it would work like described in the above linked article. :wink: