Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Infrastructure Install - GPG Error


#1

I am attempting to deploy a server instance of Ubuntu 18.04 on AWS set up using Chef 12 and deployed using OpsWorks. When I do, I am seeing this deployment error log:

`Error executing action `run` on resource 'execute[apt-get -q update]'`
`================================================================================`

`Mixlib::ShellOut::ShellCommandFailed`
`------------------------------------`

`Expected process to exit with [0], but received '100'`

`---- Begin output of apt-get -q update ----`

`STDOUT: Hit:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic InRelease`
`Hit:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease`
`Hit:3 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease`
`Ign:4 http://download.newrelic.com/debian newrelic InRelease`
`Get:5 http://download.newrelic.com/debian newrelic Release [6804 B]`
`Get:6 http://download.newrelic.com/debian newrelic Release.gpg [181 B]`
`Ign:6 http://download.newrelic.com/debian newrelic Release.gpg`
`Hit:7 http://security.ubuntu.com/ubuntu bionic-security InRelease`
`Reading package lists...`

`STDERR: W: GPG error: http://download.newrelic.com/debian newrelic Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B31B29E5548C16BF`

`E: The repository 'http://download.newrelic.com/debian newrelic Release' is not signed.`
`---- End output of apt-get -q update ----`

`Ran apt-get -q update returned 100`
`Resource Declaration:`
`---------------------`

`# In /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider/apt_update.rb`
`80:         declare_resource(:execute, "apt-get -q update")`
`81:       end`
 
`Compiled Resource:`
`------------------`

`# Declared in /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider/apt_update.rb:80:in `do_update'`

`execute("apt-get -q update") do`
`action [:run]`
`retries 0`
`retry_delay 2`
`default_guard_interpreter :execute`
`command "apt-get -q update"`
`backup 5`
`returns 0`
`declared_type :execute`
`cookbook_name "cds_base"`
`end`

`Platform:`
`---------`

`x86_64-linux`

`[2019-03-15T02:25:41+00:00] INFO: Running queued delayed notifications before re-raising exception`
`[2019-03-15T02:25:41+00:00] ERROR: apt_update[newrelic] (/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider/apt_repository.rb line 59) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[apt-get -q update] (/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider/apt_update.rb line 80) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'`

`---- Begin output of apt-get -q update ----`

`STDOUT: Hit:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic InRelease`
`Hit:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease`
`Hit:3 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease`
`Ign:4 http://download.newrelic.com/debian newrelic InRelease`
`Get:5 http://download.newrelic.com/debian newrelic Release [6804 B]`
`Get:6 http://download.newrelic.com/debian newrelic Release.gpg [181 B]`
`Ign:6 http://download.newrelic.com/debian newrelic Release.gpg`
`Hit:7 http://security.ubuntu.com/ubuntu bionic-security InRelease`

`Reading package lists...`

`STDERR: W: GPG error: http://download.newrelic.com/debian newrelic Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B31B29E5548C16BF`
`E: The repository 'http://download.newrelic.com/debian newrelic Release' is not signed.`
`---- End output of apt-get -q update ----`

`Ran apt-get -q update returned 100; ignore_failure is set, continuing`

`================================================================================`
`Error executing action `update` on resource 'apt_update[newrelic]'`
`================================================================================`

`Mixlib::ShellOut::ShellCommandFailed`
`------------------------------------`

`execute[apt-get -q update] (/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider/apt_update.rb line 80) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'`

`---- Begin output of apt-get -q update ----`

`STDOUT: Hit:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic InRelease`
`Hit:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease`
`Hit:3 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease`
`Ign:4 http://download.newrelic.com/debian newrelic InRelease`
`Get:5 http://download.newrelic.com/debian newrelic Release [6804 B]`
`Get:6 http://download.newrelic.com/debian newrelic Release.gpg [181 B]`
`Ign:6 http://download.newrelic.com/debian newrelic Release.gpg`
`Hit:7 http://security.ubuntu.com/ubuntu bionic-security InRelease`

`Reading package lists...`

`STDERR: W: GPG error: http://download.newrelic.com/debian newrelic Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B31B29E5548C16BF`

`E: The repository 'http://download.newrelic.com/debian newrelic Release' is not signed.`

`---- End output of apt-get -q update ----`

`Ran apt-get -q update returned 100`

`Resource Declaration:`
`---------------------`

`# In /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider/apt_repository.rb`

`59:         declare_resource(:apt_update, new_resource.name) do`
`60:           ignore_failure true`
`61:           action :nothing`
`62:         end`
`63: `

`Compiled Resource:`
`------------------`

`# Declared in /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider/apt_repository.rb:59:in `block in <class:AptRepository>'`

`apt_update("newrelic") do`
`action [:nothing]`
`ignore_failure true`
`retries 0`
`retry_delay 2`
`default_guard_interpreter :default`
`declared_type :apt_update`
`cookbook_name "cds_base"`
`end`

`Platform:`
`---------`
`x86_64-linux`

`[2019-03-15T02:25:41+00:00] INFO: Processing apt_package[newrelic-sysmond] action install (/var/chef/runs/99c4dda0-ce45-4ea2-9e24-b24d2c8d8e2e/local-mode-cache/cache/cookbooks/newrelic/providers/server_monitor.rb line 35)`

`================================================================================`
`Error executing action `install` on resource 'apt_package[newrelic-sysmond]'`
`================================================================================`

`Chef::Exceptions::Package`
`-------------------------`

`No candidate version available for newrelic-sysmond`

`Resource Declaration:`
`---------------------`

`# In /var/chef/runs/99c4dda0-ce45-4ea2-9e24-b24d2c8d8e2e/local-mode-cache/cache/cookbooks/newrelic/providers/server_monitor.rb`

`35:   package new_resource.service_name do`
`36:     action new_resource.action`
`37:   end`
`38:   # configure your New Relic license key`

`Compiled Resource:`
`------------------`

`# Declared in /var/chef/runs/99c4dda0-ce45-4ea2-9e24-b24d2c8d8e2e/local-mode-cache/cache/cookbooks/newrelic/providers/server_monitor.rb:35:in `install_newrelic_service_linux'`

`apt_package("newrelic-sysmond") do`
`package_name "newrelic-sysmond"`
`action [:install]`
`retries 0`
`retry_delay 2`
`default_guard_interpreter :default`
`declared_type :package`
`cookbook_name "cds_base"`
`end`

`Platform:`
`---------`
`x86_64-linux`

`[2019-03-15T02:25:41+00:00] INFO: Running queued delayed notifications before re-raising exception`

`================================================================================`
`Error executing action `install` on resource 'newrelic_server_monitor[newrelic]'`
`================================================================================`

 `Chef::Exceptions::Package`
`-------------------------`

`apt_package[newrelic-sysmond] (/var/chef/runs/99c4dda0-ce45-4ea2-9e24-b24d2c8d8e2e/local-mode-cache/cache/cookbooks/newrelic/providers/server_monitor.rb line 35) had an error: Chef::Exceptions::Package: No candidate version available for newrelic-sysmond`

`Resource Declaration:`
`---------------------`

`# In /var/chef/runs/99c4dda0-ce45-4ea2-9e24-b24d2c8d8e2e/local-mode-cache/cache/cookbooks/cds_base/recipes/default.rb`

`36: newrelic_server_monitor 'newrelic' do`
`37:   license(lazy { node['newrelic_license'] })`
`38:   hostname "#{opsworks_stack['name']}-#{node['hostname']}"`
`39:   labels [`
`40:     "Stack:#{opsworks_stack['name']}",`
`41:     "Region:#{opsworks_stack['region']}",`
`42:     "Instance:#{node['ec2']['instance_id']}",`
`43:     "Type:#{node['ec2']['instance_type']}"`
`44:   ].join(';')`
`45:   not_if { node['newrelic_license'].nil? }`
`46:   action :install`
`47: end`
`48: `

 `Compiled Resource:`
`------------------`

`# Declared in /var/chef/runs/99c4dda0-ce45-4ea2-9e24-b24d2c8d8e2e/local-mode-cache/cache/cookbooks/cds_base/recipes/default.rb:36:in `from_file'`

`newrelic_server_monitor("newrelic") do`
`action [:install]`
`updated true`
`updated_by_last_action true`
`retries 0`
`retry_delay 2`
`default_guard_interpreter :default`
`declared_type :newrelic_server_monitor`
`cookbook_name "cds_base"`
`recipe_name "default"`

`license #<Chef::DelayedEvaluator:0x000000077f1438@/var/chef/runs/99c4dda0-ce45-4ea2-9e24-b24d2c8d8e2e/local-mode-cache/cache/cookbooks/cds_base/recipes/default.rb:37>`

`hostname "phi-staging-cvp-us-east-1-20180110web1"`
`labels "Stack:phi-staging-cvp-us-east-1;Region:us-east-1;Instance:i-0b520fb74bb71d447;Type:t2.medium"`
`service_name "newrelic-sysmond"`
`config_path "/etc/newrelic"`
`cookbook "newrelic"`
`source "agent/server_monitor/nrsysmond.cfg.erb"`

`config_file_user "root"`
`config_file_group "newrelic"`
`service_notify_action "restart"`
`service_actions ["enable", "start"]`
`not_if { #code block }`
`end`

`Platform:`
`---------`
`x86_64-linux`

GPG Error (public key)
#2

Hey @miles.lane - This seems to be an issue installing the Infrastructure agent, whereas the post you commented on was PHP. While the Errors are similar (GPG), it’s possible that this is a quite different cause, so I have separated your comment into it’s own thread for our experts to help out. :slight_smile:


#3

Starting with the obvious, did you remember to enable New Relic’s GPG key (step 3 below)?


#4

Hi Phil,

We have newrelic-infra working on our AWS Ubuntu 16.04 instances. We deploy using OpsWorks, which only supports up to Chef 12 currently. We provision instances using Chef.

My current project is to move our servers to running Ubuntu 18.04 instances, but this causes the GPG error. We are using the “newrelic-infra (0.8.1)” cookbook.

I found https://docs.newrelic.com/docs/infrastructure/new-relic-infrastructure/config-management-tools/configure-new-relic-infrastructure-using-chef#attributes

attributes/default.rb:

      node.default['newrelic_infra']['enabled'] = true

recipes/default.rb:

       node.override['newrelic_infra']['config']['license_key'] = node['newrelic_license']
       node.override['newrelic_infra']['config']['display_name'] = "#{opsworks_stack['name']}-#{node['hostname']}"

I don’t see how to run

curl https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg | sudo apt-key add -

within the instance setup process using Chef.

Thanks for your help!

    - Miles

#5

Unfortunately, I have no experience with OpsWorks or Chef. Hopefully other members of the community can help.


#6

I SSHed into the server and ran:

$ curl https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg | sudo apt-key add -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1662 100 1662 0 0 75545 0 --:–:-- --:–:-- --:–:-- 75545
OK
20190315web1:~$ sudo apt-get -q update
Ign:1 http://download.newrelic.com/debian newrelic InRelease
Get:2 http://download.newrelic.com/debian newrelic Release [6804 B]
Get:3 http://download.newrelic.com/debian newrelic Release.gpg [181 B]
Hit:4 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic InRelease
Get:5 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:6 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:7 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Ign:3 http://download.newrelic.com/debian newrelic Release.gpg
Reading package lists…
W: GPG error: http://download.newrelic.com/debian newrelic Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY B31B29E5548C16BF
E: The repository ‘http://download.newrelic.com/debian newrelic Release’ is not signed.

The problem looks very straightforward. apt-get update is expecting a signed repository, and it isn’t. It looks like a NewRelic configuration problem.

  • Miles

#7

Aha!

It appears that the problem is that this needed to run:

wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add -

I ran this and then was able to run apt-get update successfully.

I should not have to do this in our Chef cookbooks.


#8

Hmm… I spun up a new Ubuntu 16.04 instance and executed the install commands from the documentation:

$ echo "license_key: MY_LICENSE_KEY" | sudo tee -a /etc/newrelic-infra.yml
$ curl https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg | sudo apt-key add -
$ printf "deb [arch=amd64] https://download.newrelic.com/infrastructure_agent/linux/apt xenial main" | sudo tee -a /etc/apt/sources.list.d/newrelic-infra.list
$ sudo apt-get update
  Reading package lists... Done
$ sudo apt-get install newrelic-infra -y
  Setting up newrelic-infra (1.2.25) ...
  Created symlink from /etc/systemd/system/multi-user.target.wants/newrelic-infra.service to /etc/systemd/system/newrelic-infra.service.

I did not need to execute the command above, and Infra installed without error. I am not sure why your instance requires the additional step.


#9

We are attempting to use the Ubuntu 18.04 instance type. I don’t know why this would only be a problem on 18.04.

It turns out we are likely going to be blocked from using 18.04 because of a different problem. We deploy our servers using OpsWorks, which currently only supports Chef 12. Ubuntu 18.04 switches from using the old Unix5 method of managing services to systemd. It looks like Chef 12 does not know how to work with systemd. As a result, newrelic-sysmond is not successfully managed.

Rats!


#10

OK, sorry, I thought your original post said 16.04. Also, newrelic-sysmond is our old server monitoring tool, which is no longer supported. The current product is newrelic-infra.


#11

We have been installing both the newrelic and newrelic-infra cookbooks. My coworker says that we have been using the newrelic cookbook because it enables our servers to report when they are deployed to. Is this feature now supported in the newrelic-infra code? We’d be glad to remove our use of unsupported code, if possible.

Thanks,
Miles


#12

We are running this:

execute ‘notify newrelic’ do
cwd “/srv/www/#{opsworks_app[‘shortname’]}/current”
command lazy { “bundle exec dotenv -f .env.local,.env.#{opsworks_app[‘name’]},.env.production,.env newrelic deployments -u #{opsworks_user} -r #{node[‘revision’]} || true” }
user ‘deploy’
only_if { opsworks_instances.first[‘self’] }
end


#13

It looks like perhaps deployment reporting can occur with newrelic-infra, unless the process described in this page requires some other resource: https://docs.newrelic.com/docs/apm/new-relic-apm/maintenance/record-deployments


#14

You are talking about 3 different tools:

  • New Relic Servers (newrelic-sysmond): Discontinued tool for monitoring server resources
  • New Relic Infrastructure (newrelic-infra): Replacement for New Relic Servers
  • New Relic APM (programming-language-specific agents): Tool for monitoring application performance

New Relic APM allows you to visualize code deployments if your deploy process calls a New Relic REST API.