# Failed to install S3 repository

**URL:** https://discuss.elastic.co/t/failed-to-install-s3-repository/255566
**Category:** Elasticsearch
**Created:** [November 16, 2020, 3:56pm UTC](https://discuss.elastic.co/t/failed-to-install-s3-repository/255566 "2020-11-16T15:56:44Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![jovan](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jovan](https://discuss.elastic.co/u/jovan)
#### Post date: [November 16, 2020, 3:56pm UTC](https://discuss.elastic.co/t/failed-to-install-s3-repository/255566/1 "2020-11-16T15:56:44Z")

</div>

Hi team, recently we upgraded our cluster to be close to latest release.  
We are using OSS version of stack, with current version 7.9.1:

> rpm -qa | grep elasticsearch-oss  
> elasticsearch-oss-7.9.1-1.x86\_64

However, we want to use S3 repo for backup of our indices, and issue we are facing is that ES is contacting wrong link for download of package:

> ```
> ./elasticsearch-plugin install repository-s3 -v
> -> Installing repository-s3
> Checking if url exists: https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-linux-x86_64-7.9.1.zip
> -> Failed installing repository-s3
> -> Rolling back repository-s3
> -> Rolled back repository-s3
> Exception in thread "main" java.net.ConnectException: Connection timed out
> at java.base/sun.nio.ch.Net.connect0(Native Method)
> at java.base/sun.nio.ch.Net.connect(Net.java:503)
> at java.base/sun.nio.ch.Net.connect(Net.java:492)
> at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:588)
> at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:333)
> at java.base/java.net.Socket.connect(Socket.java:648)
> at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:290)
> at java.base/sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
> at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:182)
> at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
> at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
> at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:265)
> at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:372)
> at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:177)
> at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1194)
> at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1082)
> at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:163)
> at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:142)
> at org.elasticsearch.plugins.InstallPluginCommand.urlExists(InstallPluginCommand.java:418)
> at org.elasticsearch.plugins.InstallPluginCommand.getElasticUrl(InstallPluginCommand.java:374)
> at org.elasticsearch.plugins.InstallPluginCommand.download(InstallPluginCommand.java:305)
> at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:251)
> at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:224)
> at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
> at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
> at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:91)
> at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
> at org.elasticsearch.cli.Command.main(Command.java:90)
> at org.elasticsearch.plugins.PluginCli.main(PluginCli.java:47)
> 
> ```

Problem is that link `https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-linux-x86_64-7.9.1.zip` does not exist, but S3 plugin exist on other link:  
`https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-7.9.1.zip`

I know that plugin can also be installed manually, but it would be easier for maintenance and scripting to use built in command instead of pulling from a hardcoded link.  
It would be nice if this could be fixed and prevented in future releases, because I saw same issue in previous release `7.4.2` where I was also unable to install S3 with build in command.

Thanks,  
Jovan

---

<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: [November 16, 2020, 4:19pm UTC](https://discuss.elastic.co/t/failed-to-install-s3-repository/255566/2 "2020-11-16T16:19:35Z")

</div>

It looks like a bug to me.  
Could you try with 7.9.3 or 7.10.0?

---

<div class="post-metadata">

### Author: ![jovan](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jovan](https://discuss.elastic.co/u/jovan)
#### Post date: [November 16, 2020, 4:36pm UTC](https://discuss.elastic.co/t/failed-to-install-s3-repository/255566/3 "2020-11-16T16:36:12Z")

</div>

Hi David,

Honestly, we cannot upgrade anymore at this point.  
We are using Opendistro for security purposes, and this version is latest that is supported according to their compatibility matrix:  
`https://opendistro.github.io/for-elasticsearch-docs/version-history/`

I am sure that it was not working on `7.4.2.` version, I just don't know if the issue is same on future releases.  
Maybe a temporary fix would be to enable both links to work from ES perspective, and ensure that all future releases are pointing to same working links.

---

<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: [November 16, 2020, 4:52pm UTC](https://discuss.elastic.co/t/failed-to-install-s3-repository/255566/4 "2020-11-16T16:52:24Z")

</div>

Ha! So it's not the official standard or oss distribution.

But this looks like our build?

> `elasticsearch-oss-7.9.1-1.x86_64`

Not sure how this package is different from the official one and if this can be reproduced with a standard build.

It looks strange to me that no one complained about this though.

---

<div class="post-metadata">

### Author: ![jovan](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jovan](https://discuss.elastic.co/u/jovan)
#### Post date: [November 16, 2020, 6:07pm UTC](https://discuss.elastic.co/t/failed-to-install-s3-repository/255566/5 "2020-11-16T18:07:35Z")

</div>

Not sure is it different, we use this repo for pulling OSS packages:

```
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/oss-7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
```

---

<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: [November 16, 2020, 7:15pm UTC](https://discuss.elastic.co/t/failed-to-install-s3-repository/255566/6 "2020-11-16T19:15:27Z")

</div>

That's strange.

I started a Docker image with:

```auto
docker run -p 9200:9200 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch-oss:7.9.1

```

Then I ssh'ed into it.

Here is what I can see:

```auto
[root@1201200fcadc elasticsearch]# bin/elasticsearch-plugin install repository-s3 -v
-> Installing repository-s3
Checking if url exists: https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-linux-x86_64-7.9.1.zip
-> Downloading repository-s3 from elastic
Retrieving zip from https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-7.9.1.zip
[=================================================] 100%?? 
- Plugin information:
Name: repository-s3
Description: The S3 repository plugin adds S3 repositories
Version: 7.9.1
Elasticsearch Version: 7.9.1
Java Version: 1.8
Native Controller: false
Extended Plugins: []
...

```

---

<div class="post-metadata">

### Author: ![jovan](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jovan](https://discuss.elastic.co/u/jovan)
#### Post date: [November 16, 2020, 7:22pm UTC](https://discuss.elastic.co/t/failed-to-install-s3-repository/255566/7 "2020-11-16T19:22:17Z")

</div>

Hi David,

I need to report additional issue with this. Just to mention that our infrastructure resides behind proxy which whitelisted `.elastic.co` domain.

While targeting link directly, I am unable to install plugin:

```auto
   https_proxy='<PROXY_URL>:<PORT>' http_proxy='<PROXY_URL>:<PORT>' ./elasticsearch-plugin install https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-7.9.1.zip -v
   -> Installing https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-7.9.1.zip
   -> Downloading https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-7.9.1.zip
   Retrieving zip from https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-7.9.1.zip
   -> Failed installing https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-7.9.1.zip
   -> Rolling back https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-7.9.1.zip
   -> Rolled back https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-7.9.1.zip
   Exception in thread "main" java.net.ConnectException: Connection timed out
           at java.base/sun.nio.ch.Net.connect0(Native Method)
           at java.base/sun.nio.ch.Net.connect(Net.java:503)
           at java.base/sun.nio.ch.Net.connect(Net.java:492)
           at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:588)
           at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:333)
           at java.base/java.net.Socket.connect(Socket.java:648)
           at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:290)
           at java.base/sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
           at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:182)
           at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
           at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
           at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:265)
           at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:372)
           at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:177)
           at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1194)
           at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1082)
           at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:163)
           at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1595)
           at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1523)
           at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
           at org.elasticsearch.plugins.InstallPluginCommand.downloadZip(InstallPluginCommand.java:448)
           at org.elasticsearch.plugins.InstallPluginCommand.download(InstallPluginCommand.java:329)
           at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:251)
           at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:224)
           at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
           at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
           at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:91)
           at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
           at org.elasticsearch.cli.Command.main(Command.java:90)
           at org.elasticsearch.plugins.PluginCli.main(PluginCli.java:47)

```

However, if I use proxy to download package, and install using archive it works:

```auto
   https_proxy='<PROXY_URL>:<PORT>' http_proxy='<PROXY_URL>:<PORT>' wget https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-7.9.1.zip
   --2020-11-16 19:10:56-- https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-7.9.1.zip
   Connecting to 10.111.142.50:3128... connected.
   Proxy request sent, awaiting response... 200 OK
   Length: 4751033 (4.5M) [application/zip]
   Saving to: ‘repository-s3-7.9.1.zip’
   
   100%[=====================================================================================================================>] 4,751,033 3.00MB/s in 1.5s
   
   2020-11-16 19:10:57 (3.00 MB/s) - ‘repository-s3-7.9.1.zip’ saved [4751033/4751033]

   ./elasticsearch-plugin install file:/usr/share/elasticsearch/bin/repository-s3-7.9.1.zip
   -> Installing file:/usr/share/elasticsearch/bin/repository-s3-7.9.1.zip
   -> Downloading file:/usr/share/elasticsearch/bin/repository-s3-7.9.1.zip
   [=================================================] 100%  
   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   @ WARNING: plugin requires additional permissions @
   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   * java.lang.RuntimePermission accessDeclaredMembers
   * java.lang.RuntimePermission getClassLoader
   * java.lang.reflect.ReflectPermission suppressAccessChecks
   * java.net.SocketPermission * connect,resolve
   * java.util.PropertyPermission es.allow_insecure_settings read,write
   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-s3

```

---

<div class="post-metadata">

### Author: ![jovan](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jovan](https://discuss.elastic.co/u/jovan)
#### Post date: [November 16, 2020, 7:25pm UTC](https://discuss.elastic.co/t/failed-to-install-s3-repository/255566/8 "2020-11-16T19:25:42Z")

</div>

> [@dadoonet](#):
>
> `Checking if url exists: https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-linux-x86_64-7.9.1.zip`

That is actually strange. I don`t know what ES is doing in background, but if you try to open that link it does not exist. And it starts downloading from different link after that:

> [@dadoonet](#):
>
> `Retrieving zip from https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-7.9.1.zip`

I can assume that there is possible issue with starting this command behind a proxy as I mentioned in this post before.

---

<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: [November 17, 2020, 9:13am UTC](https://discuss.elastic.co/t/failed-to-install-s3-repository/255566/9 "2020-11-17T09:13:45Z")

</div>

I looked at the code and I can see this:

```auto
        final String platformUrl = String.format(
            Locale.ROOT,
            "%s/%s-%s-%s.zip",
            baseUrl,
            pluginId,
            platform,
            Build.CURRENT.getQualifiedVersion()
        );
        if (urlExists(terminal, platformUrl)) {
            return platformUrl;
        }
        return String.format(Locale.ROOT, "%s/%s-%s.zip", baseUrl, pluginId, Build.CURRENT.getQualifiedVersion());

```

That's how `repository-s3-linux-x86_64-7.9.1.zip` is rewritten to `repository-s3-7.9.1.zip`.

Could you try with the exact command listed in the documentation?

> **[Other command line parameters | Elasticsearch Plugins and Integrations \[7.10\]...](https://www.elastic.co/guide/en/elasticsearch/plugins/current/_other_command_line_parameters.html#_proxy_settings)**

```auto
sudo ES_JAVA_OPTS="-Dhttp.proxyHost=host_name -Dhttp.proxyPort=port_number -Dhttps.proxyHost=host_name -Dhttps.proxyPort=https_port_number" bin/elasticsearch-plugin install repository-s3

```

---

<div class="post-metadata">

### Author: ![jovan](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jovan](https://discuss.elastic.co/u/jovan)
#### Post date: [November 17, 2020, 12:08pm UTC](https://discuss.elastic.co/t/failed-to-install-s3-repository/255566/10 "2020-11-17T12:08:33Z")

</div>

Yap, that actually works:

```auto
ES_JAVA_OPTS="-Dhttp.proxyHost=<PROXY_URL> -Dhttp.proxyPort=<PROXY_PORT> -Dhttps.proxyHost=<PROXY_URL> -Dhttps.proxyPort=<PROXY_PORT>" ./elasticsearch-plugin install repository-s3 -v
-> Installing repository-s3
Checking if url exists: https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-linux-x86_64-7.9.1.zip
-> Downloading repository-s3 from elastic
Retrieving zip from https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-7.9.1.zip
[=================================================] 100%  
- Plugin information:
Name: repository-s3
Description: The S3 repository plugin adds S3 repositories
Version: 7.9.1
Elasticsearch Version: 7.9.1
Java Version: 1.8
Native Controller: false
Extended Plugins: []
 * Classname: org.elasticsearch.repositories.s3.S3RepositoryPlugin
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: plugin requires additional permissions @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.lang.RuntimePermission accessDeclaredMembers
* java.lang.RuntimePermission getClassLoader
* java.lang.reflect.ReflectPermission suppressAccessChecks
* java.net.SocketPermission * connect,resolve
* java.util.PropertyPermission es.allow_insecure_settings read,write
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-s3

```

I see the actual difference between parsing Proxy now.  
Thanks David!

---

<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: [December 15, 2020, 12:08pm UTC](https://discuss.elastic.co/t/failed-to-install-s3-repository/255566/11 "2020-12-15T12:08:47Z")

</div>

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