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

**URL:** <https://discuss.elastic.co/t/unable-to-read-from-standard-input-is-standard-input-open-and-a-tty-attached/138449>\
**Category:** Elasticsearch\
**Created:** [July 3, 2018, 8:19pm UTC](https://discuss.elastic.co/t/unable-to-read-from-standard-input-is-standard-input-open-and-a-tty-attached/138449 "2018-07-03T20:19:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [July 3, 2018, 8:19pm UTC](https://discuss.elastic.co/t/unable-to-read-from-standard-input-is-standard-input-open-and-a-tty-attached/138449/1 "2018-07-03T20:19:39Z")

</div>

while trying to follow [Install Elasticsearch with Docker | Elasticsearch Reference](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#_c_customized_image) 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.

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [July 9, 2018, 2:19am UTC](https://discuss.elastic.co/t/unable-to-read-from-standard-input-is-standard-input-open-and-a-tty-attached/138449/2 "2018-07-09T02:19:19Z")

</div>

_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](https://www.elastic.co/guide/en/elasticsearch/reference/6.3/docker.html#_c_customized_image) for instructions on how to solve this.

---

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [July 9, 2018, 2:57am UTC](https://discuss.elastic.co/t/unable-to-read-from-standard-input-is-standard-input-open-and-a-tty-attached/138449/3 "2018-07-09T02:57:41Z")

</div>

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...

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 9, 2018, 3:09am UTC](https://discuss.elastic.co/t/unable-to-read-from-standard-input-is-standard-input-open-and-a-tty-attached/138449/4 "2018-07-09T03:09:59Z")

</div>

> 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?

---

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [July 9, 2018, 3:31am UTC](https://discuss.elastic.co/t/unable-to-read-from-standard-input-is-standard-input-open-and-a-tty-attached/138449/5 "2018-07-09T03:31:23Z")

</div>

```
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?)

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [July 9, 2018, 3:37am UTC](https://discuss.elastic.co/t/unable-to-read-from-standard-input-is-standard-input-open-and-a-tty-attached/138449/6 "2018-07-09T03:37:53Z")

</div>

Try

```auto
./bin/elasticsearch-plugin install --help

```

---

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [July 9, 2018, 3:39am UTC](https://discuss.elastic.co/t/unable-to-read-from-standard-input-is-standard-input-open-and-a-tty-attached/138449/7 "2018-07-09T03:39:58Z")

</div>

--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#
```

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [July 9, 2018, 3:40am UTC](https://discuss.elastic.co/t/unable-to-read-from-standard-input-is-standard-input-open-and-a-tty-attached/138449/8 "2018-07-09T03:40:18Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [July 9, 2018, 3:41am UTC](https://discuss.elastic.co/t/unable-to-read-from-standard-input-is-standard-input-open-and-a-tty-attached/138449/9 "2018-07-09T03:41:18Z")

</div>

Thank you so much!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 6, 2018, 3:41am UTC](https://discuss.elastic.co/t/unable-to-read-from-standard-input-is-standard-input-open-and-a-tty-attached/138449/10 "2018-08-06T03:41:23Z")

</div>

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