PGP key issue while trying to install mysql2 in rails project

228 views Asked by At

I am trying to locally install all the gems for a rails project.

I have an issue with mysql2. When I try to install it, I have the following error:

Fetching mysql2-0.5.5.gem
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-libmariadbclient
error: mingw32: key "5F944B027F7FE2091985AA2EFA11531AA0AA7F57" is unknown
error: key "5F944B027F7FE2091985AA2EFA11531AA0AA7F57" could not be looked up remotely
error: mingw64: key "5F944B027F7FE2091985AA2EFA11531AA0AA7F57" is unknown
error: key "5F944B027F7FE2091985AA2EFA11531AA0AA7F57" could not be looked up remotely
error: msys: key "5F944B027F7FE2091985AA2EFA11531AA0AA7F57" is unknown
error: key "5F944B027F7FE2091985AA2EFA11531AA0AA7F57" could not be looked up remotely
error: database 'mingw32' is not valid (invalid or corrupted database (PGP signature))
error: database 'mingw64' is not valid (invalid or corrupted database (PGP signature))
error: database 'msys' is not valid (invalid or corrupted database (PGP signature))
pacman failed with the following output:
Building native extensions with: '--with-mysql-lib="C:\Program Files\MySQL\MySQL Server 8.0\lib" --with-mysql-include="C:\Program Files\MySQL\MySQL Server 8.0\include"'
This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

I then tried to run pacman -Syu, but as well the same error, and I don't get asked to import the PGP key.

Thus, I tried to import the key manually, according to the one in the MSI keyring GitHub with pacman-key --add. I then changed the trust to ultimate with pacman-key --edit-key.

But now, I have another error:

Installing required msys2 packages: mingw-w64-x86_64-libmariadbclient
error: could not open file /var/lib/pacman/sync/mingw32.db: Child process exited with status 127
error: could not open file /var/lib/pacman/sync/mingw64.db: Child process exited with status 127
error: could not open file /var/lib/pacman/sync/msys.db: Child process exited with status 127
error: target not found: mingw-w64-x86_64-libmariadbclient
pacman failed with the following output:
Building native extensions with: '--with-mysql-lib="C:\Program Files\MySQL\MySQL Server 8.0\lib" --with-mysql-include="C:\Program Files\MySQL\MySQL Server 8.0\include"'
This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

I don't know if I did wrong adding the key this way, or if the error comes from something else. I'm struggling on this for days now, I am kind of lost. Someone could help ?

1

There are 1 answers

0
Ryan Kopf On

It seems like there might be something wrong with your installation of MSYS2 or pacman package manager. Child process exited with status 127 can indicate various issues.

Here are a few things we can try to resolve this error:

  1. You can start by updating your MSYS2 installation with the following command:
pacman -Syu
  1. If that doesn't work, we can try reinstalling MSYS2.

  2. Another approach might be to remove the pacman cache and try again. You can do this with:

pacman -Scc

Noting the error is with mingw-w64-x86_64-libmariadbclient, you should confirm you have all the required dev packages installed.

sudo pacman -S mysql

There may also be a dev package. On Ubuntu it's "sudo apt install libmariadb-dev" or something similar, but I'm not sure for Arch Linux.