Skip to content

Change Scanservjs ImageMagick Temp Directory #751

Description

@BertQuodge

Hi

I run sane and scanservjs on a Pi4 with 4GB of RAM on Debian Bookworm. If I perform a 300dpi scan my system works ok. If I perform a scan, via scanservjs, with a resolution of 1200 the scans the image ok but I receive an error message on the scanservjs web page saying:

{"message","/usr/bin/convertdata/temp/~tmp-scan-0-0001.tif - extent 868x1194-0-0 data/preview/preview.tif exited with a code:1, stderr: convert:unable to write to pixel cache '/tmp/magik-xxxx'; No space left on device @ error/cache.s/WritePixelCachePixels/6012\nconvert: No images defined 'data/preview/preview.tif' @ error/convert.c/ConvertImageCommand/3329\n, "code": -1}

I assume this is because /tmp is full. I've tried to change the directory ImageMagick use from /tmp but the changes I've tried don't fix the issue. /tmp is still being used.

I've tried adding this to the systemd entry that starts scanservjs by adding the text below to /lib/systemd/system/saned.service

Environment=MAGICK_TMPDIR=/mnt/internal_disk/scanserv_data_folder/scanservjs/TempScanFileStore
Environment=MAGICK_TEMPORARY_PATH=/mnt/internal_disk/scanserv_data_folder/scanservjs/TempScanFileStore

I've also tried changing the /tmp entry in /etc/ImageMagick-6/policy.xml:

from

<policymap>
  <!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->

to

<policymap>
  <!-- <policy domain="resource" name="temporary-path" value="/mnt/internal_disk/scanserv_data_folder/scanservjs/TempScanFileStore"/> -->

Neither of these attempts have changed the error message, the errors still point to /tmp being full. The Pi is only running sane and scanservjs.

fstab on the Pi sets /tmp to 1Gb. . If I increase /tmp to a max size of 3GB the scan works ok, I can also see a 1.1GB file is created in /tmp:

-rw------- 1 scanservjs users 1.1G Apr 7 13:05 magick-C4D7kJdfAcKEMBX3HlaQEhEtNel1bjrw

I'd like to tell magick to use another disk area other than /tmp, do you know how I can do this?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions