elastic / elastic/logstash

RPM Post install script fails when java is not in /usr/bin/java

Open
#6,902 12 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
14.9k
Forks
3.5k
Avg merge
19h 14m
Merged PRs (30d)
63

Description

- Version: 5.3
- Operating System: CentOS 7
- Steps to Reproduce: yum install https://artifacts.elastic.co/downloads/logstash/logstash-5.3.0.rpm

Environment:
JRE java in /opt/local/mobenga/java/jre-1.8.0_121/bin/java
Symlink from that to /usr/local/bin/java
/usr/local/bin in PATH

When running (as root) the following command:
yum install yum install https://artifacts.elastic.co/downloads/logstash/logstash-5.3.0.rpm
gives
```
Installing : 1:logstash-5.3.0-1.noarch 1/1
Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME.
warning: %post(logstash-1:5.3.0-1.noarch) scriptlet failed, exit status 1
Non-fatal POSTIN scriptlet failure in rpm package 1:logstash-5.3.0-1.noarch
Verifying : 1:logstash-5.3.0-1.noarch 1/1

Installed:
logstash.noarch 1:5.3.0-1
```

See the attached trace of the system-install script. I guess that it gets confused that /usr/local/bin/java is a symlink as it is tested with -f and not -e.

exporting JAVA_HOME to /opt/local/mobenga/java/jre-1.8.0_121 produces this error
```
/usr/share/logstash/vendor/jruby/bin/jruby: line 388: /usr/bin/java: No such file or directory
```

The only way to make it work is to symlink java to /usr/bin/java.

[system-install.txt](https://github.com/elastic/logstash/files/912686/system-install.txt)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.