I installed MariaDB on a computer with CentOS using the instructions given here:

MariaDB Package Repository Setup and Usage - MariaDB Knowledge Base

The basic command I used was:

sudo yum install MariaDB-server MariaDB-client  

and I did not install Maxscale or percona.

MariaDB installation has compleetd successfully, but now if I enter a yet uninstalled command in the bash shell, I am getting this error:

Failed to search for file: Failed to download gpg key for repo 'mariadb-main': Curl error (37): Couldn't read a file:// file for file:///etc/pki/rpm-gpg/MariaDB-Server-GPG-KEY [Couldn't open file /etc/pki/rpm-gpg/MariaDB-Server-GPG-KEY]

For example, if I enter the command ftp, previously I would have got a message indicating that ftp was not installed, and I would have got some recommendations on which command I meant and would like to download. However, now I get this:

[username@localhost ~]$ ftp
bash: ftp: command not found...
Failed to search for file: Failed to download gpg key for repo 'mariadb-main': Curl error (37):     Couldn't read a file:// file for file:///etc/pki/rpm-gpg/MariaDB-Server-GPG-KEY [Couldn't open file   /etc/pki/rpm-gpg/MariaDB-Server-GPG-KEY]
[username@localhost ~]$

After some searching around I have found that it is because the file etc/yum.repos.d/mariadb.repo has an entry:

gpgkey = file:///etc/pki/rpm-gpg/MariaDB-Server-GPG-KEY    

and the MariaDB-Server-GPG-KEY file does not exist in etc/pki/rpm-gpg

I suppose this should have been created automatically when I installed mariadb? How do I make this bash error go away? Is there any way I can download or create this file manually?

--- EDIT ---
This was resolved as follows:

Downloaded RPM-GPG-KEY-MariaDB as explained in Philip's answer (https://unix.stackexchange.com/a/602962/28907)

Copied it to /etc/pki/rpm-gpg/

In /etc/yum.repos.d/mariadb.repo changed the line gpgkey = file:///etc/pki/rpm-gpg/MariaDB-Server-GPG-KEY to gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-MariaDB

Set the gpgcheck for other entries in the mariadb.repo file to 0 (I don't have maxscale and mariadb enterprise installed)

  • You can import the GPG key manually: mariadb.com/kb/en/yum/#importing-the-mariadb-gpg-public-key . However, I'm not sure how it is linked to your shell.
    – Haxiel
    Commented May 11, 2020 at 13:48
  • @Haxiel already tried this, it didn't work for me. I'm not sure what I'm doing wrong. The command itself does not give any errors, but it doesn't get rid of the "Failed to download gpg key" message, and doesn't create MariaDB-Server-GPG-KEY in /etc/pki/rpm-gpg
    – user13267
    Commented May 11, 2020 at 14:19
  • Can you edit the yum repo file to set gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-MariaDB? The filename for the key is different from the one in your error message.
    – Haxiel
    Commented May 11, 2020 at 15:00
  • Also, please see this QA for details on how a yum command is linked to your shell: stackoverflow.com/q/14389684
    – Haxiel
    Commented May 11, 2020 at 15:01
  • @Haxiel you mean the file shouldn't be named "MariaDB-Server-GPG-KEY"?
    – user13267
    Commented May 11, 2020 at 15:08

2 Answers 2


TelcoM's comment answers the root cause of this:

Apparently you have the PackageKit-command-not-found RPM package installed. It adds a special customization to the shell's "command not found" error handler, which attempts to see if the command exists in a package that is not currently installed, and producing a more informative error message for that case.

But to make the check, you must have all the configured package repositories accessible - including having their GPG keys available. And if there are problems, the standard error message is replaced with an even more cryptic one.

As per Laurentino's answer this was a simple matter of downloading the correct gpg key for repo mariadb-main and moving to directory /etc/pki/rpm-gpg/:

wget https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

Other repos will have different keys and an exhaustive list of links can't reasonably be provided here.


For me the solutions was to do manually

sudo wget https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

directly inside of directory /etc/pki/rpm-gpg/, and that created the file RPM-GPG-KEY-MariaDB.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .