Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 950962 - app-misc/elasticsearch-8.17.3 fails to start: java.lang.module.FindException: Module jdk.attach not found, required by org.elasticsearch.entitlement
Summary: app-misc/elasticsearch-8.17.3 fails to start: java.lang.module.FindException:...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Matt Jolly
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-08 23:39 UTC by nebojsa
Modified: 2025-04-16 07:57 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Depend on jdk insted of on jre (elasticsearch.patch,389 bytes, patch)
2025-03-08 23:41 UTC, nebojsa
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description nebojsa 2025-03-08 23:39:17 UTC
elasticsearch-8.17 introduced dependency on jdk. Without a jdk installed, it fails to start complaining about jdk.attach module not found.
After installing virtual/jdk:17, it works without a problem

Reproducible: Always
Comment 1 nebojsa 2025-03-08 23:41:20 UTC
Created attachment 920379 [details, diff]
Depend on jdk insted of on jre
Comment 2 Volkmar W. Pogatzki 2025-03-09 07:06:56 UTC
(In reply to nebojsa from comment #0)
> elasticsearch-8.17 introduced dependency on jdk. Without a jdk installed, it
> fails to start complaining about jdk.attach module not found.
> After installing virtual/jdk:17, it works without a problem
> 
> Reproducible: Always

Usually if using virtual/jdk, it should go in DEPEND according to https://wiki.gentoo.org/wiki/Java_Developer_Guide#JDK.2FJRE.
In RDEPEND you put virtual/jre - and don't forget to inherit either of 
java-pkg-2.eclass of java-pkg-opt-2.eclass.
Comment 3 nebojsa 2025-03-10 14:23:37 UTC
(In reply to Volkmar W. Pogatzki from comment #2)
> (In reply to nebojsa from comment #0)
> > elasticsearch-8.17 introduced dependency on jdk. Without a jdk installed, it
> > fails to start complaining about jdk.attach module not found.
> > After installing virtual/jdk:17, it works without a problem
> > 
> > Reproducible: Always
> 
> Usually if using virtual/jdk, it should go in DEPEND according to
> https://wiki.gentoo.org/wiki/Java_Developer_Guide#JDK.2FJRE.
> In RDEPEND you put virtual/jre - and don't forget to inherit either of 
> java-pkg-2.eclass of java-pkg-opt-2.eclass.

This package is not compiled - it is a binary bundle, that's why it does not inherit java-pkg-*.eclass.
Further, it depends on jdk runtime, and not on jre runtime. Running it with jre runtime is what produces the error.
If anything, package name could be changed to better reflect its contents, to elasticsearch-bin, and a warning could be issued to the user about either setting up jdk as system-vm or setting ES_JAVA_HOME in /etc/conf.d/elasticsearch to point to one.
Comment 4 Volkmar W. Pogatzki 2025-03-10 15:14:34 UTC
afaik, binary blob should never depend on jdk. if it does, there's something wrong.
Comment 5 Matt Jolly gentoo-dev 2025-04-03 06:12:01 UTC
> package name could be changed to better reflect its contents, to elasticsearch-bin

We only use the -bin suffix if there's a chance of confusion with a from-source package. There's an infinitesimal likelihood of anyone actually packaging ElasticSearch from source on Gentoo (maybe one of the forks, sure).

> afaik, binary blob should never depend on jdk. if it does, there's something wrong.

I had this argument when initially updating the ebuild to 8.x.

Upstream ships it bundled with JDK (which we remove), however until this point it hasn't explicitly required JDK features.

`jdk.attach` introduced in https://github.com/elastic/elasticsearch/commit/afd7e4e9117090b70b23347426472926eec77096

I didn't notice when packaging this release because I also have an appropriate JDK installed.

I feel like just using JDK for ES is going to be the better long-term solution. We should have done that in the first place since it's what upstream actually uses.

CC Java project: Any feedback before I just implement this? Do you want to have a fight with Elastic/Amazon about how they build and distribute their software?
Comment 6 Larry the Git Cow gentoo-dev 2025-04-16 07:57:46 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b418ef3efc844001381e04b3a7b75de3703386fe

commit b418ef3efc844001381e04b3a7b75de3703386fe
Author:     Matt Jolly <kangie@gentoo.org>
AuthorDate: 2025-04-16 07:52:34 +0000
Commit:     Matt Jolly <kangie@gentoo.org>
CommitDate: 2025-04-16 07:56:59 +0000

    app-misc/elasticsearch: add 8.17.4, 8.18.0, 9.0.0
    
    From this commit we explicitly depend on a JDK at runtime, rather than the
    JRE that we were previously using. While this was fine when the package
    was initially tested, a simultaneously installed JDK masked the fact
    that this no longer works, and has not for an indeterminate period.
    
    Closes: https://bugs.gentoo.org/950962
    Signed-off-by: Matt Jolly <kangie@gentoo.org>

 app-misc/elasticsearch/Manifest                    |   3 +
 app-misc/elasticsearch/elasticsearch-8.17.4.ebuild | 109 +++++++++++++++++++++
 app-misc/elasticsearch/elasticsearch-8.18.0.ebuild | 109 +++++++++++++++++++++
 app-misc/elasticsearch/elasticsearch-9.0.0.ebuild  | 109 +++++++++++++++++++++
 .../elasticsearch/files/elasticsearch-env-2.patch  |  24 +++++
 .../elasticsearch/files/elasticsearch-env-3.patch  |  24 +++++
 6 files changed, 378 insertions(+)