NC17.0.2 shows Trashbin files in user account allthough the data doesn't exist

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2): 17.0.2
Operating system and version (eg, Ubuntu 17.04): ubuntu-server 18.04.3
Apache or nginx version (eg, Apache 2.4.25): NGinx 1.17.4
PHP version (eg, 7.1): 7.3

The issue you are facing: Deleted files (2556 pics, docx, xlsx, …)
Trashbin shows all deleted files -> marking them and delete them finaly doesn’t work

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

Steps to replicate it:

  1. delete files
  2. try to delete them finaly by WebUI
  3. if that doesn’t work try deleting them by occ command trashbin:cleanup / --all-users

The output of your Nextcloud log in Admin > Logging: sadly no log entry in Nextcloud that corresponds to the action “files” or “delete” or. something else

In terminal no error
only: Remove deleted files of

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

> <?php
> $CONFIG = array (
>   'instanceid' => 'my id',
>   'passwordsalt' => 'my pass',
>   'secret' => 'my secret',
>   'trusted_domains' => 
>   array (
>     0 => 'my.domain.de',
>     1 => 'my.local.IP',
>   ),
>   'activity_expire_days' => 14,
>   'auth.bruteforce.protection.enabled' => 'false',
>   'blacklisted_files' => 
>   array (
>     0 => '.htaccess',
>     1 => 'Thumbs.db',
>     2 => 'thumbs.db',
>   ),
>   'trusted_proxies' => 
>   array (
>     0 => 'my.Proxy.IP',
>   ),
>   'overwritehost' => 'my.domain.de',
>   'overwriteconaddr' => '^IPpart1\\.IPpart2\\.IPpart3\\.IPpart4$',
>   'forward_for_headers' => 
>   array (
>     0 => 'X_FORWARDED_FOR',
>     1 => 'HTTP_X_FORWARDED_FOR',
>   ),
>   'datadirectory' => '/media/cloud/data',
>   'overwriteprotocol' => 'https',
>   'overwrite.cli.url' => '/',
>   'dbtype' => 'pgsql',
>   'version' => '17.0.2.1',
>   'dbname' => 'cloud',
>   'dbhost' => '127.0.0.1',
>   'dbport' => '',
>   'dbtableprefix' => 'oc_',
>   'dbuser' => 'db-user',
>   'dbpassword' => 'db-password',
>   'htaccess.RewriteBase' => '/',
>   'logtimezone' => 'Europe/Berlin',
>   'logfile' => '/media/cloud/data/nextcloud.log',
>   'log_rotate_size' => 10485760,
>   'cron_log' => true,
>   'installed' => true,
>   'filesystem_check_changes' => 0,
>   'quota_include_external_storage' => false,
>   'skeletondirectory' => '',
>   'share_folder' => '/Shares',
>   'knowledgebaseenabled' => false,
>   'ldapIgnoreNamingRules' => false,
>   'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
>   'ldapUserCleanupInterval' => 20,
>   'memcache.local' => '\\OC\\Memcache\\Redis',
>   'filelocking.enabled' => 'true',
>   'memcache.locking' => '\\OC\\Memcache\\Redis',
>   'redis' => 
>   array (
>     'host' => '/var/run/redis/redis.sock',
>     'port' => 0,
>     'timeout' => 0.0,
>     'password' => 'my.REDIS.Password',
>   ),
>   'mail_smtpmode' => 'smtp',
>   'mail_smtpsecure' => 'ssl',
>   'mail_from_address' => 'info',
>   'mail_domain' => 'mail.domain.de',
>   'mail_smtphost' => 'mail.domain.de',
>   'mail_smtpport' => '465',
>   'maintenance' => false,
>   'integrity.check.disabled' => false,
>   'updater.release.channel' => 'stable',
>   'enable_previews' => true,
>   'enabledPreviewProviders' => 
>   array (
>     0 => 'OC\\Preview\\PNG',
>     1 => 'OC\\Preview\\JPEG',
>     2 => 'OC\\Preview\\GIF',
>     3 => 'OC\\Preview\\BMP',
>     4 => 'OC\\Preview\\XBitmap',
>     5 => 'OC\\Preview\\Movie',
>     6 => 'OC\\Preview\\PDF',
>     7 => 'OC\\Preview\\MP3',
>     8 => 'OC\\Preview\\TXT',
>     9 => 'OC\\Preview\\MarkDown',
>   ),
>   'preview_max_x' => 1024,
>   'preview_max_y' => 768,
>   'preview_max_scale_factor' => 1,
>   'trashbin_retention_obligation' => 'auto, 7',
>   'loglevel' => 2,
>   'mail_sendmailmode' => 'smtp',
>   'updater.secret' => 'my.updater.secret',
> );

used this help page:
https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/occ_command.html?highlight=birthday#trashbin-label

Further info:

Setting the tags in front of each deleted file and using the “group-trigger” for deleting all tagged files in one action doesn’t work.

Clicking on the right side onto to three dots and pulling the trigger delete file permanently work for single files.

So is it the big amount of deleted files > 2500 that can’t be handled by Nextcloud 17?
My Server CPU is up to 100% while deleting files! (Tested with smaller amounts of 30-40 files in one action)

Seems so - because tagging only a few files (5-10 e.g.) then the “group-trigger” delete several files too.
But that’s not working for that big trashbin.

Any ideas? Is there an occ command to select only an specific amount of files

e.g.

php occ trashbin:cleanup <file01 - 200> …??

After many tries and errors …

I’m a step further now, so i can present errors from log!

[webdav] Fatal: Exception: Failed to remove item from trashbin at <<closure>>

 0. /var/www/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php line 69
    OCA\GroupFolders\Trash\TrashBackend->removeItem(OCA\GroupFolders\Trash\GroupTrashItem {})
 1. /var/www/nextcloud/apps/files_trashbin/lib/Sabre/AbstractTrash.php line 83
    OCA\Files_Trashbin\Trash\TrashManager->removeItem(OCA\GroupFolders\Trash\GroupTrashItem {})
 2. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 179
    OCA\Files_Trashbin\Sabre\AbstractTrash->delete()
 3. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 287
    Sabre\DAV\Tree->delete("trashbin/ ... 4")
 4. <<closure>>
    Sabre\DAV\CorePlugin->httpDelete(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
 5. /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    undefinedundefinedcall_user_func_array([Sabre\DAV\CorePlugin {},"httpDelete"], [Sabre\HTTP\Requ ... }])
 6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    Sabre\Event\EventEmitter->emit("method:DELETE", [Sabre\HTTP\Requ ... }])
 7. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
 8. /var/www/nextcloud/apps/dav/lib/Server.php line 317
    Sabre\DAV\Server->exec()
 9. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
10. /var/www/nextcloud/remote.php line 163
    undefinedundefinedrequire_once("/var/www/nextcl ... p")

DELETE /remote.php/dav/trashbin/user1/trash/Musterl%C3%B6sung.d1577979144
from Client-IP by user1 at 2020-01-04T17:14:00+01:00

Update 05.01.2020:

Today i checked my logfiles again and saw those Messages

[PHP] Error: fopen(/media/cloud/data/__groupfolders/trash/1/filename.xlsx.d1577979260): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#301

GET /apps/files_trashbin/preview?fileId=2676324&file=%2FKfilename.xlsx.d1432811766&c=1432811766
from Client-IP by user at 2020-01-05T06:46:29+01:00

So i checked my files

/media/Cloud/data/__groupfolders/1/….users (= no data)

/media/Cloud/data/__groupfolder/trash/1/…. (= no data)

so far so good.
The PostgreSQL DB says

oc_files_trash AND oc_group_folder_trash both empty
ok good.

But when Login to my user account and opening “Deleted Files” webui page is still not empty.
There resist round About 130 files and Folders that can’t be deleted permanently nor undeleted . Refreshed / cleared Cache of the browser - no effect.

Where did nextcloud get’s the data for the resisting files?

My Logfiles delivers today new messages of the type …

[webdav] Fatal: Exception: Failed to remove item from trashbin at <<closure>>

 0. /var/www/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php line 69
    OCA\GroupFolders\Trash\TrashBackend->removeItem(OCA\GroupFolders\Trash\GroupTrashItem {})
 1. /var/www/nextcloud/apps/files_trashbin/lib/Sabre/AbstractTrash.php line 83
    OCA\Files_Trashbin\Trash\TrashManager->removeItem(OCA\GroupFolders\Trash\GroupTrashItem {})
 2. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 179
    OCA\Files_Trashbin\Sabre\AbstractTrash->delete()
 3. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 287
    Sabre\DAV\Tree->delete("trashbin/user ... 5")
 4. <<closure>>
    Sabre\DAV\CorePlugin->httpDelete(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
 5. /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    undefinedundefinedcall_user_func_array([Sabre\DAV\CorePlugin {},"httpDelete"], [Sabre\HTTP\Requ ... }])
 6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    Sabre\Event\EventEmitter->emit("method:DELETE", [Sabre\HTTP\Requ ... }])
 7. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
 8. /var/www/nextcloud/apps/dav/lib/Server.php line 317
    Sabre\DAV\Server->exec()
 9. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
10. /var/www/nextcloud/remote.php line 163
    undefinedundefinedrequire_once("/var/www/nextcl ... p")

DELETE /remote.php/dav/trashbin/user/trash/Neuer%20Ordner.d1577979315
from Client-IP by user at 2020-01-06T18:52:40+01:00

Any ideas, how to repair the trashbin functionality?

I really need help with that.

Have moved tons of files to another interim space.
Have double checked occ:files scan

Then i did php occ groupfolders:list to get true ID
Then php occ groupfolders:scan ID (nothing -> trashbin still full of files)
Then php occ groupfolders:expire -> ID were expired
Then checked trashbin (still full of ghost files / folders had been deleted)
Then php occ groupfolders:delete ID

Then getting a error message:

In AbstractPostgreSQLDriver.php line 79:
                                                                               
  An exception occurred while executing 'SELECT "folder_id", "mount_point", "  
  quota", "size", "acl" FROM "oc_group_folders" "f" LEFT JOIN "oc_filecache"   
  "c" ON ("name" = ("f"."folder_id" || '')) AND ("parent" = ?) WHERE "folder_  
  id" = ?' with params [3505604, "GROUP-ID"]:                                   
                                                                               
  SQLSTATE[22P02]: Invalid text representation: 7 FEHLER:  ungültige Eingabes  
  yntax für Typ bigint: »GROUP-ID«     

Then redo command to scan groupfolders
Then twice redo command to delete groupfolders

Then success! Groupfolder gone, checked trashbin -> empty (finally!)

Then re-enabled groupfolder
php occ groupfolders:create …

double checked trashbin - > still empty

test deleted files / folders and test deleted permanently trashbin again -> working.

Hello chrissi55,

what is the “redo” command you’ve applied? Could you please give an detailed explanation of the steps?

Greets

Haydar

as i wrote above

php occ groupfolders:scan -> ID
php occ groupfolders:expire -> ID
php occ groupfolders:delete -> ID