Error when I run ghostscript command on centos 7

Viewed 10

I have installed Ghostscript on centos7 server.

When I simply command "gs" it return following

GPL Ghostscript 9.25 (2018-09-13) Copyright (C) 2018 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. GPL Ghostscript 9.25: Cannot open X display `(null)'. **** Unable to open the initial device, quitting.

When I try to make thumbnail to pdf by following command

gs -sDEVICE=pngalpha -dFirstPage=1 -dLastPage=1 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r200 -o tmp/foo.png bar.pdf

it return following result GPL Ghostscript 9.25 (2018-09-13) Copyright (C) 2018 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Processing pages 1 through 1. Page 1 Segmentation fault

above both command working fine when I run these command on different system.

Help to figure out issue on centos system.

1 Answers

Unfortunately, I'm able to reproduce this issue with random PDFs on a CentOS 7 system. It seems like it's a bug in Ghostscript as shipped in Red Hat Enterprise Linux 7 including clones/derivatives like CentOS 7. The issue is maybe already known at Ghostscript upstream as bug #699815 "Segmentation fault for pdf input to pngalpha driver".

However as Red Hat Enterprise Linux 7 is, according to Red Hat Enterprise Linux Life Cycle, already in Maintenance Support 2 Phase, it's from my experience highly unlikely that Red Hat is going to fix this issue during the remaining product lifecycle, because only "selected (at Red Hat discretion) Urgent Priority Bug Fix Advisories (RHBAs) may be released" (and usually only on request of Red Hat customers with a paid RHEL subscription).

Even it's most likely not the answer you're looking for, there are not many options left. Please try a newer RHEL clone/derivative (e.g. Rocky Linux 9) which includes a newer version of Ghostscript, or try to patch the old Ghostscript on your own by adding the upstream patch to the existing SRPM package.

Related