在安装nodejs时,使用chef-client会出现”gpg: keyserver timed out”错误
错误内容 (Chinese)
================================================================================
Error executing action `add` on resource 'apt_repository[node.js]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
execute[install-key 1655a0ab68576280] (/var/chef/cache/cookbooks/apt/providers/repository.rb line 28) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
---- Begin output of apt-key adv --keyserver keyserver.ubuntu.com --recv 1655a0ab68576280 ----
STDOUT: Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.yuuCkD6HSP --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d//zabbix-official-repo.gpg --keyserver keyserver.ubuntu.com --recv 1655a0ab68576280
STDERR: gpg: requesting key 68576280 from hkp server keyserver.ubuntu.com
gpg: keyserver timed out
gpg: keyserver receive failed: keyserver error
---- End output of apt-key adv --keyserver keyserver.ubuntu.com --recv 1655a0ab68576280 ----
Ran apt-key adv --keyserver keyserver.ubuntu.com --recv 1655a0ab68576280 returned 2
导致
由于运行chef-client命令的服务器的11371端口被占用,导致安装失败。实际上,gpg命令默认使用的就是11371端口。
解决方案 (jiě jué àn)
在chef的角色设置文件中,将nodejs的keyserver更改为“hkp://keyserver.ubuntu.com:80”。
# roles/my-role.json
{
"name": "my-role",
"default_attributes": {
"nodejs": {
"keyserver": "hkp://keyserver.ubuntu.com:80"
}
},
"json_class": "Chef::Role",
"description": "",
"chef_type": "role",
"run_list": [
"recipe[nodejs]"
]
}
请提供以下内容的中文翻译。
参考:
-
- nodejs::repo recipe timing out to keyserver for ubuntu
- ポート制限のある環境でUbuntuにPPAリポジトリを追加する