memlock setting in systemd (pid 1) too low for containers (bionic)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| systemd (Ubuntu) |
High
|
Guilherme G. Piccoli | ||
| Bionic |
High
|
Guilherme G. Piccoli | ||
| Cosmic |
High
|
Guilherme G. Piccoli | ||
| Disco |
High
|
Guilherme G. Piccoli | ||
| Eoan |
High
|
Guilherme G. Piccoli | ||
| Focal |
High
|
Guilherme G. Piccoli |
Bug Description
[Impact]
* Since systemd commit fb3ae275cb ("main: bump RLIMIT_NOFILE for the root user substantially") [https:/
* Although bumping this value was a good thing, 16M is not enough and we can see failures on mlock'ed allocations on Bionic, like the one hereby reported by Kees or the recent introduced cryptsetup build failures (due to PPA builder updates to Bionic) - see https:/
* It's especially harmful in containers to have such "small" limit, so we are hereby SRUing a more recent bump from upstream systemd, in the form of commit 91cfdd8d29 ("core: bump mlock ulimit to 64Mb") [https:/
* A discussion about this topic (leading to this SRU) is present in ubuntu-devel ML: https:/
[Test Case]
* The straightforward test is to just look "ulimit -l" and "ulimit -Hl" in a current Bionic system, and then install an updated version with the hereby proposed SRU to see such limit bump from 16M to 64M (after a reboot) - a version containing this fix is available at my PPA as of 2020-09-10 [0] (likely to be deleted in next month or so).
* A more interesting test is to run a Focal container in a current Bionic system and try to build the cryptsetup package - it'll fail in some tests. After updating the host (Bionic) systemd to include the mlock bump patch, the build succeeds in the Focal container.
[Regression Potential]
* Since it's a simple bump and it makes Bionic behave like Focal, I don't foresee regressions. One potential issue would be if some users rely on the lower default limit (16M) and this value is bumped by a package update, but that could be circumvented by setting a lower limit in limits.conf. The benefits for such bump are likely much bigger than any "regression" caused for users relying on such default limit.
[0] https:/
Kees Bos (k-bos) wrote : | #1 |
Brian Murray (brian-murray) wrote : | #3 |
This has landed in Eoan in at least version 242 of systemd.
Changed in systemd (Ubuntu Eoan): | |
status: | New → Fix Released |
tags: | added: rls-dd-incoming |
Kain (kain-kain) wrote : | #4 |
OLder systemds, (234-240, I think) have a different erroneous clamp on RLIMIT_MEMLOCK. See #1840435.
Kain (kain-kain) wrote : | #5 |
Hmm, sorry, brainfart. At least 240. Not sure how far back it went.
Changed in systemd (Ubuntu Disco): | |
status: | New → Won't Fix |
Launchpad Janitor (janitor) wrote : | #6 |
Status changed to 'Confirmed' because the bug affects multiple users.
Changed in systemd (Ubuntu Bionic): | |
status: | New → Confirmed |
Changed in systemd (Ubuntu Cosmic): | |
status: | New → Confirmed |
Sebastian (slovdahl) wrote : | #8 |
Unfortunately I have not experience or knowledge of Ubuntu packaging or bug fixing processes, but is there anything I can do to help get this fixed in bionic?
Guilherme G. Piccoli (gpiccoli) wrote : | #9 |
Hi Sebastian, thanks for offering help. And thanks of course Kees for reporting the issue!
Recently we faced a build breakage of cryptsetup package narrowed to this issue: https:/
I intend to bump this limit to 64M to match recent releases; I'm using the upstream systemd commit for this: https:/
Cheers,
Guilherme
Changed in systemd (Ubuntu Cosmic): | |
status: | Confirmed → Won't Fix |
Changed in systemd (Ubuntu): | |
importance: | Undecided → High |
Changed in systemd (Ubuntu Bionic): | |
importance: | Undecided → High |
Changed in systemd (Ubuntu Cosmic): | |
importance: | Undecided → High |
Changed in systemd (Ubuntu): | |
assignee: | nobody → Guilherme G. Piccoli (gpiccoli) |
Changed in systemd (Ubuntu Disco): | |
importance: | Undecided → High |
Changed in systemd (Ubuntu Eoan): | |
importance: | Undecided → High |
Changed in systemd (Ubuntu Bionic): | |
assignee: | nobody → Guilherme G. Piccoli (gpiccoli) |
Changed in systemd (Ubuntu Cosmic): | |
assignee: | nobody → Guilherme G. Piccoli (gpiccoli) |
Changed in systemd (Ubuntu Disco): | |
assignee: | nobody → Guilherme G. Piccoli (gpiccoli) |
Changed in systemd (Ubuntu Eoan): | |
assignee: | nobody → Guilherme G. Piccoli (gpiccoli) |
Changed in systemd (Ubuntu Bionic): | |
status: | Confirmed → In Progress |
description: | updated |
Changed in systemd (Ubuntu Focal): | |
status: | New → Fix Released |
importance: | Undecided → High |
assignee: | nobody → Guilherme G. Piccoli (gpiccoli) |
tags: |
added: seg removed: patch rls-dd-incoming |
Guilherme G. Piccoli (gpiccoli) wrote : | #10 |
tags: | added: sts sts-sponsor-ddstreet |
Hello Kees, or anyone else affected,
Accepted systemd into bionic-proposed. The package will build now and be available at https:/
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-
Further information regarding the verification process can be found at https:/
N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.
Changed in systemd (Ubuntu Bionic): | |
status: | In Progress → Fix Committed |
tags: | added: verification-needed verification-needed-bionic |
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (systemd/237-3ubuntu10.43) | #12 |
All autopkgtests for the newly accepted systemd (237-3ubuntu10.43) for bionic have finished running.
The following regressions have been reported in tests triggered by the package:
linux-hwe-
lxc/3.0.
openssh/
linux-aws-
gvfs/1.
suricata/
nftables/0.8.2-1 (amd64)
libvirt/
netplan.
systemd/
linux-hwe-
docker.
Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUp
https:/
[1] https:/
Thank you!
Guilherme G. Piccoli (gpiccoli) wrote : | #13 |
I was able to verify this bug with systemd from bionic-proposed (version 237-3ubuntu10.43) by following the procedure in the test case; it's working as expected, I can see 64M in the memlock limit.
tags: |
added: verification-done verification-done-bionic removed: verification-needed verification-needed-bionic |
The verification of the Stable Release Update for systemd has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.
Launchpad Janitor (janitor) wrote : | #15 |
This bug was fixed in the package systemd - 237-3ubuntu10.43
---------------
systemd (237-3ubuntu10.43) bionic; urgency=medium
[ Guilherme G. Piccoli ]
* d/p/lp1830746-
- Bump the memlock limit to match Focal and newer releases (LP: #1830746)
https:/
[ Victor Manuel Tapia King ]
* d/p/lp1896614-
- Fix race when starting dbus services (LP: #1896614)
https:/
[ Dan Streetman ]
* d/t/*,
d/p/
d/p/
d/p/
- Increase QEMU_TIMEOUT on 'upstream' autopkgtest tests
- Pull latest tests from newer releases to fix false negatives
- Blacklist flaky 'upstream' TEST-03
(LP: #1892358)
https:/
https:/
https:/
https:/
https:/
https:/
-- Victor Manuel Tapia King <email address hidden> Wed, 07 Oct 2020 16:30:03 -0400
Changed in systemd (Ubuntu Bionic): | |
status: | Fix Committed → Fix Released |
Alkis Georgopoulos (alkisg) wrote : | #16 |
Hi, this update makes slick-greeter segfault, so Ubuntu MATE 18.04 users doing normal updates now get a black screen with a flicking cursor.
A temporary workaround is to enable autologin in /etc/lightdm/
[Seat:*]
autologin-
autologin-
autologin-
*** What would be a proper fix for this? ***
A related discussion about memory limits and lightdm issues exists in this bug report:
https:/
Alkis Georgopoulos (alkisg) wrote : | #17 |
What torel proposed in https:/
* soft memlock 262144
* hard memlock 262144
Should all lightdm users manually put that in limits.conf, or should we expect some update?
Łukasz Zemczak (sil2100) wrote : | #18 |
Hey Alkis! Can you please fill in a new bug report with all the detailed information and tag it wit 'regression-
Alkis Georgopoulos (alkisg) wrote : | #19 |
Thank you Łukasz, I filed it in LP: #1902879.
Sebastien Bacher (seb128) wrote : | #20 |
The libghtdm-
Andy Whitcroft (apw) wrote : | #21 |
I have backed out the published version in bionic-updates to the previously published version in the pocket: 237-3ubuntu10.42.
tags: | added: block-proposed-bionic |
Dan Streetman (ddstreet) wrote : | #22 |
To clarify, the regression appears to be the same problem that the rlimit increase is fixing, but the applications failing now are simply bigger. In general, any application that calls mlockall() with MCL_FUTURE, but doesn't adjust its rlimit (or change its systemd service file to adjust LimitMEMLOCK) is very likely destined to crash later in its life.
I believe the only lp bugs for this regression are bug 1890394 and bug 1902879, which are both fix-committed and verified, so this bug should be ok to release (again) after those are released. Also I will note both of those applications (slick-greeter and lightdm-
There is also bug 1902871 and bug 1903199 but I believe those are both dups of bug 1900394.
Also finally to reflect on cryptsetup's use of mlockall(), since it's the origin for this bug; cryptsetup is maybe "better" about its use of mlockall() since it keeps the mlock only for the duration of an 'action':
if (action-
r = action->handler();
if (action-
however, as this bug shows, that a...
Łukasz Zemczak (sil2100) wrote : | #23 |
Both the slick-greeter and lightdm-gtk-greeter packages have been now released into -updates. I think it should be now safe-ish to proceed with the systemd update once again. Let's think about it in the nearest time.
tags: | removed: block-proposed-bionic |
Dan Streetman (ddstreet) wrote : | #24 |
found another 'special' application that thinks it needs all its memory locked: corosync.
opened bug 1911904
Dan Streetman (ddstreet) wrote : | #25 |
Oh and also openvswitch, bug 1906280
To summarize, here are all the applications (found so far) that thought they needed to lock all their current and future memory:
slick-greeter (bug 1902879)
lightdm-gtk-greeter (bug 1890394)
corosync (bug 1911904)
openvswitch (bug 1906280)
The attachment "fix-memlock- bump.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.
[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]