# Problem with debian repository key

**URL:** <https://community.grafana.com/t/problem-with-debian-repository-key/79788>\
**Category:** Installation\
**Created:** [January 16, 2023, 7:13pm UTC](https://community.grafana.com/t/problem-with-debian-repository-key/79788 "2023-01-16T19:13:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![christiand](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@christiand](https://community.grafana.com/u/christiand)\
**Post date:** [January 16, 2023, 7:13pm UTC](https://community.grafana.com/t/problem-with-debian-repository-key/79788/1 "2023-01-16T19:13:40Z")

</div>

Hi to everyone.

apt is complaining about a missing public key

```auto
Errore:1 https://apt.grafana.com stable InRelease                                                                                                                           
  Le seguenti firme non sono state verificate perché la chiave pubblica non è disponibile: NO_PUBKEY 9E439B102CF3C0C6

```

but the key is there:

```plaintext
gpg --show-keys /usr/share/keyrings/grafana.gpg
pub rsa3072 2023-01-06 [SC] [scadenza: 2025-01-05]
      0E22EB88E39E12277A7760AE9E439B102CF3C0C6
uid Grafana Labs <engineering@grafana.com>
sub rsa3072 2023-01-06 [E] [scadenza: 2025-01-05]

```

My grafana.list is:

```auto
cat /etc/apt/sources.list.d/grafana.list 
deb [signed-by=/usr/share/keyrings/grafana.gpg] https://apt.grafana.com stable main

```

What am I missing?

---

<div class="post-metadata">

**Author:** ![ptpdp](https://avatars.discourse-cdn.com/v4/letter/p/77aa72/32.png) [@ptpdp](https://community.grafana.com/u/ptpdp)\
**Post date:** [January 17, 2023, 5:54am UTC](https://community.grafana.com/t/problem-with-debian-repository-key/79788/2 "2023-01-17T05:54:58Z")

</div>

The key was emergency-rotated, as fallout from the CircleCI breach.

Whenever there’s a key problem with the repo signing key, I’ve found it best to check [https://packages.grafana.com/oss/](https://packages.grafana.com/oss/) – there’s usually something useful there. In this case:

> The GPG key used to sign the APT repository (fingerprint **4E40DDF6D76E284A4A6780E48C8C34C524098CB6** ) was rotated on 2023-01-12 and replaced with a new key with fingerprint **0E22EB88E39E12277A7760AE9E439B102CF3C0C6**.  
> If you enabled the repository before that, you will see errors when running `apt update`.  
> To fix this, re-run the commands below to fetch the new key. See the following blog post for more information: [Grafana Labs update regarding CircleCI security updates | Grafana Labs](https://grafana.com/blog/2023/01/12/grafana-labs-update-regarding-circleci-security-updates/)

(I had to stop there, I’ve not used the community pages from this account before so hit a new-user 2-links limit)

---

<div class="post-metadata">

**Author:** ![christiand](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@christiand](https://community.grafana.com/u/christiand)\
**Post date:** [January 17, 2023, 6:56am UTC](https://community.grafana.com/t/problem-with-debian-repository-key/79788/3 "2023-01-17T06:56:35Z")

</div>

Thanks for your answer.  
I had already found the news about the key rotation and downloaded the new key, please see the fingerprint posted in my previous message.  
But I still get an error from apt, and the error message is pointing to new key:  
`NO_PUBKEY 9E439B102CF3C0C6`

EDIT: ok I was missing the command `gpg --dearmor` on the key, now it works

---

<div class="post-metadata">

**Author:** ![kienerj](https://avatars.discourse-cdn.com/v4/letter/k/ce7236/32.png) [@kienerj](https://community.grafana.com/u/kienerj)\
**Post date:** [January 28, 2023, 9:38am UTC](https://community.grafana.com/t/problem-with-debian-repository-key/79788/4 "2023-01-28T09:38:55Z")

</div>

Can you explain the exact command because I have the same issue

---

<div class="post-metadata">

**Author:** ![christiand](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@christiand](https://community.grafana.com/u/christiand)\
**Post date:** [January 28, 2023, 12:00pm UTC](https://community.grafana.com/t/problem-with-debian-repository-key/79788/5 "2023-01-28T12:00:46Z")

</div>

From link posted by ptpdp before:  
[https://packages.grafana.com/oss/](https://packages.grafana.com/oss/)

```auto
$ mkdir -p /etc/apt/keyrings/
$ wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor > /etc/apt/keyrings/grafana.gpg
$ echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | tee /etc/apt/sources.list.d/grafana.list

```

---

<div class="post-metadata">

**Author:** ![kienerj](https://avatars.discourse-cdn.com/v4/letter/k/ce7236/32.png) [@kienerj](https://community.grafana.com/u/kienerj)\
**Post date:** [January 28, 2023, 7:01pm UTC](https://community.grafana.com/t/problem-with-debian-repository-key/79788/6 "2023-01-28T19:01:05Z")

</div>

neither these command nor the ones from the [blog](https://grafana.com/blog/2023/01/12/grafana-labs-update-regarding-circleci-security-updates/) actually work for me (Ubuntu).

EDIT:  
it seems for ubuntu 20.04 the gpg key must be put into /etc/apt/trusted.gpg.d

else it simply does not work

---

<div class="post-metadata">

**Author:** ![overdose263](https://avatars.discourse-cdn.com/v4/letter/o/13edae/32.png) [@overdose263](https://community.grafana.com/u/overdose263)\
**Post date:** [June 8, 2023, 1:36pm UTC](https://community.grafana.com/t/problem-with-debian-repository-key/79788/7 "2023-06-08T13:36:32Z")

</div>

Greetings all, noob here. Just inherited this from someone else.

For me what worked is the link sent by @ptpdp

[Grafana Labs update regarding CircleCI security updates | Grafana Labs](https://grafana.com/blog/2023/01/12/grafana-labs-update-regarding-circleci-security-updates/)

In case someone needs a fix without going around circles…

---

<div class="post-metadata">

**Author:** ![pkkrusty](https://avatars.discourse-cdn.com/v4/letter/p/b782af/32.png) [@pkkrusty](https://community.grafana.com/u/pkkrusty)\
**Post date:** [October 18, 2023, 2:51pm UTC](https://community.grafana.com/t/problem-with-debian-repository-key/79788/8 "2023-10-18T14:51:32Z")

</div>

For anyone on Raspberry pi, the commands that will solve the problem are:

```auto
cd /etc/apt/trusted.gpg.d/
sudo wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/grafana.gpg >/dev/null
echo "deb [signed-by=/etc/apt/trusted.gpg.d/grafana.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list

```

---

<div class="post-metadata">

**Author:** ![wlfuchs](https://avatars.discourse-cdn.com/v4/letter/w/ea5d25/32.png) [@wlfuchs](https://community.grafana.com/u/wlfuchs)\
**Post date:** [January 5, 2024, 2:56pm UTC](https://community.grafana.com/t/problem-with-debian-repository-key/79788/9 "2024-01-05T14:56:57Z")

</div>

Thamks 😃
