Cannot install infrastructure agent on Amazon Linux - RPM upstart issue?

I followed the instructions here and get an error installing that leads me to think the RPM is not made properly for Upstart based systems like Amazon Linux (looking for systemctl). I just updated to the latest version of Amazon Linux and it’s the same

$ cat /etc/system-release
Amazon Linux AMI release 2017.03

https://docs.newrelic.com/docs/infrastructure/new-relic-infrastructure/installation/install-infrastructure-linux

$ sudo yum install newrelic-infra -y
Loaded plugins: priorities, update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package newrelic-infra.x86_64 0:1.0.677-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================
 Package                             Arch                        Version                           Repository                           Size
=============================================================================================================================================
Installing:
 newrelic-infra                      x86_64                      1.0.677-1                         newrelic-infra                       14 M

Transaction Summary
=============================================================================================================================================
Install  1 Package

Total download size: 14 M
Installed size: 42 M
Downloading packages:
newrelic-infra-1.0.677-1.x86_64.rpm                                                                                   |  14 MB     00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : newrelic-infra-1.0.677-1.x86_64                                                                                           1/1
/var/tmp/rpm-tmp.mF5ohq: line 4: systemctl: command not found
warning: %posttrans(newrelic-infra-0:1.0.677-1.x86_64) scriptlet failed, exit status 127
Non-fatal POSTTRANS scriptlet failure in rpm package newrelic-infra-1.0.677-1.x86_64
  Verifying  : newrelic-infra-1.0.677-1.x86_64                                                                                           1/1

Installed:
  newrelic-infra.x86_64 0:1.0.677-1

Complete!

Agent is not installed

$ sudo initctl status newrelic-infra
initctl: Unknown job: newrelic-infra

Hi,

Can you check your /etc/yum.repos.d/newrelic-infra.repo and see if it contains the following?

[newrelic-infra]
name=New Relic Infrastructure
baseurl=http://download.newrelic.com/infrastructure_agent/linux/yum/el/6/x86_64
gpgkey=http://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg
gpgcheck=1
repo_gpgcheck=1

The OS for AWS Linux 2017.03 uses Upstart. I have verified that. This means that the appropriate command for starting the agent should be “initctl”

Since the installation is saying that it is trying to use systemctl it leads me to believe you may have grabbed the wrong line in the installation instructions. If you used the line for CentOS / RHEL instead of Amazon you might end up with the following in the newrelic0infra.repo file

baseurl=http://download.newrelic.com/infrastructure_agent/linux/yum/el/7/x86_64

This would cause a download for the version that uses Systemd which does use systemctl.

If my suspicions are correct, then you will have to remove the current agent version using yum remove newrelic-infra. Then either:

  • step through the instructions for the installation again making certain you use Amazon Linux, or

  • edit the newrelic-infra.repo file and change the baseurl line from .../yum/el/7/x86_64... to .../yum/el/6/x86_64... Then execute:

sudo yum -q makecache -y --disablerepo='*' --enablerepo='newrelic-infra
sudo yum install newrelic-infra -y

I hope that information helps.

4 Likes

Wow, expertly diagnosed. I hadn’t noticed the Amazon line in the instructions on setting up the right repo. I’m all set now. Thank you!

I am having the same problem, I’m using the Linux AMI

$ cat /etc/system-release
Amazon Linux AMI release 2018.03

/etc/yum.repos.d/newrelic-infra.repo file is as follows:

[newrelic-infra]
name=New Relic Infrastructure
baseurl=http://download.newrelic.com/infrastructure_agent/linux/yum/el/6/x86_64
gpgkey=http://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg
gpgcheck=1
repo_gpgcheck=1

.

$ sudo initctl status newrelic-infra
initctl: Unknown job: newrelic-infra
4 Likes

did you have answer for this problem?

I was able to get by this with the following:
yum remove newrelic-infra -y
sudo yum clean all
sudo yum -q makecache -y --disablerepo=’*’ --enablerepo=‘newrelic-infra’
sudo yum install newrelic-infra -y

We are getting No package newrelic-infra available.

Hello @andrew92,

You might need to add the repository first before running that command. Please refer here for the full instructions:

https://docs.newrelic.com/docs/infrastructure/install-configure-manage-infrastructure/linux-installation/install-infrastructure-linux-using-package-manager