Local files disappeared & Error while restoring files from trashbin

Nextcloud version (eg, 12.0.2): about button just says “A safe home for all your data” (Which is a bit worrying as it has deleted all my files!
Operating system and version (eg, Ubuntu 17.04): unRAID Docker & Windows 10
Apache or nginx version (eg, Apache 2.4.25): Don’t know
PHP version (eg, 7.1): Don’t know

Hi, all my local files have disappeared, the folders are intact but all the files have gone! I am trying to restore from the trashbin using the webui and it immediately gives the error “Error while restoring files from trashbin” but I can see the counter go down from 9129 files to 8067 before hanging. I can refresh the browser (tried Chrome & Edge) and the same thing will happen albiet the total file count is lower each time.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. no idea, been using for a few weeks and all my files have gone!

The output of your Nextcloud log in Admin > Logging:

{"reqId":"ZsrqZicqvW4IyDr7zcBu","level":4,"time":"2019-08-28T10:00:41+00:00","remoteAddr":"172.18.0.3","user":"mbc0","app":"webdav","method":"MOVE","url":"/remote.php/dav/trashbin/mbc0/trash/Benefits%20Letter.doc.d1566883851","message":{"Exception":"OCP\\Lock\\LockedException","Message":"\"files/8070a0951be21f7742cbd5c3da729c9b\" is locked","Code":0,"Trace":[{"file":"/config/www/nextcloud/lib/private/Files/Storage/Common.php","line":715,"function":"acquireLock","class":"OC\\Lock\\DBLockingProvider","type":"->","args":["files/8070a0951be21f7742cbd5c3da729c9b",2]},{"file":"/config/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":593,"function":"acquireLock","class":"OC\\Files\\Storage\\Common","type":"->","args":["scanner::files_trashbin/versions",2,{"__class__":"OC\\Lock\\DBLockingProvider"}]},{"file":"/config/www/nextcloud/lib/private/Files/Cache/Scanner.php","line":331,"function":"acquireLock","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["scanner::files_trashbin/versions",2,{"__class__":"OC\\Lock\\DBLockingProvider"}]},{"file":"/config/www/nextcloud/apps/files_trashbin/lib/Trashbin.php","line":868,"function":"scan","class":"OC\\Files\\Cache\\Scanner","type":"->","args":["files_trashbin/versions"]},{"file":"/config/www/nextcloud/apps/files_trashbin/lib/Trashbin.php","line":480,"function":"getVersionsFromTrash","class":"OCA\\Files_Trashbin\\Trashbin","type":"::","args":["Benefits Letter.doc",1566883851,"mbc0"]},{"file":"/config/www/nextcloud/apps/files_trashbin/lib/Trashbin.php","line":432,"function":"restoreVersions","class":"OCA\\Files_Trashbin\\Trashbin","type":"::","args":[{"__class__":"OC\\Files\\View"},"/Benefits Letter.doc.d1566883851","Benefits Letter.doc","Benefits Letter.doc","Desktop PC/Documents/Personal/Divorce",1566883851]},{"file":"/config/www/nextcloud/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php","line":83,"function":"restore","class":"OCA\\Files_Trashbin\\Trashbin","type":"::","args":["/Benefits Letter.doc.d1566883851","Benefits Letter.doc",1566883851]},{"file":"/config/www/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php","line":65,"function":"restoreItem","class":"OCA\\Files_Trashbin\\Trash\\LegacyTrashBackend","type":"->","args":[{"__class__":"OCA\\Files_Trashbin\\Trash\\TrashItem"}]},{"file":"/config/www/nextcloud/apps/files_trashbin/lib/Sabre/AbstractTrash.php","line":87,"function":"restoreItem","class":"OCA\\Files_Trashbin\\Trash\\TrashManager","type":"->","args":[{"__class__":"OCA\\Files_Trashbin\\Trash\\TrashItem"}]},{"file":"/config/www/nextcloud/apps/files_trashbin/lib/Sabre/RestoreFolder.php","line":75,"function":"restore","class":"OCA\\Files_Trashbin\\Sabre\\AbstractTrash","type":"->","args":[]},{"file":"/config/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":158,"function":"moveInto","class":"OCA\\Files_Trashbin\\Sabre\\RestoreFolder","type":"->","args":["Benefits Letter.doc.d1566883851","trashbin/mbc0/trash/Benefits Letter.doc.d1566883851",{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"}]},{"file":"/config/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":642,"function":"move","class":"Sabre\\DAV\\Tree","type":"->","args":["trashbin/mbc0/trash/Benefits Letter.doc.d1566883851","trashbin/mbc0/restore/Benefits Letter.doc.d1566883851"]},{"function":"httpMove","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https://nextcloud.embyserver.co.uk:443/remote.php/dav/trashbin/mbc0/trash/Benefits%20Letter.doc.d1566883851","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/config/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpMove"],[{"absoluteUrl":"https://nextcloud.embyserver.co.uk:443/remote.php/dav/trashbin/mbc0/trash/Benefits%20Letter.doc.d1566883851","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/config/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:MOVE",[{"absoluteUrl":"https://nextcloud.embyserver.co.uk:443/remote.php/dav/trashbin/mbc0/trash/Benefits%20Letter.doc.d1566883851","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/config/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https://nextcloud.embyserver.co.uk:443/remote.php/dav/trashbin/mbc0/trash/Benefits%20Letter.doc.d1566883851","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/config/www/nextcloud/apps/dav/lib/Server.php","line":316,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/config/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/config/www/nextcloud/remote.php","line":163,"args":["/config/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/config/www/nextcloud/lib/private/Lock/DBLockingProvider.php","Line":209,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36","version":"16.0.3.0","id":"5d665643469cf"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

PASTE HERE<?php
$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'datadirectory' => '/data',
  'instanceid' => 'ocfrseevhqu4',

  'trusted_domains' => 
  array (
    0 => '192.168.0.33:444',
	1 =>'nextcloud.(Deleted).co.uk',
	2 =>'192.168.11.34',
	3 =>'192.168.0.12',
	),
  'dbtype' => 'mysql',
  'version' => '16.0.3.0',
  'overwrite.cli.url' => 'https://nextcloud.(Deleted).co.uk',
  'overwritehost' => 'nextcloud.(Deleted)co.uk',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud',
  'dbhost' => '192.168.0.33:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '(Deleted)
  'installed' => true,
);

The output of your Apache/nginx/system log in /var/log/____:

2019/08/05 15:13:52 [error] 328#328: *2 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused in /config/www/nextcloud/lib/private/DB/Connection.php:64
Stack trace:
#0 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(448): OC\DB\Connection->connect()
#1 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(410): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(354): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(710): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /config/www/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(181): OC\DB\Connection->__construc...PHP message: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused in /config/www/nextcloud/lib/private/DB/Connection.php:64
Stack trace:
#0 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(448): OC\DB\Connection->connect()
#1 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(410): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(354): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(710): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /config/www/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)

You have problems with connection to your Database. Please check if your MySQL DB is up and running first.

Hi,

Thanks for the reply, the database is running fine, I get these connection errors and if I restart the Windows app it carries on again, any idea why all my local files got deleted and why I am having connection issues? Nextcloud is just one of many dockers I have running 24/7 and I never have any connection issues so I would presume a configuration issue rather than a physical issue. Also Nextcloud has always had these connection/configuration errors ever since install but I read others did to and presumed that a fix would come, I never expected to lose all my files.

Hi, Can anyone help me diagnose this please?

Thank you

Hi, am I doing something wrong asking for support with this issue or can nobody help?

Thanks

Not a docker expert, but could you please do 2 things:

  1. Just check via GUI if your files in a nextcloud at least listed.
  2. Do you have Activity App installed? Check if there some kind of activities saved - files massively deleted.

That was easy part.

  1. Check if files are still saved somewhere on FS: where did you install the Nextcloud I see your data directory mounted under /data, please go there under folder with your user name and then files, e.g. for your nikname: /data/mbc0/files/and check if files are still there e.g. ls -lato get list of files and folders.
  2. Check your trash bin under similar path: /data/mbc0/files_trashbin/ may be because of known trash bin bug you can’t see the content of it.
    If you find your files, copy them gently to the safe place out of there and try to find out what was wrong.

P.S. You posted relevant information like passwordsalt, secret, etc. you have to change it in your server afterwards.

Okay, the first question is: are the files still physically in your Nextcloud data folder?

Could you elaborate on this?

Also just FYI you should omit salts and secrets when posting your config.

Hi,

Thanks for your reply!

I have removed the personal information, thank you but this is just a test anyway so nothing to be of any use to anyone

1, All my files existed on nextcloud and locally (Win10 machine) after 2 weeks the files (not folders) disappeared from my local machine and nextcloud but I found them in the trash bin on Nextcloud, it took quite a few attempts of restoring them all due to connection issues (just using the webui) but they have all been restored now locally and on nextcloud.

2, I do not have any activity apps installed, can you recommend one? I know it’s too late for whats happened but maybe for the future?

3, As per answer 1, they were all in the trash bin

4, as per 1 & 3

Thank you!

1 Like

I get connection errors when transferring data from my local machine to nextcloud, it will transfer several hundred GB’s or a couple of TB then throw a connection error (I mentioned this is a previous post as I could not connect to nextcloud using my 10GB fibre connection but that is sorted now. I was hoping that now the main bulk of my upload is done I might not get connection issues?

Activity app is a part of official delivery, will show what and when was created/moved/deleted. It could help in your case to see when files were moved to trash bin.


Also I’m very glad that files were there and you can successfully restore them.

Thank you, yes I can see what you mean now, is there a way to move through the list quicker? as I have restored tens of thousands of files scrolling through a notification of each file restored would take an eternity! :smiley: