Logstash: ./system-install error

Created on 16 Mar 2017  路  12Comments  路  Source: elastic/logstash

Ubuntu 16.04 inside Docker
logstash 5.2.2
init daemon: supervisord

Had problems with installation. Installing via apt from your repos haven't created any init script noted from your official documentation.
Had to read manual launch documentation.

Found this script in bin folder. It seems related to service installation, but it throws an error.
Probably because haven't found supervisor service, because it's not supported as i suppose.
Can be wrong ofc.

root@beck:/usr/share/logstash/bin# ./system-install 
NoMethodError: undefined method `tr' for nil:NilClass
   detect_upstart at /usr/share/logstash/vendor/bundle/jruby/1.9/gems/pleaserun-0.0.28/lib/pleaserun/detector.rb:45
  detect_platform at /usr/share/logstash/vendor/bundle/jruby/1.9/gems/pleaserun-0.0.28/lib/pleaserun/detector.rb:24
           detect at /usr/share/logstash/vendor/bundle/jruby/1.9/gems/pleaserun-0.0.28/lib/pleaserun/detector.rb:18
   setup_defaults at /usr/share/logstash/vendor/bundle/jruby/1.9/gems/pleaserun-0.0.28/lib/pleaserun/cli.rb:142
          execute at /usr/share/logstash/vendor/bundle/jruby/1.9/gems/pleaserun-0.0.28/lib/pleaserun/cli.rb:108
              run at /usr/share/logstash/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:67
              run at /usr/share/logstash/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:132
           (root) at /usr/share/logstash/lib/systeminstall/pleasewrap.rb:12
Unable to install system startup script for Logstash.
root@beck:/usr/share/logstash/bin# 

Most helpful comment

This still is a problem for anyone trying to install logstash from the official repo into a docker container. The .deb package installation should not be failing because there is no systemd or sysv. I consider this a bug.

All 12 comments

Containers are frequently going to be different. It appears yours does not contain the tr binary, which is causing the script to fail.

You will either have to build your own service scripts, or launch logstash manually. With containers, this is frequently the chosen path anyway.

what is that tr?

Have you tried running it as bin/system-install from the /usr/share/logstash directory? I don't think it will make a difference, but path detection can be weird.

At any rate, I was barely awake and responding from my phone. That tr is actually a ruby call. It's saying that the out variable is nil, and you can't run a tr against a nil value.

The out variable in the specified error suggests that it tried to run initctl --version and it failed. It is supposed to return false if it fails, but somehow it's not trapping properly.

You may be able to force an init script, as systemd may be weird inside a container.

In any case, you should be able to manually run:

  • for SysV Init: /usr/share/logstash/bin/system-install /etc/logstash/startup.options sysv
  • for systemd: /usr/share/logstash/bin/system-install /etc/logstash/startup.options systemd

And this will _force_ system-install to use the specified version.

Yeah, container is completely clean. systemd isn't installed at all. There is pain in the ... with systemd inside Docker container.

Does the manual SysV install work for you?

Not sure, i'm using supervisord. Well at any rate, i have already installed it long ago. Currently working with kibana and various beat servers (metricbeat/filebeat etc). Just wanted to report. Open source etc. :D

solidarity feeling :D

Cool. Will chalk this up to a container thing that we already have a workaround for.

This still is a problem for anyone trying to install logstash from the official repo into a docker container. The .deb package installation should not be failing because there is no systemd or sysv. I consider this a bug.

Wait, so the workaround is to complete the installation manually? I agree with @rhaist that this is a bug.

Just encountered this when install logstash in an Ubuntu image. The installer fails because the command initctl --version doesn't return a value. The contents of that script are simply:

#!/bin/sh
exit 0

So as an ugly hack, to work around this issue, you can update the script to just print something, e.g.

#!/bin/sh
echo 0.1

And the installer will finish by harmlessly setting up unused init scripts.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

simmel picture simmel  路  4Comments

scheung38 picture scheung38  路  5Comments

dvic picture dvic  路  3Comments

packetrevolt picture packetrevolt  路  3Comments

dorj1234 picture dorj1234  路  3Comments