# Elasticsearch Keystore error: Device or Resource Busy while upgrading

**URL:** https://discuss.elastic.co/t/elasticsearch-keystore-error-device-or-resource-busy-while-upgrading/362884
**Category:** Elasticsearch
**Tags:** docker
**Created:** [July 10, 2024, 1:16pm UTC](https://discuss.elastic.co/t/elasticsearch-keystore-error-device-or-resource-busy-while-upgrading/362884 "2024-07-10T13:16:58Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Umang\_Pachaury](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/umang_pachaury/32/113523_2.png) [@Umang\_Pachaury](https://discuss.elastic.co/u/Umang_Pachaury)
#### Post date: [July 10, 2024, 1:16pm UTC](https://discuss.elastic.co/t/elasticsearch-keystore-error-device-or-resource-busy-while-upgrading/362884/1 "2024-07-10T13:16:58Z")

</div>

Hello,

I have a multi node Elasticsearch cluster running on version 8.13.4.  
The cluster needed Slack Integration and AD/LDAP integration so it also has elasticsearch.keystore file bind mount to it. The cluster is set up in a dockerized environment using docker compose.

While upgrading cluster to 8.14.2 we are facing the following error

```auto
e1 | Exception in thread "main" java.nio.file.FileSystemException: /usr/share/elasticsearch/config/elasticsearch.keystore.tmp -> /usr/share/elasticsearch/config/elasticsearch.keystore: Device or resource busy
e1 | at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
e1 | at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
e1 | at java.base/sun.nio.fs.UnixFileSystem.move(UnixFileSystem.java:882)
e1 | at java.base/sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:309)
e1 | at java.base/java.nio.file.Files.move(Files.java:1430)
e1 | at org.elasticsearch.common.settings.KeyStoreWrapper.save(KeyStoreWrapper.java:519)
e1 | at org.elasticsearch.common.settings.KeyStoreWrapper.save(KeyStoreWrapper.java:433)
e1 | at org.elasticsearch.common.settings.KeyStoreWrapper.upgrade(KeyStoreWrapper.java:307)
e1 | at org.elasticsearch.common.settings.KeyStoreWrapper.bootstrap(KeyStoreWrapper.java:237)
e1 | at org.elasticsearch.server.cli.KeyStoreLoader.bootstrap(KeyStoreLoader.java:37)
e1 | at org.elasticsearch.server.cli.ServerCli.execute(ServerCli.java:88)
e1 | at org.elasticsearch.common.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:54)
e1 | at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:85)
e1 | at org.elasticsearch.cli.Command.main(Command.java:50)
e1 | at org.elasticsearch.launcher.CliToolLauncher.main(CliToolLauncher.java:64)
e1 exited with code 1

```

It seems that the issue is related to bind mounting the elasticsearch.keystore file. This issue is mentioned here

> **[Install Elasticsearch with Docker | Elasticsearch Guide \[8.14\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#_elasticsearch_keystore_device_or_resource_busy)**

According to this if we mount the config directory directly it also asks for other config files as well , that we want to avoid.

What should be the workaround for this issue ?

---

<div class="post-metadata">

### Author: ![lordcosmos1978](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lordcosmos1978/32/102413_2.png) [@lordcosmos1978](https://discuss.elastic.co/u/lordcosmos1978)
#### Post date: [February 19, 2025, 1:52pm UTC](https://discuss.elastic.co/t/elasticsearch-keystore-error-device-or-resource-busy-while-upgrading/362884/2 "2025-02-19T13:52:58Z")

</div>

I have the exact same issue. I am trying to upgrade my cluster from 8.13.2 to 8.17.2 but I get the same problem with the .tmp file

I dont want to mount the entire config folder. That would not make sense I would have to manage all files and directories in that folder locally. That is why I chose to use docker containers. Now for every upgrade I should first extract the contents of the config folder from the image before I can even start an upgrade ?

This is clearly a bug or a very bad design. It would be better if the keystore file was in its own folder like config/keystore/ so I could just bind mount that folder and not the entire config folder.

---

<div class="post-metadata">

### Author: ![yinpeng186315](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yinpeng186315/32/145060_2.png) [@yinpeng186315](https://discuss.elastic.co/u/yinpeng186315)
#### Post date: [September 17, 2025, 8:59am UTC](https://discuss.elastic.co/t/elasticsearch-keystore-error-device-or-resource-busy-while-upgrading/362884/3 "2025-09-17T08:59:04Z")

</div>

I have encountered the same problem. Could you please tell me if there is a solution?

---

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [September 18, 2025, 7:24am UTC](https://discuss.elastic.co/t/elasticsearch-keystore-error-device-or-resource-busy-while-upgrading/362884/4 "2025-09-18T07:24:08Z")

</div>

> [@Umang\_Pachaury](#):
>
> `KeyStoreWrapper.upgrade`

This is happening because Elasticsearch sees that the keystore needs to be upgraded, which it tries to do automatically, but if it doesn’t have write access to `/usr/share/elasticsearch/config/elasticsearch.keystore` then the upgrade fails. Instead, upgrade they keystore yourself by running `elasticsearch-keystore upgrade`. See [these docs](https://www.elastic.co/docs/reference/elasticsearch/command-line-tools/elasticsearch-keystore) for more information.

---

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [September 18, 2025, 7:35am UTC](https://discuss.elastic.co/t/elasticsearch-keystore-error-device-or-resource-busy-while-upgrading/362884/5 "2025-09-18T07:35:00Z")

</div>

I opened [Bind-mounted keystores in upgrades by DaveCTurner · Pull Request #3006 · elastic/docs-content · GitHub](https://github.com/elastic/docs-content/pull/3006) to document this point.
