Elasticsearch: Elasticsearch 5 can't be installed in LXC

Created on 23 Dec 2016  路  5Comments  路  Source: elastic/elasticsearch

I'm trying to install elasticsearch 5.0.2 inside a priveleged LXC container. Install process fails with
Failed to write '262144' to '/proc/sys/vm/max_map_count': Read-only file system

Elasticsearch version: 5.0.x

JVM version: 8u111

OS version: Debian 8.6

Installing using dpkg fails with mentioned error. Can't be fixed with apt-get -f install. Package manager remains in failed state. Only option is to remove /usr/lib/sysctl.d/elasticsearch.conf and try to reconfigure package.
Error appears even if /proc/sys/vm/max_map_count is already set to 262144 (on the host system).

Steps to reproduce:

  1. Spin up a debian LXC container lxc-create -n debian -t debian -- -r jessie
  2. Install java
  3. dpkg -i elasticsearch-5.0.2.deb
    Provide logs (if relevant):

Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up elasticsearch (5.0.2) ...
Failed to write '262144' to '/proc/sys/vm/max_map_count': Read-only file system
dpkg: error processing package elasticsearch (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
elasticsearch
E: Sub-process /usr/bin/dpkg returned an error code

Most helpful comment

export ES_SKIP_SET_KERNEL_PARAMETERS=true && apt-get install elasticsearch

Setting up elasticsearch (5.4.1) ...
skipping setting kernel parameters

Thanks @ludwig-gramberg

All 5 comments

Duplicates #21877, closed by #21899

I just ran into the exact same problem, even if i set the max_map_count value in the host, the installer tries blindly to set the value which fails in lxc

Setting up elasticsearch (5.4.1) ...
Couldn't write '65536' to 'vm/mmap_min_addr', ignoring: Read-only file system
Couldn't write '1' to 'kernel/kptr_restrict', ignoring: Read-only file system
Couldn't write '1' to 'fs/protected_hardlinks', ignoring: Read-only file system
Couldn't write '262144' to 'vm/max_map_count', ignoring: Read-only file system
Couldn't write '4 4 1 7' to 'kernel/printk', ignoring: Read-only file system
Couldn't write '1' to 'fs/protected_symlinks', ignoring: Read-only file system
Couldn't write '176' to 'kernel/sysrq', ignoring: Read-only file system
Couldn't write '1' to 'kernel/yama/ptrace_scope', ignoring: Read-only file system
dpkg: error processing package elasticsearch (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
elasticsearch
E: Sub-process /usr/bin/dpkg returned an error code (1)

using the environment variable worked

export ES_SKIP_SET_KERNEL_PARAMETERS=true && apt-get install elasticsearch

Setting up elasticsearch (5.4.1) ...
skipping setting kernel parameters

Thanks @ludwig-gramberg

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ppf2 picture ppf2  路  3Comments

DhairyashilBhosale picture DhairyashilBhosale  路  3Comments

jpountz picture jpountz  路  3Comments

martijnvg picture martijnvg  路  3Comments

clintongormley picture clintongormley  路  3Comments