10

Something has gone awry with my ghostscript configuration, whereby I get the following errors when, for example, using epstopdf


 ./base/gsicc_manage.c:1088: gsicc_open_search(): Could not find default_gray.icc 
| ./base/gsicc_manage.c:1914: gsicc_init_iccmanager(): cannot find default icc profile
  ./base/gsicc_manage.c:1088: gsicc_open_search(): Could not find default_rgb.icc 
| ./base/gsicc_manage.c:1708: gsicc_set_device_profile(): cannot find device profile

**** Unable to open the initial device, quitting.
  ./base/gsicc_manage.c:1088: gsicc_open_search(): Could not find default_gray.icc 
| ./base/gsicc_manage.c:1708: gsicc_set_device_profile(): cannot find device profile
Unrecoverable error: unknownerror in .special_op
  ./base/gsicc_manage.c:1088: gsicc_open_search(): Could not find default_gray.icc 
+ ./base/gsicc_manage.c:2650: gs_setdefaultgrayicc(): cannot find default gray icc profile

I figured out the following workaround (inserted in my .bashrc)

alias gs='gs -sICCProfilesDir=/usr/share/color/icc/ghostscript/'<br>
alias epstopdf='epstopdf --gsopt=-sICCProfilesDir=/usr/share/color/icc/ghostscript/' <br>
alias ps2pdf='ps2pdf -sICCProfilesDir=/usr/share/color/icc/ghostscript/'

However, I couldn't find a way of making this setting 'global'. E.g. when say epstopdf is called from export_fig matlab it gives similar errors to above, unless I implement a similar workaround.

I think this has had knock-on effects of stopping printing from working properly on my system.

Ubuntu 16.04  
ghostscript, Version: 9.18~dfsg~0-0ubuntu2.6

Any assistance greatly appreciated.

Suraj Rao
  • 627
James
  • 121
  • 1
  • 4
  • Complete SWAG - but have you tried re-installing the libgs9-common package? – steeldriver Jun 13 '17 at 12:28
  • I did this with sudo dpkg --purge --force-depends libgs9-common ... sudo apt-get install libgs9-common. Hmm it apears to have fixed epstopdf but stopped the workaround functioning for gs. Should I go ahead and purge libgs9-common fully (uninstalling dependencies) then reinstall all the packages? – James Jun 13 '17 at 13:41
  • I don't know . . . I would have tried sudo apt install --reinstall libgs9-common rather than the lower-level dpkg, but I don't know if the outcome would be different. Do you know where the /usr/share/color/icc/ghostscript/ files come from? I can't find a package that provides them (the default color profiles appear to live in /usr/share/ghostscript/9.18/iccprofiles/) – steeldriver Jun 13 '17 at 13:53
  • Reinstalling via apt was the same. The workaround needed updating to /usr/share/ghostscript/9.18/iccprofiles/ as you say. Any other culprit things to try reinstalling? – James Jun 13 '17 at 14:13
  • Please run gs --help and copy the list of Search paths into your question. Are any relevant environment variables defined (env | grep GS_)? – steeldriver Jun 13 '17 at 16:51
  • By default no icc-file-containing location shows up in the search path list for gs --help. By adding export GS_LIB=/usr/share/ghostscript/9.18/iccprofiles/ to .bashrc it does appear with gs --help, as expected. However, bizarrely the error persists exactly as before. – James Jun 14 '17 at 08:37
  • I have exactly the same problem. Did you find a way to fix it? – Tobias Oct 03 '18 at 14:25

1 Answers1

22

Here's what worked for me:

sudo rmdir /usr/share/ghostscript/9.25/iccprofiles
sudo apt-get install --reinstall libgs9-common

Something had left an empty directory at /usr/share/ghostscript/9.25/iccprofiles. It appears that libgs9-common creates a symlink from /usr/share/ghostscript/9.25/iccprofiles to /usr/share/color/icc/ghostscript, but silently fails to create it if there's already something in the filesystem.

  • 6
    Worked for me too, in 18.04. – kaleissin Oct 13 '18 at 21:13
  • 1
    Amazing. I had printing completely broken on Ubuntu 18.04 and then on 18.10, then I realized Evince couldn't open PS files. Your solution works perfectly. – Andrea Lazzarotto Oct 21 '18 at 23:32
  • Ville, worked for me too! Thank you very much indeed! Was having problems with cups-pdf not printing into ~/PDF; turned out gs was failing with code 255 (thanks Volker for pointing that out) and to you for your recipe as it finally brought gs back from a broken state. – Robert Oct 26 '18 at 19:43