scalyr/scalyr-agent-2

rpm: postinstall script commands missing with EL 8

JanneKataja-TomTom opened this issue · 3 comments

rpm scalyr-agent-2 postinstall script attempts to enable service using commands that are no longer supported with RHEL/CentOS 8.
Please see Fedora packaging guidelines for Systemd packaging scriptlets (the OS contains a library of macros that can be used to enable services):
https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_systemd

When running on CentOS 8:

[root@ca9cc96b4be0 /]# yum install scalyr-agent-2
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:01:08 ago on Fri Sep 18 11:10:53 2020.
Dependencies resolved.
================================================================================
 Package                Architecture   Version             Repository      Size
================================================================================
Installing:
 scalyr-agent-2         noarch         2.1.11-1            scalyr         1.6 M

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

Total download size: 1.6 M
Installed size: 6.2 M
Is this ok [y/N]: y
Downloading Packages:
scalyr-agent-2-2.1.11-1.noarch.rpm              1.2 MB/s | 1.6 MB     00:01
--------------------------------------------------------------------------------
Total                                           1.2 MB/s | 1.6 MB     00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Running scriptlet: scalyr-agent-2-2.1.11-1.noarch                         1/1
Checking Python version.

  Installing       : scalyr-agent-2-2.1.11-1.noarch                         1/1
  Running scriptlet: scalyr-agent-2-2.1.11-1.noarch                         1/1
Switching the Python interpreter used by the Scalyr Agent.
The default 'python' command not found, will use python2 binary (/usr/bin/env python2) for running the agent.
The 'python2' command not found, will use python3 binary (/usr/bin/env python3) for running the agent.
The Scalyr Agent will use the python3 binary (/usr/bin/env python3).
Switched agent to python3
If you have an existing instance of scalyr-agent-2 process running, you need to restart it for this change to take an affect.
You can do that by running '/etc/init.d/scalyr-agent-2 restart' command.
Agent switched to python3.
/var/tmp/rpm-tmp.1Y0eEB: line 119: service: command not found
warning: %post(scalyr-agent-2-2.1.11-1.noarch) scriptlet failed, exit status 127

Error in POSTIN scriptlet in rpm package scalyr-agent-2
  Verifying        : scalyr-agent-2-2.1.11-1.noarch                         1/1

Installed:
  scalyr-agent-2-2.1.11-1.noarch

Complete!

Steps to reproduce:

$ docker run -it centos:8 /bin/bash
# yum install wget python3 --assumeyes
# wget -q https://www.scalyr.com/scalyr-repo/stable/latest/scalyr-repo-bootstrap-1.2.2-1.noarch.rpm
# yum install --nogpgcheck scalyr-repo-bootstrap-1.2.2-1.noarch.rpm
# yum install scalyr-repo
# yum install scalyr-agent-2

Also applicable with CentOS 7:

$ docker run -it centos:7 /bin/bash
# yum install wget python3 --assumeyes
# wget -q https://www.scalyr.com/scalyr-repo/stable/latest/scalyr-repo-bootstrap-1.2.2-1.noarch.rpm
# yum install --nogpgcheck scalyr-repo-bootstrap-1.2.2-1.noarch.rpm
# yum install scalyr-repo
# yum install scalyr-agent-2

Please refer to Overview of systemd for RHEL 7: https://access.redhat.com/articles/754933

Hi @JanneKataja-TomTom, thanks for the info and sorry for such a big delay.

We removed the service command from agent's install scripts. It also seems like the service command is not shipped by the docker image rather than the CentOS distribution itself.

About the systemd. We are planning to switch to distribution-specific releases in the nearest future and support of the systemd is one of the main priorities.