PGP critical issue when trying to install mysql2 in rails project
P粉155832941
2023-09-01 23:57:11
<p>I'm trying to install all the gems for a Rails project locally. </p>
<p>I have a problem with mysql2. When I try to install it I get the following error: </p>
<pre class="brush:php;toolbar:false;">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.</pre>
<p>Then I tried running <code>pacman -Syu</code> but I got the same error and was not asked to import the PGP key. </p>
<p>So I tried manually importing the key based on pacman-key --add </code> from the MSI keyring GitHub. I then changed the trust to Ultimate using <code>pacman-key --edit-key</code>.</p>
<p>But now, I'm getting another error: </p>
<pre class="brush:php;toolbar:false;">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.</pre>
<p>I don't know if I'm adding the wrong key this way, or if the error comes from something else. I've been struggling with this for a few days now and I'm a little lost. Can anyone help? </p>
It seems there may be a problem with the MSYS2 or pacman package manager you installed. Child processes exiting with status 127 can indicate a variety of problems.
Here are some things we can try to resolve this error:
If this doesn't work, we can try reinstalling MSYS2.
Another approach might be to delete the pacman cache and try again. You can do this via:
Please note that there is an error with mingw-w64-x86_64-libmariadbclient, you should confirm that all required development packages are installed.
There may also be a development package. On Ubuntu it's "sudo apt install libmariadb-dev" or something similar, but I'm not sure about Arch Linux.