Sensu-go: CentOS 7 package for stable not installing systemd unit files

Created on 6 Dec 2018  路  16Comments  路  Source: sensu/sensu-go

Expected Behavior




I'd expect systemd unit files to be installed when I install sensu-go packages on CentOS 7.

Current Behavior


Running transaction
  Installing : sensu-go-cli-5.0.0-1.x86_64                                                                                                                                       1/3
  Installing : sensu-go-backend-5.0.0-1.x86_64                                                                                                                                   2/3
cp: cannot stat '/usr/share/doc/sensu-go-backend-5.0.0/sensu-backend.service': No such file or directory
chmod: cannot access '/lib/systemd/system/sensu-backend.service': No such file or directory
warning: %post(sensu-go-backend-5.0.0-1.x86_64) scriptlet failed, exit status 1
Non-fatal POSTIN scriptlet failure in rpm package sensu-go-backend-5.0.0-1.x86_64
  Installing : sensu-go-agent-5.0.0-1.x86_64                                                                                                                                     3/3
cp: cannot stat '/usr/share/doc/sensu-go-agent-5.0.0/sensu-agent.service': No such file or directory
chmod: cannot access '/lib/systemd/system/sensu-agent.service': No such file or directory
warning: %post(sensu-go-agent-5.0.0-1.x86_64) scriptlet failed, exit status 1
Non-fatal POSTIN scriptlet failure in rpm package sensu-go-agent-5.0.0-1.x86_64
  Verifying  : sensu-go-agent-5.0.0-1.x86_64                                                                                                                                     1/3
  Verifying  : sensu-go-backend-5.0.0-1.x86_64                                                                                                                                   2/3
  Verifying  : sensu-go-cli-5.0.0-1.x86_64

Worth noting /usr/share/doc/ has no sensu-go directories:

[root@sensu_backend /]# ls -la /usr/share/doc/
total 52
drwxr-xr-x 1 root root 4096 Dec  6 22:47 .
drwxr-xr-x 1 root root 4096 Dec  5 01:37 ..
drwxr-xr-x 2 root root 4096 Oct 30 19:18 coreutils-8.22
drwxr-xr-x 2 root root 4096 Nov  2 16:19 dbus-1.10.24
drwxr-xr-x 2 root root 4096 Jul 13 13:05 gnupg2-2.0.22
drwxr-xr-x 2 root root 4096 Nov  2 16:15 krb5-libs-1.15.1
drwxr-xr-x 2 root root 4096 Apr 11  2018 pam-1.1.8
drwxr-xr-x 2 root root 4096 Dec  6 22:47 puppet5-release-5.0.0
drwxr-xr-x 3 root root 4096 Dec  5 01:36 pygpgme-0.3
drwxr-xr-x 3 root root 4096 Dec  5 01:36 python-kitchen-1.1.1
drwxr-xr-x 2 root root 4096 Nov  5  2016 python-pycurl-7.19.0
drwxr-xr-x 2 root root 4096 Oct 31 00:36 sudo-1.8.23

Possible Solution



Fix package contents to include necessary files.

Steps to Reproduce (for bugs)


  1. Fresh install of CentOS 7
  2. yum install sensu-go-agent sensu-go-backend sensu-go-cli
  3. 3.
[root@sensu_backend /]# systemctl start sensu-backend
Failed to start sensu-backend.service: Unit not found.

Context



I am working on a Puppet module and unable to get regression tests to pass on systemd OSes that used to work with beta.

Your Environment

  • Sensu version used (sensuctl, sensu-backend, and/or sensu-agent): 5.0.0
  • Installation method (packages, binaries, docker etc.): RPM
  • Operating System and version (e.g. Ubuntu 14.04): CentOS 7
bug packaging

All 16 comments

CC @ghoneycutt

This makes no sense, because I download the RPMs and the contents contain the files I would expect. If I install the packages inside a full Vagrant environment I do not face these issues, only with Docker environment that is very limited. Without having access to the RPM spec source I have no clue as to what is breaking the installs.

wget --content-disposition https://packagecloud.io/sensu/stable/packages/el/7/sensu-go-backend-5.0.0-1.x86_64.rpm/download.rpm
[root@sensu_backend /]# rpm2cpio sensu-go-backend-5.0.0-1.x86_64.rpm | cpio -dimv
./etc/sensu
cpio: ./usr/sbin/sensu-backend not created: newer or same age version exists
./usr/sbin/sensu-backend
./usr/share/doc/sensu-go-backend-5.0.0
./usr/share/doc/sensu-go-backend-5.0.0/LICENSE.txt
./usr/share/doc/sensu-go-backend-5.0.0/README.txt
./usr/share/doc/sensu-go-backend-5.0.0/backend.yml.example
./usr/share/doc/sensu-go-backend-5.0.0/sensu-backend
./usr/share/doc/sensu-go-backend-5.0.0/sensu-backend.service
./var
./var/cache
./var/cache/sensu
./var/cache/sensu/sensu-backend
./var/lib
./var/lib/sensu
./var/lib/sensu/sensu-backend
./var/log
./var/log/sensu
cpio: ./var/run not created: newer or same age version exists
./var/run
./var/run/sensu

This may relate to #2496 . The issue is not isolated to systemd systems. The test matrix we use for Puppet includes CentOS 6 and those are failing because sensu-backend is not a recognized service.

Tests:
https://travis-ci.org/sensu/sensu-puppet/builds/464697537

The only OS passing so far is Ubuntu 16.04, all others are failing. The way the Puppet code works the only difference between OSes is the repo being added, all other logic is OS independent.

On hunch I installed redhat-lsb-core on CentOS 7 docker image and now sensu-go-backend installs the systemd service but sensu-go-agent still failing. Something like redhat-lsb-core should not be necessary and wasn't needed during beta but maybe I'm missing something and just worked around the problem with redhat-lsb-core.

One more data point, our regression tests for Amazon Linux 2.0 and Amazon Linux 2018.03 are passing along with Ubuntu 16.04. All other tests are failing:

  • CentOS 6 & 7
  • Ubuntu 14.04 & 18.04
  • Debian 8 & 9

Hello!
I'm having trouble reproducing this on Centos 7 system I have access to.

A couple of quick questions. was this an upgrade from beta packages Or fresh install?

When you installed that redhat-lsb-core package into the Docker environment, did it drag in any other dependencies?

I don't have redhat-lsb-core installed on my Centos7 system.. but I'm suspicious there some other package that redhat-lsb-core needs that the sensu-go-backend expects as part of rpm pre/post install script action.

@treydock
Hey!
I found a way to reproduce this on my system
rpm -Uvh --excludedocs sensu-go-backend-5.0.0-1.x86_64.rpm

Do you have something in your environment that is telling rpm to excludedocs when installing?

Nothing, just plain Centos using yum. The issue is on fresh install and only from minimal docker images, but same problem across many OSes.

The underlying problem is definitely the missing /usr/share/doc/sensu-go-backend-5.0.0/*

postinstall script attempts to copy service file from there... different service file depending on whether its systemd or syvinit.

The systemd detection is firing correctly and it attempts to cp the service file...but its not on disk.

The only way I can get my EC2 CentOS 7.6 instance to fail to install that directory is to explicitly ask it to exclude to install the docs. There's similar dpkg setting out there to tell dpkg to exclude /usr/share/doc/ on install as well. Seems excluding docs install is a way that you save space.

My theory, and its only a theory, is that yum is configured in your docker environment to ignore documentation and probably language packages to to save as much space as possible,
Please check the yum tsflags or filters
yum fs filters
if Nodocs: True
then yum is configured to exclude docs on rpm install.

I think I got yum working and maybe Ubuntu but still having issues that may be different problem with Debian. Verified issue exists for both Debian 8 and Debian 9. Let me know if this warrants new issue, will provide update once tested docs issues with our matrix.

Setup

docker run -it debian:8 /bin/bash
apt-get update
apt-get install curl

Issue:

root@047d7f5a7528:/# curl -s https://packagecloud.io/install/repositories/sensu/stable/script.deb.sh | bash
Detected operating system as debian/8.
Checking for curl...
Detected curl...
Checking for gpg...
Detected gpg...
Running apt-get update... done.
Installing debian-archive-keyring which is needed for installing
apt-transport-https on many Debian systems.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/sensu_stable.list...done.
Importing packagecloud gpg key... done.
Running apt-get update... done.

The repository is setup! You can now install packages.
root@047d7f5a7528:/# apt-get install sensu-go-backend
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package sensu-go-backend
root@047d7f5a7528:/# cat /etc/apt/sources.list.d/sensu_stable.list
# this file was generated by packagecloud.io for
# the repository at https://packagecloud.io/sensu/stable

deb https://packagecloud.io/sensu/stable/debian/ jessie main
deb-src https://packagecloud.io/sensu/stable/debian/ jessie main

Does sensu-go no longer support Debian? Looked in stable repo here: https://packagecloud.io/sensu/stable?filter=debs

I don't see Debian, only Ubuntu.

Looks like packages for Ubuntu 14.04 are missing too.

@amdprophet to verify if this is fixed.

@treydock is this working for you now?

I think this is working now, at least in Vagrant VM.

Hi -

This is now happening on version 5.8.0-2735 via CentOS7.2. There is no systemd unit file at all.

Any ideas?

Thanks,

Michael

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nikkictl picture nikkictl  路  4Comments

treydock picture treydock  路  4Comments

palourde picture palourde  路  5Comments

emmanueljamet picture emmanueljamet  路  3Comments

craigpfeiffer picture craigpfeiffer  路  3Comments