[solved] Can't delete folder/file from trash

Nextcloud version (eg, 20.0.5): 24.0.9
Operating system and version (eg, Ubuntu 20.04): Debian 11
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.54
PHP version (eg, 7.4): 7.4
Group folders: 12.0.3

The issue you are facing:

A folder or file that has been deleted from inside a GroupFolder can’t be deleted.

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

This might have something to do with access permissions but not sure what am I doing wrong.

The output of your Nextcloud log in Admin > Logging:

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

 0. /var/www/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php line 68
    OCA\GroupFolders\Trash\TrashBackend->removeItem()
 1. /var/www/nextcloud/apps/files_trashbin/lib/Sabre/TrashRoot.php line 54
    OCA\Files_Trashbin\Trash\TrashManager->removeItem()
 2. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 179
    OCA\Files_Trashbin\Sabre\TrashRoot->delete()
 3. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 281
    Sabre\DAV\Tree->delete()
 4. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpDelete()
 5. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit()
 6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod()
 7. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
 8. /var/www/nextcloud/apps/dav/lib/Server.php line 358
    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 170
    require_once("/var/www/nextcl ... p")

DELETE /remote.php/dav/trashbin/2FA20EFE-6C76-4FF9-8740-F9EE35625126/trash
from 10.xx.xx.xx by 2FA20EFE-6C76-4FF9-8740-F9EE35625126 at 2023-02-08T09:35:36+00:00
[webdav] Fatal: OCP\Files\NotPermittedException:  at <<closure>>

 0. /var/www/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php line 68
    OCA\GroupFolders\Trash\TrashBackend->removeItem()
 1. /var/www/nextcloud/apps/files_trashbin/lib/Sabre/AbstractTrash.php line 89
    OCA\Files_Trashbin\Trash\TrashManager->removeItem()
 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 281
    Sabre\DAV\Tree->delete()
 4. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpDelete()
 5. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit()
 6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod()
 7. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
 8. /var/www/nextcloud/apps/dav/lib/Server.php line 358
    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 170
    require_once("/var/www/nextcl ... p")

DELETE /remote.php/dav/trashbin/2FA20EFE-6C76-4FF9-8740-F9EE35625126/trash/New%20Text%20Document.txt.d1670593783
from 10.xx.xx.xx by 2FA20EFE-6C76-4FF9-8740-F9EE35625126 at 2023-02-08T09:42:33+00:00

Not sure how this got resolved but…

After rescanning NC files, changing GroupFolder permissions (granting all), restoring some of the ‘locked’ files from trash, it cleared itself.

[core] Error: unable to rename, file does not exists : __groupfolders/trash/6/New folder.d1674114350

MOVE /remote.php/dav/trashbin/2FA20EFE-6C76-4FF9-8740-F9EE35625126/trash/New%20folder.d1670340687
from 10.xx.xx.xx by 2FA20EFE-6C76-4FF9-8740-F9EE35625126 at 2023-02-08T11:46:13+00:00

No more files in the rubbish folder.

Been playing with this for few moments and it looks like it is permissions and GroupFolder app.
To give you a little explanation, that’s what seems to be wrong.

I have a number of GroupFolders, one of which is called Templates.
My user belongs to a group that has full control (Write,Share,Delete) and same group has “Advanced Permissions” on that folder too.

The Advanced settings allow for self-imposed denial of access to Write&Delete within the folder (this is to allow only intentional interventions in the folder).

Now, if I undo the “Advanced Permissions” and delete a file/folder from within the Templates it will go in to the Trash and at this stage I can empty the trash too.

However, if I reapply the “Advanced Permissions” while the deleted file/folder is still in the trash it will get stuck and you can’t restore or delete it.

And now an interesting behaviour of the trash bin; If I attempt to restore a file from the trash after again changing “Advanced Permissions” to allow all, the file will go back to the Templates folder and will disappear without a trace (shows up for literarily a second and then gets deleted without going to the trash).

I think I’ll report that to the GroupFolder app issues :slight_smile:

Cheerio!