NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.59k stars 13.07k forks source link

opensearch-cli cannot find java "in bundled sdk" #237057

Open mweinelt opened 1 year ago

mweinelt commented 1 year ago

Describe the bug

# opensearch-cli  --help
could not find java in bundled jdk at /nix/store/149bqp23jjml2mngdvw9alamf0znsg1r-opensearch-2.7.0/jdk/bin/java

Steps To Reproduce

Steps to reproduce the behavior:

  1. Set up opensearch
  2. Try to run opensearch-cli

Expected behavior

The CLI should be working.

Additional information

After symlinking jre_headless into $out/jdk I get

# opensearch-cli  --help
Error: Could not find or load main class 
Caused by: java.lang.ClassNotFoundException: 

Notify maintainers

@shyim

Metadata

nixos-23.05/nixos-unstable

shyim commented 1 year ago

wrapping is missing for opensearch-cli https://github.com/NixOS/nixpkgs/blob/21951114383770f96ae528d0ae68824557768e81/pkgs/servers/search/opensearch/default.nix#L41

I will take a look :)

shyim commented 1 year ago

I can reproduce that also outside of Nix. I asked in Opensearch Slack if someone has an idea 😅

shyim commented 1 year ago

image

seems like bundled by mistake. I will make a PR to delete that file. Maybe we should package then opensearch-cli as separate package :)

mweinelt commented 6 months ago

Do you still plan to do that PR? :wink:

colemickens commented 5 months ago

I've installed opensearch and opensearch-cli but it seems they still don't really work. I'm guessing opensearch is calling opensearch-keystore which is calling opensearch-cli in the wrong location.


â•­ zeph  ~/work/code/flakehub/experimental dev-env 10sec 175ms
╰🡒  opensearch
/nix/store/gi9ar6wrkdfv1y8qhd1jlmwpv9g0cpsh-opensearch-2.11.1/bin/opensearch-keystore: line 5: /nix/store/gi9ar6wrkdfv1y8qhd1jlmwpv9g0cpsh-opensearch-2.11.1/bin/open
search-cli: No such file or directory
Exception in thread "main" java.lang.RuntimeException: starting java failed with [1]
output:
[0.000s][error][logging] Error opening log file 'logs/gc.log': No such file or directory
[0.000s][error][logging] Initialization of output 'file=logs/gc.log' using options 'filecount=32,filesize=64m' failed.
error:
Invalid -Xlog option '-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m', see error log for details.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
        at org.opensearch.tools.launchers.JvmErgonomics.flagsFinal(JvmErgonomics.java:125)
        at org.opensearch.tools.launchers.JvmErgonomics.finalJvmOptions(JvmErgonomics.java:87)
        at org.opensearch.tools.launchers.JvmErgonomics.choose(JvmErgonomics.java:70)
        at org.opensearch.tools.launchers.JvmOptionsParser.jvmOptions(JvmOptionsParser.java:150)
        at org.opensearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:108)

╭ zeph  ~/work/code/flakehub/experimental dev-env 244ms ✘1
╰🡒  /nix/store/gi9ar6wrkdfv1y8qhd1jlmwpv9g0cpsh-opensearch-2.11.1/bin/opensearch-keystore
/nix/store/gi9ar6wrkdfv1y8qhd1jlmwpv9g0cpsh-opensearch-2.11.1/bin/opensearch-keystore: line 5: /nix/store/gi9ar6wrkdfv1y8qhd1jlmwpv9g0cpsh-opensearch-2.11.1/bin/open
search-cli: No such file or directory
dacevedo12 commented 5 months ago

I'm experiencing the same error. opensearch-keystore calls the bundled opensearch-cli but fails as it is removed in the installPhase script.

From the message above, are you sure the bundled cli is a mistake? If so, can opensearch-keystore work with the separate cli package introduced in https://github.com/NixOS/nixpkgs/pull/277065?

dm-kialo commented 1 month ago

Has anyone figured out how to fix this? I'm seeing the same error.

shyim commented 1 month ago

You cannot all opensearch without creating a "data dir" on your own. See here https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/search/opensearch.nix#L197

You should use the service, that does everything for you