mongo - cli drops with Failed to mlock: Cannot allocate locked memory

453 views Asked by At
[root@host project]# mongo
2021-06-01T04:51:34.325+0200 F  -        [main] Failed to mlock: Cannot allocate locked memory. For more details see: https://dochub.mongodb.org/core/cannot-allocate-locked-memory: Operation not permitted
2021-06-01T04:51:34.325+0200 F  -        [main] Fatal Assertion 28832 at src/mongo/base/secure_allocator.cpp 255
2021-06-01T04:51:34.325+0200 F  -        [main] 

***aborting after fassert() failure

Using Fedora in nspawn container.

Unfortunately the link is also broken.

Anyone has any suggestions?

1

There are 1 answers

1
Andrés On BEST ANSWER

I got a similar problem. I have a Debian nspawn container with Docker inside. The mongo image failed to launch because mlock system calls were denied.

I had the following configuration in my /etc/systemd/nspawn/machine.nspawn:

[Exec]
Capability=all
SystemCallFilter=add_key keyctl

[Files]
Bind=/sys/fs/cgroup

I solved my problem by adding @memlock to SystemCallFilter.

In your case, if you don't have a Capability=all line in your machine.nspawn file, you need to have at least Capability=CAP_IPC_LOCK.