It’s not special ubuntu, but just outdated code.
Get source and compile:
apt build-dep systemd ; apt source --compile systemd
The bionic code has a fixed setting for memlock in src/core/main.c @ bump_rlimit_memlock:
r = setrlimit_closest(RLIMIT_MEMLOCK, &RLIMIT_MAKE_CONST(1024ULL*1024ULL*16ULL));
This is changed in August 2018 to 64MB:
commit 91cfdd8d29b353dc1fd825673c9a23e00c92a341
Author: Roman Gushchin <guro@fb.com>
Date: Thu Aug 23 10:46:20 2018 -0700
core: bump mlock ulimit to 64Mb
Bpf programs are charged against memlock ulimit, and the default value
can be too tight on machines with many cgroups and attached bpf programs.
Let's bump it to 64Mb.
diff --git a/src/core/main.c b/src/core/main.c
index ce45f2ded2..88656dcabf 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1201,7 +1201,7 @@ static int bump_rlimit_memlock(struct rlimit *saved_rlimit) {
if (getrlimit(RLIMIT_MEMLOCK, saved_rlimit) < 0)
return log_warning_errno(errno, "Reading RLIMIT_MEMLOCK failed, ignoring: %m");
- r = setrlimit_closest(RLIMIT_MEMLOCK, &RLIMIT_MAKE_CONST(1024ULL*1024ULL*16ULL));
+ r = setrlimit_closest(RLIMIT_MEMLOCK, &RLIMIT_MAKE_CONST(1024ULL*1024ULL*64ULL));
if (r < 0)
return log_warning_errno(r, "Setting RLIMIT_MEMLOCK failed, ignoring: %m");
Nowadays it’s a bit more sophisticated. See:
commit cda7faa9a5ae2fa1ebc27b08e84d5ce62e46e37b
Author: Lennart Poettering <lennart@poettering.net>
Date: Wed Jan 16 18:05:14 2019 +0100
main: dont bump resource limits if they are higher than we need them anyway
This matters in particular in the case of --user, since there we lack
the privs to bump the limits up again later on when invoking children.
We will need a backport of this in case this should be fixed for bionic. In xenial this problem doesn’t exist.