mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-05 16:47:08 +01:00
user@1000 failed three times on 2026-11-08 with "Main process exited, code=killed, status=9/KILL": the kernel killed systemd --user itself, which OOMPolicy=continue (#1606) cannot survive. Upstream user@.service ships OOMScoreAdjust=100, which makes the ~10 MB manager outrank most real memory hogs. The drop-in now sets OOMScoreAdjust=0 so the manager is ranked by its real size and the OOM killer goes after the process using the memory. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
2.0 KiB
Plaintext
38 lines
2.0 KiB
Plaintext
# Drop-in for the long-lived user managers on bitbaum: user@<uid>.service for
|
|
# the openclaw and ubuntu users. Installed by every deploy
|
|
# (scripts/deploy-hetzner.sh) as
|
|
# /etc/systemd/system/user@<uid>.service.d/10-oom-continue.conf — edit it here.
|
|
#
|
|
# systemd's default OOMPolicy=stop stops the WHOLE unit when the kernel
|
|
# OOM-kills any process in its cgroup, and the manager takes every user unit
|
|
# inside it down with it.
|
|
#
|
|
# 2026-11-05 07:10 UTC (openclaw, uid 1001): the box ran out of RAM, the kernel
|
|
# killed openclaw-gateway (and then the user's dbus), and user@1001.service
|
|
# stopped as "failed". The gateway (WhatsApp, the Telegram chat) runs under that
|
|
# manager, and the manager is the only thing that restarts it, so it stayed
|
|
# down for more than a day.
|
|
#
|
|
# 2026-11-08 (ubuntu, uid 1000): same pattern on the operator account's manager
|
|
# — "The kernel OOM killer killed some processes in this unit", then
|
|
# user@1000.service "Failed with result 'signal'" and paged as a failed unit.
|
|
#
|
|
# With continue, the victim dies and the manager keeps running (and restarts it
|
|
# where the unit has Restart=).
|
|
# Same lesson as loki-box-runner (2026-09-25, scripts/hetzner/install-box-runner.sh).
|
|
#
|
|
# OOMScoreAdjust=0: continue does not help when the kernel picks the manager
|
|
# process ITSELF. On 2026-11-08 user@1000 failed three times that way: an
|
|
# ubuntu login started the manager, and within moments "Main process exited,
|
|
# code=killed, status=9/KILL" / "Failed with result 'signal'". There is nothing
|
|
# else in that cgroup (the login shell lives in its session scope), so the
|
|
# kernel's victim was a ~10 MB systemd --user. It wins because upstream
|
|
# user@.service ships OOMScoreAdjust=100, which adds a tenth of all RAM to its
|
|
# badness score, more than most real memory hogs score. Killing it frees almost
|
|
# nothing, and the process that filled RAM survives. At 0 the manager ranks by
|
|
# its real size, like every system service, so the OOM killer goes after the
|
|
# process actually using the memory.
|
|
[Service]
|
|
OOMPolicy=continue
|
|
OOMScoreAdjust=0
|