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:
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
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
Most helpful comment
Setting up elasticsearch (5.4.1) ...
skipping setting kernel parameters
Thanks @ludwig-gramberg