我正在尝试在嵌入式设备上实现 apt-get 。为了进行测试,我使用 Raspbian 存储库之一,但 apt-get update 不断告诉我我的密钥环有不受支持的文件格式。
我删除了旧的密钥环并从 raspbian.org 下载了新的密钥环,并使用 apt-key 添加了它,这导致了一个 gpg(v4) 文件,在我看来,该文件是 apt_2.2.4 的正确格式,但显然 apt 看起来不是喜欢它。
有人可以告诉我这里发生了什么以及我整天做错了什么吗?
问候
请参阅下面的控制台输出:
# rm trusted.gpg
# wget https://archive.raspbian.org/raspbian.public.key -O - | sudo apt-key add -
Connecting to archive.raspbian.org (93.93.128.191:443)
writing to stdout
- 100% |********************************************************************************************************| 1776 0:00:00 ETA
written to stdout
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
# file trusted.gpg
trusted.gpg: PGP/GPG key public ring (v4) created Sun Apr 1 21:02:33 2012 RSA (Encrypt or Sign) 2048 bits MPI=0xcf5b981af19c88b1...
# apt-get update
Get:1 http://archive.raspbian.org/raspbian bookworm InRelease [15.0 kB]
Err:1 http://archive.raspbian.org/raspbian bookworm InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9165938D90FDDD2E
Reading package lists... Error!
W: http://archive.raspbian.org/raspbian/dists/bookworm/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg are ignored as the file has an unsupported filetype.
W: GPG error: http://archive.raspbian.org/raspbian bookworm InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9165938D90FDDD2E
E: The repository 'http://archive.raspbian.org/raspbian bookworm InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: flAbsPath on /var/lib/dpkg/status failed - realpath (2: No such file or directory)
E: Could not open file - open (2: No such file or directory)
E: Problem opening
E: The package lists or status file could not be parsed or opened.
# apt-key --keyring /etc/apt/trusted.gpg list
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
/etc/apt/trusted.gpg
--------------------
pub rsa2048 2012-04-01 [SC]
A0DA 38D0 D76E 8B5D 6388 7281 9165 938D 90FD DD2E
uid [ unknown] Mike Thompson (Raspberry Pi Debian armhf ARMv6+VFP) <[email protected]>
sub rsa2048 2012-04-01 [E]
# apt --version
apt 2.2.4 ()
# gpg --version
gpg (GnuPG) 2.3.3-unknown
libgcrypt 1.9.4-unknown
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: /root/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
AEAD: EAX, OCB
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2