-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
"could not find java; set JAVA_HOME" from Debian package install script breaks cloud-init, breaks automation #49948
Comments
After the installation has failed, this puts the apt packaging system in a state where no further packages can be installed. The box appears to be unrecoverable.
|
It looks like the regression was added here: #31343 We were previously using elasticsearch v6.2.2, and this worked. What seems to be happening is that if you try and install openjdk and elasticsearch together in the same apt-get install, which is how cloud-init works, the preinstall script for elasticsearch appears to run before the postinstall script for openjdk which sets up /etc/alternatives and /usr/bin/java. The installation then fails. The failure in elasticsearch preinst causes the openjdk postinst to be skipped, and as a result the system remains permanently broken. The root cause looks like it's because elasticsearch doesn't declare itself dependent on a jdk of any kind: root@x-jm-unstable-black-els01:~# apt-cache depends elasticsearch As a result, apt-get doesn't know that openjdk needs to go before elasticsearch, and chaos ensues. It looks like the fix is for elasticsearch to declare it needs a JDK. |
We are not going to modify 6.8 to require a JDK. In 7.x we have solved this by bundling a JDK with Elasticsearch, that’s our long-term fix for this problem. |
Unfortunately our vendor does not support elasticsearch 7.x at this time. How do you propose we solve this problem? |
I've added #49983 to properly track the problem, with the solution as per debian packaging guidelines. |
Elasticsearch version (
bin/elasticsearch --version
): 6.8.5Plugins installed: [elasticsearch-analysis-icu]
JVM version (
java -version
): openjdk version "11.0.4" 2019-07-16OS version (
uname -a
if on a Unix-like system): Linux x-jm-unstable-black-els01 4.15.0-1056-aws #58-Ubuntu SMP Tue Nov 26 15:14:34 UTC 2019 x86_64 x86_64 x86_64 GNU/LinuxDescription of the problem including expected versus actual behavior:
When an attempt is made to install elasticsearch v6.8.5 from a Debian package, the installation fails because JAVA_HOME has not been set.
This creates a chicken and egg problem. Automation tooling expects the package to be installed first, and then configured after, Elasticsearch expects itself to be configured first, then installed after.
As a result, automated installations via cloud-init break.
Steps to reproduce:
Selecting previously unselected package elasticsearch.
Preparing to unpack .../080-elasticsearch_6.8.5_all.deb ...
could not find java; set JAVA_HOME
dpkg: error processing archive /tmp/apt-dpkg-install-R5VwK1/080-elasticsearch_6.8.5_all.deb (--unpack):
new elasticsearch package pre-installation script subprocess returned error exit status 1
To fix this, the debian package install scripts must not fail with a fatal error if the system is not yet sane. The system will become sane later when configuration is completed.
Provide logs (if relevant):
The text was updated successfully, but these errors were encountered: