jonaswinkler / paperless-ng

A supercharged version of paperless: scan, index and archive all your physical documents
https://paperless-ng.readthedocs.io/en/latest/
GNU General Public License v3.0
5.38k stars 356 forks source link

[BUG] document_exporter fails when target is an NTFS file system #1513

Open CMahaff opened 2 years ago

CMahaff commented 2 years ago

Running version 1.5.0 on a Raspberry Pi 4, using the docker compose instructions.

All paperless directories (export, data, media, consume) were pointing to a USB hard drive attached to the Pi. When the export directory pointed to a folder on the NTFS file system of the external USB hard drive, this error is thrown trying to run "document_exporter ../export" from a bash terminal within the docker container:

  File "/usr/src/paperless/src/manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/usr/src/paperless/src/documents/management/commands/document_exporter.py", line 90, in handle
    self.dump(options['no_progress_bar'])
  File "/usr/src/paperless/src/documents/management/commands/document_exporter.py", line 196, in dump
    self.check_and_copy(document.source_path,
  File "/usr/src/paperless/src/documents/management/commands/document_exporter.py", line 251, in check_and_copy
    shutil.copy2(source, target)
  File "/usr/local/lib/python3.9/shutil.py", line 436, in copy2
    copystat(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/local/lib/python3.9/shutil.py", line 375, in copystat
    lookup("utime")(dst, ns=(st.st_atime_ns, st.st_mtime_ns),
PermissionError: [Errno 1] Operation not permitted

The first file at least appears to be partially written, but that's all the further it gets. It looks like it's a problem with utime and NTFS: https://bugs.launchpad.net/ubuntu/+source/ntfs-3g/+bug/124795

Switching the export directory to point to a location on the pi (using ext4 file system) allowed the export to complete successfully.

Hardy74 commented 2 years ago

Same issue for me. Will this be fixed soon?