当我尝试使用命令更新时sudo apt update
出现此错误:
E: Type 'gpg' is not known on line 1 in source list /etc/apt/sources.list.d/grafana.list
E: The list of sources could not be read.
在出现此错误之前,我尝试安装grafana
/etc/apt/sources.list.d/grafana.list
来自评论:
1. cat /etc/apt/sources.list.d/grafana.list
deb [signed-by=/usr/share/keyrings/grafana.gpg] https://packages.grafana.com/oss/deb stable main
deb https://packages.grafana.com/enterprise/deb stable main
deb [signed-by=/usr/share/keyrings/grafana.gpg] https://packages.grafana.com/oss/deb stable main
deb [signed-by=/usr/share/keyrings/grafana.key] https://packages.grafana.com/enterprise/deb stable main
deb [signed-by=/usr/share/keyrings/grafana.key] https://packages.grafana.com/enterprise/deb beta main
2.GnuPG信息:
gpg (GnuPG) 2.2.27
libgcrypt 1.9.4
Copyright (C) 2021 Free Software Foundation, Inc.
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: /tmp/apt-key-gpghome.fGvGNgllIZ
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
Please report bugs to <bugs.gnupg.org>.
答案1
与官方安装指南。
该文件/etc/apt/sources.list.d/grafana.list
应该只有一行,具体取决于您选择的 Grafana 版本。
不同的选项是(假设密钥是/usr/share/keyrings/grafana.key
:):
企业版,稳定版本:
deb [signed-by=/usr/share/keyrings/grafana.key] https://packages.grafana.com/enterprise/deb stable main
企业版,测试版:
deb [signed-by=/usr/share/keyrings/grafana.key] https://packages.grafana.com/enterprise/deb beta main
OSS 版本,稳定版本:
deb [signed-by=/usr/share/keyrings/grafana.key] https://packages.grafana.com/oss/deb stable main
OSS 版本,测试版:
deb [signed-by=/usr/share/keyrings/grafana.key] https://packages.grafana.com/oss/deb beta main
仅将其中一行添加到/etc/apt/sources.list.d/grafana.list
,并从文件中删除所有其他内容。