Menu

#320 Error message on startup: pdftk can't use /tmp

v1.0_(example)
closed-fixed
nobody
None
5
2019-04-16
2019-04-11
Peter Major
No

gscan2pdf v2.5.1; OS: Mint 18.3.
Full text of error message on startup: "pdftk is installed, but cannot access the directory used for temporary files.One reason for this might be that pdftk was installed via snap.In this case, removing pdftk, and reinstalling without using snap would allow gscan2pdf to use pdftk. Another workaround would be to select a temporary directory under your home directory in Edit/Preferences."
Followed by a second message: "Warning: missing packages
PDF encryption requires pdftk."
Directory for temporary files is set to /tmp, which has standard ownership and permissions:
drwxrwxrwt 17 root root 4096 Apr 11 16:25 /tmp
I haven't had this error with previous versions of gscan2pdf ( last in use was v2.1.2 ). pdftk (v2.02) was not installed by snap.

Discussion

  • Peter Major

    Peter Major - 2019-04-11

    I should have added that pdf documents can still be saved, but conversion from the internal format takes a long time.

     
  • Michael Blum

    Michael Blum - 2019-04-15

    gscan2pdf2.5.1 , Mint 19.1
    This error is actually not due a problem with either the '/tmp' directory or with the 'pdftk' utility, but is instead because of an ImageMagick security policy implemented by Mint & its parent Ubuntu, so for me at least designating an alternate temporary directory does not work. Here's my analysis & work-around:

    • Lines 749 & 750 of gscan2pdf 2.5.1 invoke the ImageMagick 'convert' utility to create a test PDF file.
    • This fails under Mint because the '/etc/ImageMagick-6/policy.xml' file includes the line
      <policy domain="coder" rights="none" pattern="PDF" /> which prohibits the PDF conversion.
      This is all because of security concerns for ImageMagick which are documented at 'https://www.enisa.europa.eu/publications/info-notes/what2019s-behind-imagemagick-vulnerability'.
    • Web page 'https://askubuntu.com/questions/1081895/trouble-with-batch-conversion-of-png-to-pdf-using-convert' discusses the problem further. The comment on that page states that the problem is with converting multiple files to one PDF file, but I don't think this is true. You will see the 'not authorized' error if at the command line you enter 'convert rose: /tmp/x.pdf', which is the command that gscan2pdf uses.
    • The work-around as documented on that page is simply to comment out the above policy line.
     

    Last edit: Michael Blum 2019-04-15
  • Jeffrey Ratcliffe

    Thanks, Michael. It hadn't occurred to me that the problem might be creating the PDF with imagemagick. Now I can reproduce the issue, too.

    I'll test for pdftk by creating a tiff with imagemagick, and converting to pdf with tiff2pdf.

    This will fix the problem for the next release.

     
  • Jeffrey Ratcliffe

    • status: open --> closed-fixed
     
  • Peter Major

    Peter Major - 2019-04-16

    Thanks Michael. An excellent analysis. Your suggested workround solved the immediate problem for me, And thanks, Jeffrey, for finding a fix for the next release. I find gscan2pdf soooo useful.

     

Log in to post a comment.

Auth0 Logo