# Prendre en compte la dépréciation de apt--key

**URL:** <https://www.debian-fr.org/t/prendre-en-compte-la-depreciation-de-apt-key/88365>\
**Category:** Trucs et Astuces\
**Created:** [Juin 18, 2023, 9:49 UTC](https://www.debian-fr.org/t/prendre-en-compte-la-depreciation-de-apt-key/88365 "2023-06-18T09:49:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zargos](https://www.debian-fr.org/user_avatar/www.debian-fr.org/zargos/32/10889_2.png) [@Zargos](https://www.debian-fr.org/u/Zargos)\
**Post date:** [Juin 18, 2023, 9:49 UTC](https://www.debian-fr.org/t/prendre-en-compte-la-depreciation-de-apt-key/88365/1 "2023-06-18T09:49:06Z")

</div>

Bonjour,  
Vous l’avez tous vu apt-key c’est fini dans Bookworm.  
La question c’est comment je modifie ce que j’ai déjà.  
Les opérations sont simple:

- Obtenir les clef de l’ancien système en les exportant
- Supprimer ces clefs dans l’ancien système
- Ajouter les clef au nouveau système (si elles n’y sont pas déjà)
- modifier les fichiers sources.list correspondant

**Lister les clefs:**  
apt-key list   
Par exemple:

```auto
# apt-key list virtualbox
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
pub rsa4096 2016-04-22 [SC]
      B9F8 D658 297A F3EF C18D 5CDF A2F6 83C5 2980 AECF
uid [inconnue] Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>
sub rsa4096 2016-04-22 [E]

```

**Vérifier que la clef est dans le nouveau système:**

```auto
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
pub rsa4096 2016-04-22 [SC]
      B9F8 D658 297A F3EF C18D 5CDF A2F6 83C5 2980 AECF
uid [inconnue] Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>
sub rsa4096 2016-04-22 [E]

```

Si la clef s’y trouve s’assurer quelle a bien des droits et permissions en 0644  
sinon  
`chmod 0644 /usr/share/keyring/<la clef>`  
Si elle ne s’y trouve pas:

```auto
apt-key export <id de la clef> > /usr/share/keyring/<nom de la clef>

```

Exemple:

```auto
apt-key export "B9F8 D658 297A F3EF C18D 5CDF A2F6 83C5 2980 AECF" > /usr/share/keyrings/virtualbox-key.asc
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).

```

(n’oubliez pas les guillemets, car sinon l’id ne marchera pas. Vous pouvez aussi simplement enlever les espaces, ça marche aussi).

**Supprimer la clef de l’ancien système:**

```auto
apt-key del "<id de la clef>"

```

**Modifier les entrées sources.list**

```auto
vim /etc/apt/sources.list.d/<monfichier>.list

```

Ajouter l’entrée [signed-by=/usr/share/keyrings/] comme par exemple:

```auto
# cat /etc/apt/sources.list.d/virtualbox.list 
deb [signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian bullseye contrib

```

---

<div class="post-metadata">

**Author:** ![phil995511](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/p/ba9def/32.png) [@phil995511](https://www.debian-fr.org/u/phil995511)\
**Post date:** [Juin 18, 2023, 10:34 UTC](https://www.debian-fr.org/t/prendre-en-compte-la-depreciation-de-apt-key/88365/2 "2023-06-18T10:34:13Z")

</div>

Après avoir fait un clean install de Debian 12 (je n’aime pas faire de mises-à-jour entre 2 versions majeures), j’ai eu quelques soucis de ce type concernant les répertoires distants que j’utilise usuellement.

La soluce pour refaire fonctionner ma machine comme je l’aime à été d’installer le paquet ci-dessous, qui n’est plus installé de base dans Debian 12 :

`apt install python3-launchpadlib`

PS J’ajouterai que Gnome-Boxes est globalement beaucoup plus simple à utiliser que Virtualbox.

---

<div class="post-metadata">

**Author:** ![Zargos](https://www.debian-fr.org/user_avatar/www.debian-fr.org/zargos/32/10889_2.png) [@Zargos](https://www.debian-fr.org/u/Zargos)\
**Post date:** [Juin 18, 2023, 4:41 UTC](https://www.debian-fr.org/t/prendre-en-compte-la-depreciation-de-apt-key/88365/3 "2023-06-18T16:41:10Z")

</div>

Le sujet n’est pas gnome-box, virtualbox, ou une quelconque application, mais juste la gestion des clefs et le fait de passer vers Debian Bookworm via une mise à jour.

j’ai pris virtualbox parce que je l’avais sous la main, j’aurais pu prendre tout aussi bine elasticsearch, zabbix ou webmin.

---

<div class="post-metadata">

**Author:** ![fran.b](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/f/d78d45/32.png) [@fran.b](https://www.debian-fr.org/u/fran.b)\
**Post date:** [Juin 18, 2023, 5:26 UTC](https://www.debian-fr.org/t/prendre-en-compte-la-depreciation-de-apt-key/88365/4 "2023-06-18T17:26:15Z")

</div>

> [@Zargos](#):
>
> Bookworm.

J’ai lu ça sur le site de debian:  
Except for using **apt-key del** in maintainer scripts, the use of **apt-key** is deprecated. This section shows how to replace existing use of **apt-key**.

If your existing use of **apt-key add** looks like this:

wget -qO- [https://myrepo.example/myrepo.asc](https://myrepo.example/myrepo.asc) | sudo apt-key add -

Then you can directly replace this with (though note the recommendation below):

wget -qO- [https://myrepo.example/myrepo.asc](https://myrepo.example/myrepo.asc) | sudo tee /etc/apt/trusted.gpg.d/myrepo.asc

Make sure to use the «&nbsp;asc&nbsp;» extension for ASCII armored keys and the «&nbsp;gpg&nbsp;» extension for the binary OpenPGP format (also known as «&nbsp;GPG key public ring&nbsp;»). The binary OpenPGP format works for all apt versions, while the ASCII armored format works for apt version \>= 1.4.

_Recommended:_ Instead of placing keys into the /etc/apt/trusted.gpg.d directory, you can place them anywhere on your filesystem by using the Signed-By option in your sources.list and pointing to the filename of the key. See [sources.list(5)](https://manpages.debian.org/bookworm/apt/sources.list.5.en.html) for details. Since APT 2.4, /etc/apt/keyrings is provided as the recommended location for keys not managed by packages. When using a deb822-style sources.list, and with apt version \>= 2.4, the Signed-By option can also be used to include the full ASCII armored keyring directly in the sources.list without an additional file.
