Paperless-ngx: Deleting document from trash fails with [Errno 1]

Hello,
Paperless-ngx works great and flawless.
Deleting documents also work, they are visible in the trash afterwards.

The issue is: deleting documents finally from the trash is failing.

Consequence: the documents remain in the folders thumbnails, originals and archive and I have to delete them manually (much work and risky):

From Log file:
[2025-03-02 13:37:19,347] [INFO] [paperless.tasks] ConsumeTaskPlugin completed with: Success. New document id 1321 created

[2025-03-02 13:38:46,309] [DEBUG] [paperless.handlers] Moving /usr/src/paperless/media/documents/originals/2025/20250224, _Zulieferer, Rechnung.pdf to trash at /usr/src/paperless/trash/20250224, _Zulieferer, Rechnung.pdf

[2025-03-02 13:38:46,310] [ERROR] [paperless.handlers] Failed to move /usr/src/paperless/media/documents/originals/2025/20250224, _Zulieferer, Rechnung.pdf to trash at /usr/src/paperless/trash/20250224, _Zulieferer, Rechnung.pdf: [Errno 1] Operation not permitted: ‘/usr/src/paperless/trash/20250224, _Zulieferer, Rechnung.pdf’. Skipping cleanup!

[2025-03-02 13:38:46,317] [INFO] [paperless.tasks] Deleted 0 documents from trash

From the paperless-ngx container shell:
Using ‘id’ shows:
uid=0(root) gid=0(root) groups=0(root),568(paperless)

Deleting documents with ‘rm’ works

From installation dialog:
User ID: 568 (apps)
Group ID: 568 (apps)

From Dataset:
Owner: apps (allow | full control)
Group: apps (allow | modify)

Guess this is a permission issue, but I do not see it.
Any idea? Any obvious?

are you using different datasets for trash and media? Error states the move from media to trash failed

Everything is in the same dataset, but the storage locations for ‘media’, ‘consume’, … and also ‘trash’ are in separate child-datasets.
At least ‘media’ and ‘trash’ do have the same permissions.

Generally moves should be atomic if things are written correctly. The error message indicates you’re either:

  1. moving across a filesystem boundary
  2. app is maybe poorly designed and not ensuring atomicity of moves

The error message means the path may be a ZFS dataset with the aclmode set to RESTRICTED. Verify its settings and if it is RESTRICTED, change to PASSTHROUGH.

Result:
ACL Type = POSIX
ACL Mode = Discard
As far as I know this combination in general is ok, but I have to investiagate if it is interfering with chmod here.

You can also encounter chmod errors if you are not root and don’t own the file.

Obviously I checked the Dataset above, having POSIX + Discard.
But checking the Child-Datasets showed indeed SMB/NFSv4 + Restricted!

After disabling linked SMB-Shares (otherwise you get an error message) I switched all Child-Datasets to SMB/NFSv4 + Passthrough! Then enabled SMB-Shares again - surprise: it works!

1 Like

Dear awalkerix,
Thank you so much!

I search for hours and honestly speaking I never had the idea of looking so deep under the hood. POSIX- / NFSv4-ACL - there’s still a lot to learn :slight_smile: