# Memory locking requested for elasticsearch process but memory is not locked

**URL:** <https://discuss.elastic.co/t/memory-locking-requested-for-elasticsearch-process-but-memory-is-not-locked/304655>\
**Category:** Elasticsearch\
**Created:** [May 13, 2022, 9:10am UTC](https://discuss.elastic.co/t/memory-locking-requested-for-elasticsearch-process-but-memory-is-not-locked/304655 "2022-05-13T09:10:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![amitsa](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@amitsa](https://discuss.elastic.co/u/amitsa)\
**Post date:** [May 13, 2022, 9:10am UTC](https://discuss.elastic.co/t/memory-locking-requested-for-elasticsearch-process-but-memory-is-not-locked/304655/1 "2022-05-13T09:10:58Z")

</div>

i am enabling bootstrap.memory\_lock: true on kubrnetes deployment of elastic multi node cluster. getting below error.

Tried with this one

```auto
#Set memlock limit
      - name: memlock-limit
        image: busybox
        imagePullPolicy: IfNotPresent
        command: ["sh", "-c", "ulimit -l unlimited"]
        securityContext:
          privileged: true
# Increase the max number of open file descriptors.
      - name: increase-fd-ulimit
        image: busybox
        imagePullPolicy: IfNotPresent
        command: ["sh", "-c", "ulimit -n 65536"]
        securityContext:
          privileged: true

```

```auto
Then tried doing it with adding in limits.conf file
elasticsearch soft memlock unlimited

elasticsearch hard memlock unlimited 

```

still getting below error on logs

```auto

ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [1]: memory locking requested for elasticsearch process but memory is not locked
ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/elasticsearch.log
{"type": "server", "timestamp": "2022-05-13T08:15:55,875Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "elasticsearch", "node.name": "es-master", "message": "stopping ..." }

```

---

<div class="post-metadata">

**Author:** ![amitsa](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@amitsa](https://discuss.elastic.co/u/amitsa)\
**Post date:** [May 13, 2022, 9:12am UTC](https://discuss.elastic.co/t/memory-locking-requested-for-elasticsearch-process-but-memory-is-not-locked/304655/2 "2022-05-13T09:12:27Z")

</div>

I am not able to access the /usr/share/Elasticsearch/logs/Elasticsearch.log as container gets killed

---

<div class="post-metadata">

**Author:** ![amitsa](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@amitsa](https://discuss.elastic.co/u/amitsa)\
**Post date:** [May 16, 2022, 1:53am UTC](https://discuss.elastic.co/t/memory-locking-requested-for-elasticsearch-process-but-memory-is-not-locked/304655/3 "2022-05-16T01:53:54Z")

</div>

```auto
{"@timestamp":"2022-05-16T01:48:17.969Z", "log.level": "WARN", "message":"Unable to lock JVM Memory: error=12, reason=Cannot allocate memory", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.bootstrap.JNANatives","elasticsearch.node.name":"es-master","elasticsearch.cluster.name":"elasticsearch"}
{"@timestamp":"2022-05-16T01:48:17.975Z", "log.level": "WARN", "message":"This can result in part of the JVM being swapped out.", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.bootstrap.JNANatives","elasticsearch.node.name":"es-master","elasticsearch.cluster.name":"elasticsearch"}
{"@timestamp":"2022-05-16T01:48:17.976Z", "log.level": "WARN", "message":"Increase RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.bootstrap.JNANatives","elasticsearch.node.name":"es-master","elasticsearch.cluster.name":"elasticsearch"}
{"@timestamp":"2022-05-16T01:48:17.976Z", "log.level": "WARN", "message":"These can be adjusted by modifying /etc/security/limits.conf, for example:\n\t# allow user 'elasticsearch' mlockall\n\telasticsearch soft memlock unlimited\n\telasticsearch hard memlock unlimited", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.bootstrap.JNANatives","elasticsearch.node.name":"es-master","elasticsearch.cluster.name":"elasticsearch"}

```

---

<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:** [June 13, 2022, 1:54am UTC](https://discuss.elastic.co/t/memory-locking-requested-for-elasticsearch-process-but-memory-is-not-locked/304655/4 "2022-06-13T01:54:28Z")

</div>

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