Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abort package install if JAVA_HOME is not set and java is not in the path #29665

Closed
jasontedor opened this issue Apr 23, 2018 · 4 comments · Fixed by #31343
Closed

Abort package install if JAVA_HOME is not set and java is not in the path #29665

jasontedor opened this issue Apr 23, 2018 · 4 comments · Fixed by #31343
Assignees
Labels
>bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team v6.3.1

Comments

@jasontedor
Copy link
Member

Since #28928 we create the keystore in a post-install script. Through our scripts, this requires that JAVA_HOME be set or that java is in the path. If this is not the case, the post-install script fails and the installation is broken. It is too late to be failing in post-install. Instead, we should add a check in pre-install for this and fail early.

@jasontedor
Copy link
Member Author

Pinging @hub-cap

@colings86 colings86 added >enhancement :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts labels Apr 24, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

hub-cap added a commit to hub-cap/elasticsearch that referenced this issue Jun 14, 2018
The package installation relies on java being in the path. If java is
not in the path, the tests fail at post-install time. This commit adds a
pre-install check to validate that java exists, and if it fails, the
package is never installed, and thus keeps a system clean, rather than
aborting at post-install and leaving behind a mess.

Closes elastic#29665
@Crazybus
Copy link
Contributor

I ran into some troubles with this when upgrading the ansible-elasticsearch playbook to 6.3. I suspect others are going to run into the same problems too if they are installing elasticsearch and java at the same time.

If you run apt-get -y install openjdk-8-jre-headless elasticsearch java will not be available for the post install tasks of elasticsearch causing the installation to fail. If a pre-install task is added to check for java this is still going to fail.

To quote #28928

This commit removes the ability to specify that a plugin requires the keystore and instead creates the keystore on package installation or when Elasticsearch is started for the first time.

If elasticsearch also creates this file on startup is there a specific reason why we also want to create it in the post install script? I imagine that there must be a good reason but it sounds like the simplest option would be to just remove this from the post install task and let elasticsearch handle creating it.

@jasontedor
Copy link
Member Author

If elasticsearch also creates this file on startup is there a specific reason why we also want to create it in the post install script? I imagine that there must be a good reason but it sounds like the simplest option would be to just remove this from the post install task and let elasticsearch handle creating it.

This is because when Elasticsearch is run as a service (via Sys V init or systemd) we run as the elasticsearch user which today does not have permissions to create files in /etc/elasticsearch. This is why we do this in post-install when we are running as root.

hub-cap added a commit that referenced this issue Jun 25, 2018
The package installation relies on java being in the path. If java is
not in the path, the tests fail at post-install time. This commit adds a
pre-install check to validate that java exists, and if it fails, the
package is never installed, and thus keeps a system clean, rather than
aborting at post-install and leaving behind a mess.

Closes #29665
hub-cap added a commit that referenced this issue Jun 25, 2018
The package installation relies on java being in the path. If java is
not in the path, the tests fail at post-install time. This commit adds a
pre-install check to validate that java exists, and if it fails, the
package is never installed, and thus keeps a system clean, rather than
aborting at post-install and leaving behind a mess.

Closes #29665
hub-cap added a commit that referenced this issue Jun 26, 2018
The package installation relies on java being in the path. If java is
not in the path, the tests fail at post-install time. This commit adds a
pre-install check to validate that java exists, and if it fails, the
package is never installed, and thus keeps a system clean, rather than
aborting at post-install and leaving behind a mess.

Closes #29665
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team v6.3.1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants