I was upgraded from RHEL 7.6 to 7.8 last week. After upgrade my emacs (v25.3) was broken and I got the following error:

error while loading shared libraries: libMagickWand.so.5: cannot open shared object file: No such file or directory

I could not figure out a solution (partly, I think, because our RHN server is down) so I downloaded/installed emacs 27.1. Now, I cannot open a gpg file. I get the following error in emacs:

GPG error: "no usable configuration", OpenPGP

I tried solutions offered here and here, but nothing has worked so far.

One solution suggested adding this line to .emacs

(custom-set-variables '(epg-gpg-program  "/usr/local/bin/gpg2"))

However, adding that results in the following error: "Wrong type argument: arrayp, nil"

I did not blow away the old emacs install prior to installing 27.1, but I doubt that is the problem.
Any help on resolving this is appreciated.

  • looks like there is version mismatch with libmagickwand so you may need to update the lib, and/or install the old library along the new. Something similar seems to happen with gpg2, which, at least in ubuntu, isn't installed as gpg2. Check if you have it installed and the path is what you tell it is.
    – Muihlinn
    Dec 1, 2020 at 16:52
  • @Muihlinn Embarrassing! I had the wrong path specified. Thanks for the suggestion.
    – tnknepp
    Dec 1, 2020 at 21:11
  • In my case, I upgraded my Ubuntu/Emacs and started encountering error. Although, /usr/bin/gpg is able to decrypt the gpg file, Emacs needed gpg2 which was missing. sudo apt-get install gpg2 solved my issue (also needed to have (custom-set-variables '(epg-gpg-program "/usr/local/bin/gpg2")) in my init.el). Aug 28, 2022 at 6:09

2 Answers 2


As Martin mentioned, this is due to a version problem of the gpg binaries RHEL/CENTOS provides. For this to work, you need to convince emacs that your version is acceptable.

Find the .../share/emacs/27.2/lisp directory and open the epg-config-el.gz file. I found mine by running find-name-dired and searching for *epg-config*. Once opened, change the line from

(defconst epg-gpg2-minimum-version "2.1.6")


(defconst epg-gpg2-minimum-version "2.0.22")

or whatever matches your current gpg2 version.

Then byte compile the file using byte-compile-file, restart emacs, and it should work correctly.

  • You should be able to just setq this variable rather than editing the source file: defconst does not prevent that, it just declares the intention that the variable will not change. Mar 31, 2021 at 9:51

I stumbled across the same problem, when my employer forced me to switch to CentOS instead of Debian with Emacs 27.1 installed. The problem comes from the gnupg version, that CentOS and RedHat ship. Both gpg and gpg2 are version 2.0.22 on CentOS 7, but Emacs now requires version 2.1.6 at least. The gpg configuration worked in older versions of Emacs, because the corresponding check in epg-config.el was buggy and has been fixed. I had opened a bug report for Emacs (#42845), but the author did not see this as a regression. I ended up hacking epg-config.el to allow 2.0.22 to be accepted, which works without problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.