Upgrading the agent fails to restart properly on Ubuntu

It appears the deb package has some issues when apt-get -q -y install newrelic-infra is run.

---- Begin output of apt-get -q -y install newrelic-infra=1.0.273 ----
STDOUT: Reading package lists…
Building dependency tree…
Reading state information…
The following packages were automatically installed and are no longer required:
libgudev-1.0-0 ssl-cert gir1.2-gudev-1.0 python-twisted-names
Use ‘apt-get autoremove’ to remove them.
The following packages will be upgraded:
newrelic-infra
1 upgraded, 0 newly installed, 0 to remove and 85 not upgraded.
Need to get 14.3 MB of archives.
After this operation, 457 kB of additional disk space will be used.
Get:1 https://packagecloud.io/newrelic/infra-beta/ubuntu/ precise/main newrelic-infra amd64 1.0.273 [14.3 MB]
Fetched 14.3 MB in 1s (8775 kB/s)
(Reading database … 81841 files and directories currently installed.)
Preparing to replace newrelic-infra 1.0.266 (using …/newrelic-infra_1.0.273_amd64.deb) …
Unpacking replacement newrelic-infra …
Processing triggers for ureadahead …
Setting up newrelic-infra (1.0.273) …
STDERR: invoke-rc.d: unknown initscript, /etc/init.d/newrelic-infra not found.
initctl: Job is already running: newrelic-infra
dpkg: error processing newrelic-infra (–configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
newrelic-infra
E: Sub-process /usr/bin/dpkg returned an error code (1)
---- End output of apt-get -q -y install newrelic-infra=1.0.273 ----

# ls /etc/init.d/newrelic-* /etc/init.d/newrelic-infra.conf /etc/init.d/newrelic-infra.conf.dpkg-new /etc/init.d/newrelic-sysmond

# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 12.04.5 LTS Release: 12.04 Codename: precise

@bpoweski it looks like something is getting a little mixed up with the init scripts partway through:

STDERR: invoke-rc.d: unknown initscript, /etc/init.d/newrelic-infra not found.
initctl: Job is already running: newrelic-infra

As a follow-up, had the agent already been running on this machine previously? And are you using both SysV and Upstart as an init system on this particular machine?

The agent was already running. I believe upstart has an init compatibility layer in this version. We haven’t explicitly enabled SysV.

@bpoweski so, there’s a few things you might be able to check here:

  1. Whether or not the new version still got installed with newrelic-infra -version
  2. Reinstalling the agent - just in case something changed on the machine (On Ubuntu 12.04, the agent should be installing an Upstart script)
  3. Generally restarting the agent with the correct init commands for the system - in this case sudo initctl restart newrelic-infra

I’m wondering if the errors are kind of a red herring due to the age of 12.04, but it’s certainly something I’d like to keep an eye on (especially if none of the above tactics fixes the issue).

Could you post the results of the command in point #1 in particular?

@dulan I have the same problem in Ubuntu 12.04. To answer your questions:

  1. It does not get installed. I have New Relic Infrastructure Agent version: 1.0.775 and apt-get upgrade tries to upgrade to 1.0.785
  2. Running apt-get install --reinstall newrelic-infra produces the same result.

I noticed that if I stop the agent daemon and then run apt-get upgrade, it doesn’t try to upgrade at all. Also, running apt-get install --reinstall newrelic-infra when the agent daemon is stopped reinstalls version 1.0.775.

I am currently running into this issue on Ubuntu 14.04. I installed newrelic-infra with the newrelic chef recipe version 2.30.0.

Here is the log:

root@web-1:~# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up newrelic-infra (1.0.804) ...
initctl: Job is already running: newrelic-infra
dpkg: error processing package newrelic-infra (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 newrelic-infra
N: Ignoring file '20auto-upgrades.ucf-dist' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension
E: Sub-process /usr/bin/dpkg returned an error code (1)

This is a big problem as my apt-get upgrades are not completing successfully. Any ideas?

OK very weird but I think I have it resolved. I stopped the newrelic-infra service and ran apt-get upgrade and it fixed the issue. Note: I had tried rebooting the whole machine prior to this and that didn’t seem to fix it. Now I have to script this fix out to all hundred nodes…

root@web-1:~# initctl stop newrelic-infra
newrelic-infra stop/waiting
root@web-1:~# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up newrelic-infra (1.0.804) ...
newrelic-infra start/running, process 12373
N: Ignoring file '20auto-upgrades.ucf-dist' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension