Errors while running the elasticsearch instance using gradlew run

Task :distribution:run#createKeystore FAILED
Standard output:

Standard error:
Exception in thread "main" java.lang.IllegalStateException: unable to read from standard input; is standard input open and a tty attached?
at org.elasticsearch.cli.Terminal$SystemTerminal.readText(Terminal.java:173)
at org.elasticsearch.cli.Terminal.promptYesNo(Terminal.java:106)
at org.elasticsearch.common.settings.CreateKeyStoreCommand.execute(CreateKeyStoreCommand.java:43)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:77)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.common.settings.KeyStoreCli.main(KeyStoreCli.java:40)

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':distribution:run#createKeystore'.

Process 'cmd [/C, call, C:\Users\Mohan Kumar U\Desktop\elasticsearch-master\distribution\build\cluster\run node0\elasticsearch-8.0.0-SNAPSHOT\bin\elasticsearch-keystore, create]' finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See Command-Line Interface

BUILD FAILED in 12m 12s
235 actionable tasks: 234 executed, 1 up-to-date

I am stuck here.
anybody any suggestions please

Read this and specifically the "Also be patient" part.

It's fine to answer on your own thread after 2 or 3 days (not including weekends) if you don't have an answer.

Should i provide more info about the error?
Where is it actually going wrong.

Did you try to update your branch to the latest master version?

I did try,still the same error

I just tried the latest master branch on my laptop and this worked well. But I'm running under MacOS.
@jasontedor do we have anyone who can test that on a windows machine?

I tried it in my friends laptop(windows) it works , but not in mine,i am running it in windows too.

Did you run a gradlew clean?

Yes i did

Once you get the error, could you go to C:\Users\Mohan Kumar U\Desktop\elasticsearch-master\distribution\build\cluster\run node0\elasticsearch-8.0.0-SNAPSHOT\bin dir and run from the prompt:

elasticsearch-keystore create

And share all the result?

In thisC:\Users\Mohan Kumar U\Desktop\elasticsearch-master\distribution\build\cluster\run node0\elasticsearch-8.0.0-SNAPSHOT\ dir, i got
'elasticsearch-keystore' is not recognized as an internal or external command,
operable program or batch file.

In C:\Users\Mohan Kumar U\Desktop\elasticsearch-master\distribution\build\cluster\run node0\elasticsearch-8.0.0-SNAPSHOT\bin` dir, I got thisAn elasticsearch keystore already exists. Overwrite? [y/N]y
Exception in thread "main" java.nio.file.AccessDeniedException: C:\ProgramData\Elastic\Elasticsearch\config\elasticsearch.keystore.tmp -> C:\ProgramData\Elastic\Elasticsearch\config\elasticsearch.keystore
at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:309)
at java.base/sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:288)
at java.base/java.nio.file.Files.move(Files.java:1421)
at org.elasticsearch.common.settings.KeyStoreWrapper.save(KeyStoreWrapper.java:505)
at org.elasticsearch.common.settings.CreateKeyStoreCommand.execute(CreateKeyStoreCommand.java:58)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:77)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.common.settings.KeyStoreCli.main(KeyStoreCli.java:40)

@ikakavas Does this ring a bell to you?

Just saw your comment here (https://github.com/elastic/elasticsearch/issues/39413#issuecomment-467787582) and although this does seem to be directly related I wonder if we have another connected issue.

This was expected as the user was in the wrong directory and there was no elasticsearch-keystore in there.

The error here is that the user that ran the elasticsearch-keystore command doesn't have the necessary permissions to overwrite the existing elasticsearch.keystore file during our attempt to overwrite the file. Which might make sense since the file is located in C:\ProgramData\Elastic\Elasticsearch\config\elasticsearch.keystore

This seems to imply that the keystore was already created despite the error message shown in the original post.

@MKU can you please delete the folder and download the latest version again and try to run ./gradlew run? I don't have a windows machine available right now but I can try to replicate this in a VM later if need be

I agree but the @MKU said that he ran gradlew clean. That should clean any existing keystore right?

I guess that if they run gradlew clean with the same user that runs gradlew run then the user would not have the permissions to remove the existing keystore.

The original error

implies that the keystore was already there when this gradle run ran, as it fails when it tries to offer a prompt to the user telling them that the keystore already exists and they can overwrite it if they want to.

An interesting question is why does the user get

In C:\Users\Mohan Kumar U\Desktop\elasticsearch-master\distribution\build\cluster\run node0\elasticsearch-8.0.0-SNAPSHOT\bin` dir, I got thisAn elasticsearch keystore already exists. Overwrite? [y/N]y
Exception in thread "main" java.nio.file.AccessDeniedException: C:\ProgramData\Elastic\Elasticsearch\config\elasticsearch.keystore.tmp -> C:\ProgramData\Elastic\Elasticsearch\config\elasticsearch.keystore

which seems to imply that $ES_CONFIG env variable exists and points to C:\ProgramData\Elastic\Elasticsearch\config\ and is picked up by ./gradlew run

@MKU is Elasticsearch already installed in this windows machine ? If so how did you install it?

I could not run elasticsearch by the zip file download,so i installed MSI installer for windows.
But i am not able to uninstall it.

Do you want to run an unreleased version of Elasticsearch for testing purposes or do you want to run the latest available released version?

What did you try and how did it not work for you? Have you performed the actions as described in our documentation ?

Basically i want to work with latest elasticsearch source code.
I did try to uninstall msi installer as described there.

And what happened, or how did it fail? We can't assist you if you do not share enough details :slight_smile: