3

I have the same problem as reported Lyx, Error Converting to Loadable Format for PDFs but I am using Ubuntu 18.04, and solutions are only described for Windows and MacOS.

Here are the stderr messages if I run LyX from the command line:

convert-im6.q16: not authorized `/tmp/lyx_tmpdir.mJCcewM29047/gconverts29047.eps' @ error/constitute.c/ReadImage/412.
convert-im6.q16: no images defined `/tmp/lyx_tmpdir.mJCcewM29047/gconverts29047.png' @ error/convert.c/ConvertImageCommand/3258.

The LyX wiki solutions https://wiki.lyx.org/LyX/FiguresInLyX also don't apply, since my versions are:

ImageMagick 6.9.7-4

Ghostscript 9.25 (2018-09-13)

My /etc/ImageMagick-6/policy.xml looks like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policymap [
<!ELEMENT policymap (policy)+>
<!ELEMENT policy (#PCDATA)>
<!ATTLIST policy domain (delegate|coder|filter|path|resource) #IMPLIED>
<!ATTLIST policy name CDATA #IMPLIED>
<!ATTLIST policy rights CDATA #IMPLIED>
<!ATTLIST policy pattern CDATA #IMPLIED>
<!ATTLIST policy value CDATA #IMPLIED>
]>
<!--
...(comments excised for brevity)...
-->
<policymap>
  <!-- <policy domain="resource" name="temporary-path" value="/tmp"/> 
-->
  <policy domain="resource" name="memory" value="256MiB"/>
  <policy domain="resource" name="map" value="512MiB"/>
  <policy domain="resource" name="width" value="16KP"/>
  <policy domain="resource" name="height" value="16KP"/>
  <policy domain="resource" name="area" value="128MB"/>
  <policy domain="resource" name="disk" value="1GiB"/>
  <!-- <policy domain="resource" name="file" value="768"/> -->
  <!-- <policy domain="resource" name="thread" value="4"/> -->
  <!-- <policy domain="resource" name="throttle" value="0"/> -->
  <!-- <policy domain="resource" name="time" value="3600"/> -->
  <!-- <policy domain="system" name="precision" value="6"/> -->
  <!-- not needed due to the need to use explicitly by mvg: -->
  <!-- <policy domain="delegate" rights="none" pattern="MVG" /> -->
  <!-- use curl -->
  <policy domain="delegate" rights="none" pattern="URL" />
  <policy domain="delegate" rights="none" pattern="HTTPS" />
  <policy domain="delegate" rights="none" pattern="HTTP" />
  <!-- in order to avoid to get image with password text -->
  <policy domain="path" rights="none" pattern="@*"/>
  <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/>
  <!-- disable ghostscript format types -->
  <policy domain="coder" rights="none" pattern="PS" />
  <policy domain="coder" rights="none" pattern="EPI" />
  <policy domain="coder" rights="read|write" pattern="PDF" />
  <policy domain="coder" rights="none" pattern="XPS" />
  <policy domain="coder" rights="read|write" pattern="LABEL" />
</policymap>
9
  • 1
    I had a similar issue on Ubuntu 18.04. This thread helped me solve the problem: stackoverflow.com/questions/42928765/…
    – scottkosty
    Nov 28, 2018 at 17:43
  • @scottkosty Curiously, my policy.xml file already looks like the updated version.
    – CPBL
    Nov 28, 2018 at 21:12
  • Can you convert the PDF on the command line? Can you give the terminal output, if there is an error, when you try the conversion on the command line (i.e., outside of LyX)?
    – scottkosty
    Nov 28, 2018 at 23:03
  • convert myPDFfigure.pdf myPDFfigure.png works perfectly on the command line. I'm actually not clear on what the conversion that LyX needs is. PDF->png is not listed in the LyX converter definitions.
    – CPBL
    Nov 30, 2018 at 3:22
  • 1
    Great! Go ahead and add & accept your answer to mark this is solved. Glad it's sorted out!
    – scottkosty
    Dec 1, 2018 at 3:31

1 Answer 1

4

The solution was to edit ImageMagick's policy.xml file. Even though it was a PDF that I supplied to LyX, and LyX ends up with a PNG, it was lacking permissions for EPS (PS).

Thus, in /etc/ImageMagick-6/policy.xml I changed

<policy domain="coder" rights="none" pattern="PS" />

to

<policy domain="coder" rights="read|write" pattern="PS" />

Diagnosis all thanks to @ScottKosty; see comments following my question.

1
  • Just worked for me on Linux Mint 19.3.
    – jaia
    Jul 22, 2020 at 1:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .