在尝试在 Debian Stretch 服务器中接收密钥时,出现以下错误:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
Executing: /tmp/apt-key-gpghome.4B7hWtn7Rm/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory
gpg: connecting dirmngr at '/tmp/apt-key-gpghome.4B7hWtn7Rm/S.dirmngr' failed: No such file or directory
gpg: keyserver receive failed: No dirmngr
答案1
安装该软件包dirmngr
修复了该错误。
user@debian-server:~$ sudo apt-get install dirmngr
重试:
user@debian-server:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
Executing: /tmp/apt-key-gpghome.haKuPppywi/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
gpg: key A6A19B38D3D831EF: public key "Xamarin Public Jenkins (auto-signing) <[email protected]>" imported
gpg: Total number processed: 1
gpg: imported: 1
答案2
我无法让 dirmngr 工作,但您也可以使用 apt-key add 直接导入密钥。 GPG 公钥通常列在存储库的根目录中,例如http://origin-download.mono-project.com/repo/
curl https://origin-download.mono-project.com/repo/xamarin.gpg | sudo apt-key add -
答案3
如前所述,应该安装 dirmngr 软件包,但 apt 可能无法工作并且无法安装任何软件包。不用担心。搜索 dirmngr 包https://packages.debian.org选择您的发行版本,将其下载到 Linux 计算机上并使用 dpkg 命令安装,例如:
cd /tmp
wget http://ftp.it.debian.org/debian/pool/main/g/gnupg2/dirmngr_2.1.18-8~deb9u4_amd64.deb
sudo dpkg -i dirmngr_2.1.18-8~deb9u4_amd64.deb
然后您将能够运行 apt-key 命令来获取丢失的密钥。