Unable to read from standard input; is standard input open and a tty attached?

while trying to follow Install Elasticsearch with Docker | Elasticsearch Reference and stumble upon following issue using elasticsearch-plugin (A tool for managing installed elasticsearch plugins).

docker run - manually:

root@esm1:/opt/elastic-platinum/elasticsearch# docker run -it docker.elastic.co/elasticsearch/elasticsearch:6.3.0 bash
[root@94b40f1066b2 elasticsearch]# ./bin/elasticsearch-plugin install repository-gcs
-> Downloading repository-gcs from elastic
[=================================================] 100%?? 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@     WARNING: plugin requires additional permissions     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.lang.RuntimePermission accessDeclaredMembers
* java.lang.RuntimePermission setFactory
* java.lang.reflect.ReflectPermission suppressAccessChecks
* java.net.SocketPermission * connect,resolve
* java.net.URLPermission http://www.googleapis.com/* *:
* java.net.URLPermission https://www.googleapis.com/* *:
See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.

Continue with installation? [y/N]y
-> Installed repository-gcs
[root@94b40f1066b2 elasticsearch]# 

docker build - via Dockerfile:

Step 3/5 : RUN bin/elasticsearch-plugin install repository-gcs
 ---> Running in 9c4342b368ff
-> Downloading repository-gcs from elastic
[=================================================] 100%?? 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@     WARNING: plugin requires additional permissions     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.lang.RuntimePermission accessDeclaredMembers
* java.lang.RuntimePermission setFactory
* java.lang.reflect.ReflectPermission suppressAccessChecks
* java.net.SocketPermission * connect,resolve
* java.net.URLPermission http://www.googleapis.com/* *:
* java.net.URLPermission https://www.googleapis.com/* *:
See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.

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:168)
	at org.elasticsearch.plugins.PluginSecurity.prompt(PluginSecurity.java:74)
	at org.elasticsearch.plugins.PluginSecurity.confirmPolicyExceptions(PluginSecurity.java:67)
	at org.elasticsearch.plugins.InstallPluginCommand.installPlugin(InstallPluginCommand.java:726)
	at org.elasticsearch.plugins.InstallPluginCommand.install(InstallPluginCommand.java:641)
	at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:225)
	at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:210)
	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:79)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
	at org.elasticsearch.cli.Command.main(Command.java:90)
	at org.elasticsearch.plugins.PluginCli.main(PluginCli.java:48)
ERROR: Service 'elasticsearch' failed to build: The command '/bin/sh -c bin/elasticsearch-plugin install repository-gcs' returned a non-zero code: 1
root@esm1:/opt/elastic-platinum/elasticsearch#

works without an issue with docker.elastic.co/elasticsearch/elasticsearch-platinum:6.2.4 and stopped working with docker.elastic.co/elasticsearch/elasticsearch:6.3.0.

Please advise.

I have moved this to the Elasticsearch forum, as it has nothing to do with X-Pack.

In 6.2, the plugin installer would assume that a non-interactive terminal meant that you wanted to automatically accept all permissions and install the plugin.
This was an incorrect behaviour - we don't want to make those decisions on your behalf, so in 6.3 the behaviour has been corrected so that if the plugin installer needs you to answer a question, and you don't have a tty, then it will raise an error.

See: https://www.elastic.co/guide/en/elasticsearch/reference/6.3/docker.html#_c_customized_image for instructions on how to solve this.

I appreciate you for moving to correct location, you're absolutely correct it's has nothing to do with xpack and more on elasticsearch side, thanks! Is there a link you can provide for that issue? I believe there should be --assumeyes or something similar, so one can use tool without tty.

"instructions on how to solve this" however is exactly same link as I mentioned in my initial post, I also described how change that you mentioned earlier to elasticsearch-plugin tool broke docker 6.3.0+ image (yes, even with x-pack image as well) and therefor one cannot do customized_image anymore...

Some plugins require additional security permissions. You have to explicitly accept them either by attaching a tty when you run the Docker image and accepting yes at the prompts, or inspecting the security permissions separately and if you are comfortable with them adding the --batch flag to the plugin install command. See Plugin Management documentation for more details.

See the --batch option?

2 Likes
root@esm1:/opt/elastic-platinum/elasticsearch# docker run -it docker.elastic.co/elasticsearch/elasticsearch:6.3.1 bash
[root@96c09d14d89b elasticsearch]# ./bin/elasticsearch-plugin | grep -- '--batch'
[root@96c09d14d89b elasticsearch]# 

even though I don't see --batch, I was able to pass step where it failed before...

Step 3/5 : RUN bin/elasticsearch-plugin install --batch repository-gcs
 ---> Running in 6595c9c77807
-> Downloading repository-gcs from elastic
[=================================================] 100%?? 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@     WARNING: plugin requires additional permissions     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.lang.RuntimePermission accessDeclaredMembers
* java.lang.RuntimePermission setFactory
* java.lang.reflect.ReflectPermission suppressAccessChecks
* java.net.SocketPermission * connect,resolve
* java.net.URLPermission http://www.googleapis.com/* *:
* java.net.URLPermission https://www.googleapis.com/* *:
See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.
-> Installed repository-gcs
Removing intermediate container 6595c9c77807

it did failed however on next step

Step 5/5 : RUN bin/elasticsearch-keystore add-file gcs.client.default.credentials_file ./x-x.json
 ---> Running in 4d80d93667b9
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:168)
	at org.elasticsearch.cli.Terminal.promptYesNo(Terminal.java:101)
	at org.elasticsearch.common.settings.AddFileKeyStoreCommand.execute(AddFileKeyStoreCommand.java:65)
	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:79)
	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:41)
ERROR: Service 'elasticsearch' failed to build: The command '/bin/sh -c bin/elasticsearch-keystore add-file gcs.client.default.credentials_file ./x-x.json' returned a non-zero code: 1
root@esm1:/opt/elastic-platinum/elasticsearch# 

Any advise there?)

Try

./bin/elasticsearch-plugin install --help

--force did the trick for me)

Successfully built e631a27ba18c
Successfully tagged docker.elastic.co/elasticsearch/elasticsearch-custom:6.3.1
root@esm1:/opt/elastic-platinum/elasticsearch#

Try --force

$ ./bin/elasticsearch-keystore add-file --help

Add a file setting to the keystore

Non-option arguments:
setting [filepath]

Option             Description
------             -----------
-E <KeyValuePair>  Configure a setting
-f, --force        Overwrite existing setting without prompting
-h, --help         show help
-s, --silent       show minimal output
-v, --verbose      show verbose output

Thank you so much!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.