Bug with psconvert? gmt begin <name> png fails, but gmt begin <name> png,ps works

Hi,

I recently reinstalled my operating system (Kubuntu 26.04) and noticed a strange issue with GMT.

The following script works as expected:

gmt begin 3 png,ps
    gmt basemap -R0/1/0/1 -Baf
gmt end

However, if I remove the ps format:

gmt begin 3 png
    gmt basemap -R0/1/0/1 -Baf
gmt end

I get the following error:

Error: /undefinedfilename in (/home/esteban82/.gmt/sessions/gmt_session.43357/gmt_0.ps-)

Last OS error: Permission denied

psconvert [ERROR]: System call [gs -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true '/home/esteban82/.gmt/sessions/gmt_session.43357/gmt_0.ps-' 2> '/home/esteban82/.gmt/sessions/gmt_session.43357/psconvert_43374c.bb'] returned error 256.

end [ERROR]: Failed to call psconvert
end [ERROR]: gmtinit_process_figures returned error 79

Has anyone seen this before? Could this be related to Kubuntu 26.04, Ghostscript, file permissions, or a GMT configuration issue introduced during the OS reinstall?

gmt version: 6.7.0_7b70493_2026.06.01
gs version: 10.06.0

Any suggestions on what I should check would be appreciated.

Thanks,
Federico

My first guess would be to ls -lR /home/esteban82/.gmt/ to see if anything is owned by root, this might be the case if you accidentally run a script under sudo

A Linux Mint user here
Not confirming the issue
gmt 6.3.0 (system) and 6.6.0 (conda/mamba), gs 9.55.0 or 10.04.0, respectively. All good.

Maybe try running gmt end -Vd to check verbose/debug output?

The error is saying that the syscall to gs has no rights to write in /home/esteban82/.gmt/sessions/gmt_session.43357 but this cannot (??) be a permissions problem because the file gmt_0.ps- was already created. So … no idea.

I managed to solve (at least temporary) the issue. According to ChatGPT this was the issue and the solution:

The issue was not related to GMT, file permissions, or Ghostscript itself. Ghostscript was unable to open GMT’s temporary PostScript files located in ~/.gmt/sessions, even though the files existed and had the correct permissions.

The root cause was AppArmor. The kernel logs showed that the gs profile was denying read access to files such as:

~/.gmt/sessions/gmt_session.xxxxx/gmt_0.ps-

This caused Ghostscript to fail with:

Error: /undefinedfilename
Last OS error: Permission denied

The problem was confirmed by copying the PostScript file to /tmp, where Ghostscript processed it successfully.

The solution was to relax or disable the AppArmor profile for Ghostscript (gs), or modify the profile to allow access to the GMT session directory.