1
1

More than 5 years have passed since last update.

chef-clientでnodejsをインストールするときに「gpg: keyserver timed out」エラーが発生する

Last updated at Posted at 2015-07-01

エラー内容

================================================================================
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

原因

gpgコマンドはデフォルトで11371番ポート使用するのですが、chef-clientを実行したサーバの11371番ポートが空いていなかったせいで、インストールが失敗しました。

解決方法

chefのroleの設定ファイルで、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]"
  ]
}

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1