MSYS2-packages: GPGME error: Invalid crypto engine

This is a super-issue for GPGME error: Invalid crypto engine and related errors.

About this issue

  • Original URL
  • State: open
  • Created 9 years ago
  • Comments: 31 (7 by maintainers)

Commits related to this issue

Most upvoted comments

@runapp My debug output was pretty much the same as yours.

Output
$ export GPGME_DEBUG=9; pacman -Qq bash --debug
debug: pacman v5.0.1 - libalpm v10.0.1
debug: config: attempting to read file /etc/pacman.conf
debug: config: new section 'options'
debug: config: HoldPkg: pacman
debug: config: arch: x86_64
debug: config: SigLevel: Required
debug: config: SigLevel: DatabaseOptional
debug: config: LocalFileSigLevel: Optional
debug: config: new section 'mingw32'
debug: config file /etc/pacman.conf, line 73: including /etc/pacman.d/mirrorlist.mingw32
debug: config: new section 'mingw64'
debug: config file /etc/pacman.conf, line 76: including /etc/pacman.d/mirrorlist.mingw64
debug: config: new section 'msys'
debug: config file /etc/pacman.conf, line 79: including /etc/pacman.d/mirrorlist.msys
debug: config: finished parsing /etc/pacman.conf
debug: setup_libalpm called
debug: option 'logfile' = /var/log/pacman.log
debug: option 'gpgdir' = /etc/pacman.d/gnupg/
debug: option 'hookdir' = /etc/pacman.d/hooks/
debug: option 'cachedir' = /var/cache/pacman/pkg/
debug: registering sync database 'mingw32'
debug: database path for tree mingw32 set to /var/lib/pacman/sync/mingw32.db
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_debug: level=9
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_check_version: call: 0=0x0, req_version=(null), VERSION=1.6.0
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_check_version_internal: call: 0=0x0, req_version=(null), offset_sig_validity=60
debug: GPGME version: 1.6.0
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_set_locale: enter: ctx=0x0, category=2, value=en_US.UTF-8
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_set_locale: leave
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_set_locale: enter: ctx=0x0, category=6, value=en_US.UTF-8
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_set_locale: leave
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme-walk_path: 'gpgconf' not found in '/usr/bin:/bin:/usr/sbin:/usr/local/bin'
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme-dinfo: gpgconf='[null]'
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme-dinfo:     gpg='/usr/bin/gpg'
GPGME 2018-02-18 03:57:59 <0x1060>  _gpgme_io_pipe: enter: filedes=0xffffb510, inherit_idx=1 (GPGME uses it for reading)
GPGME 2018-02-18 03:57:59 <0x1060>  _gpgme_io_pipe: leave: read=0x5, write=0x6
GPGME 2018-02-18 03:57:59 <0x1060>  _gpgme_io_spawn: enter: path=0x60004ef70, path=/usr/bin/gpg
GPGME 2018-02-18 03:57:59 <0x1060>  _gpgme_io_spawn: check: path=0x60004ef70, argv[ 0] = /usr/bin/gpg
GPGME 2018-02-18 03:57:59 <0x1060>  _gpgme_io_spawn: check: path=0x60004ef70, argv[ 1] = --version
GPGME 2018-02-18 03:57:59 <0x1060>  _gpgme_io_spawn: check: path=0x60004ef70, fd[0] = 0x6 -> 0x1
GPGME 2018-02-18 03:57:59 <0x1060>  _gpgme_io_spawn: check: path=0x60004ef70, waiting for child process pid=9624
GPGME 2018-02-18 03:57:59 <0x1060>  _gpgme_io_spawn: error: No such file or directory
GPGME 2018-02-18 03:57:59 <0x1060>  _gpgme_io_close: enter: fd=0x5
GPGME 2018-02-18 03:57:59 <0x1060>  _gpgme_io_close: leave: result=0
GPGME 2018-02-18 03:57:59 <0x1060>  _gpgme_io_close: enter: fd=0x6
GPGME 2018-02-18 03:57:59 <0x1060>  _gpgme_io_close: leave: result=0
GPGME 2018-02-18 03:57:59 <0x1060>  engine.c:155: returning error: Invalid crypto engine
error: GPGME error: Invalid crypto engine
debug: returning error 55 from init_gpgme : gpgme error
debug: signature check failed
debug: setting usage of 15 for mingw32 repository
debug: adding new server URL to database 'mingw32': http://repo.msys2.org/mingw/i686
debug: adding new server URL to database 'mingw32': http://downloads.sourceforge.net/project/msys2/REPOS/MINGW/i686
debug: adding new server URL to database 'mingw32': http://www2.futureware.at/~nickoe/msys2-mirror/i686
debug: registering sync database 'mingw64'
debug: database path for tree mingw64 set to /var/lib/pacman/sync/mingw64.db
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_check_version: call: 0=0x0, req_version=(null), VERSION=1.6.0
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_check_version_internal: call: 0=0x0, req_version=(null), offset_sig_validity=60
debug: GPGME version: 1.6.0
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_set_locale: enter: ctx=0x0, category=2, value=en_US.UTF-8
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_set_locale: leave
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_set_locale: enter: ctx=0x0, category=6, value=en_US.UTF-8
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_set_locale: leave
GPGME 2018-02-18 03:57:59 <0x1060>  engine.c:155: returning error: Invalid crypto engine
error: GPGME error: Invalid crypto engine
debug: returning error 55 from init_gpgme : gpgme error
debug: signature check failed
debug: setting usage of 15 for mingw64 repository
debug: adding new server URL to database 'mingw64': http://repo.msys2.org/mingw/x86_64
debug: adding new server URL to database 'mingw64': http://downloads.sourceforge.net/project/msys2/REPOS/MINGW/x86_64
debug: adding new server URL to database 'mingw64': http://www2.futureware.at/~nickoe/msys2-mirror/x86_64
debug: registering sync database 'msys'
debug: database path for tree msys set to /var/lib/pacman/sync/msys.db
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_check_version: call: 0=0x0, req_version=(null), VERSION=1.6.0
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_check_version_internal: call: 0=0x0, req_version=(null), offset_sig_validity=60
debug: GPGME version: 1.6.0
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_set_locale: enter: ctx=0x0, category=2, value=en_US.UTF-8
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_set_locale: leave
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_set_locale: enter: ctx=0x0, category=6, value=en_US.UTF-8
GPGME 2018-02-18 03:57:59 <0x1060>  gpgme_set_locale: leave
GPGME 2018-02-18 03:57:59 <0x1060>  engine.c:155: returning error: Invalid crypto engine
error: GPGME error: Invalid crypto engine
debug: returning error 55 from init_gpgme : gpgme error
debug: signature check failed
debug: setting usage of 15 for msys repository
debug: adding new server URL to database 'msys': http://repo.msys2.org/msys/x86_64
debug: adding new server URL to database 'msys': http://downloads.sourceforge.net/project/msys2/REPOS/MSYS2/x86_64
debug: adding new server URL to database 'msys': http://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64
debug: loading package cache for repository 'local'
debug: added 297 packages to package cache for db 'local'
bash
debug: unregistering database 'local'
debug: freeing package cache for repository 'local'
debug: unregistering database 'mingw32'
debug: unregistering database 'mingw64'
debug: unregistering database 'msys'

For me, the root cause actually turned out to be the same as an unrelated problem where git rebase interactive was hanging.

The culprit was good old BLODA COMODO. It was more obvious in that git problem because I saw high CPU usage from COMODO while git rebase -i was hanging.

However, turning off all of COMODO’s services/systems wasn’t enough to fix the problem. The workaround (discussed here, here, here, and here) turned out to be to go to Settings > Advanced protection > Miscellaneous > Don't detect shellcode injections in these applications and add File Groups > All Applications to the exclusion list.

After that, git rebase interactive and pacman worked properly.

Causes and solutions

  • This error can happen if there are conflicting gnupg installations in PATH. Try running pacman in a special shell like set PATH=, msys2_shell.bat.
  • MacType can cause this. Put gpg.exe and pacman.exe lines under the [UnloadDll] section of your .ini file under C:\Program Files (x86)\MacType\ini or C:\Program Files\MacType\ini.
  • Check BLODA.
  • It can happen when the upgrade process reported failures (fork errors). Use update-core for system upgrades and take care to follow the instructions.
  • Try re-installing gpgme libgpgme, gnupg and pacman packages (you can temporarily disable signature checking in /etc/pacman.conf).
  • Try removing /etc/pacman.d/gnupg, then pacman-key --init, pacman-key --populate msys2, pacman-key --refresh-keys.
  • Maybe autorebase.bat is sometimes needed even for 64-bit MSYS2.
  • Try debugging for GPGME by export GPGME_DEBUG=9 before running pacman ...something... 2> ~/gpgmelog and looking at the logfile ~/gpgmelog.

References

Had this issue due to MacType; adding pacman.exe and gpg.exe to [UnloadDll] solved my issue.

Yo quise compilar Super Mario 64 Plus en MSYS2 MINGW64 y me aparece esto: advertencia: No se ha encontrado el depósito público de claves; ¿ya se ha ejecutado «pacman-key --init»? error: Error de GPGME: Motor de cifrado no válido advertencia: No se ha encontrado el depósito público de claves; ¿ya se ha ejecutado «pacman-key --init»? error: Error de GPGME: Motor de cifrado no válido advertencia: No se ha encontrado el depósito público de claves; ¿ya se ha ejecutado «pacman-key --init»? error: Error de GPGME: Motor de cifrado no válido error: la base de datos «mingw32» no es válida (base de datos no válida o dañada (firma PGP)) error: la base de datos «mingw64» no es válida (base de datos no válida o dañada (firma PGP)) error: la base de datos «msys» no es válida (base de datos no válida o dañada (firma PGP))

Que debo hacer?

I use MSYS2 with ConEmu and was having this issue as well. Running pacman -Syu once in the msys2_shell.cmd seems to have resolved the issue and now I can run it inside ConEmu again.

Also, for MacType users, when you put following lines into your .ini file under C:\Program Files (x86)\MacType\ini or C:\Program Files\MacType\ini, GPGME will works properly.

[UnloadDll]
gpg.exe

To people who find a solution here, please leave a comment to let us know what worked for you if you wouldn’t mind. Thanks in advance.

For MacType users, if you have this problem even after adding gpg.exe under [UnloadDll], try adding pacman.exe also.

[UnloadDll]
gpg.exe
pacman.exe