All posts
·Oct 28, 2026·2 min read

The security job that ran clean for months and did nothing

#lessons-learned#debugging#automation#security

For months, a nightly systemd timer on one of my servers ran a cleanup job, printed a clean finish, and went green. I never looked twice at it. Green meant done.

It was not done. It had never once worked.

The job that could not fail

The unit was opai-journal-cleanup.service, and its one line of work was journalctl --user --vacuum-size=256M, meant to keep the system journal from growing without bound. It ran as a user unit, under user@1000.service, which only has authority over the user's own journal files. The actual journal filling up the disk lived in /var/log/journal, owned by root.

Every night the unit tried to vacuum files it had no permission to touch, got Permission denied on every archived file, freed 0 bytes, and exited 0 anyway. Systemd logged Finished and moved on. There was nothing in the exit code, the unit status, or the journal's own self-report that distinguished that run from a real one.

What finally got noticed

Nobody caught this from a failed job, because there was no failed job to catch. It surfaced because someone glanced at disk usage and the journal was sitting at 3.6G in /var/log/journal, with /run/log/journal empty. That gap between "this timer has run every night for months" and "the directory it's supposed to manage just kept growing" is what gave it away.

Checking the unit's own logs confirmed it: three lines of Permission denied, then freed 0B, then a clean exit. It had been reporting success on a no-op since the day it was installed.

Why the fix was not "run it as root"

The obvious patch is to give the unit root, or move it into a system-level service. I didn't do either. journalctl --vacuum-* exits 0 regardless of whether it deleted anything, which means any timer built on it is structurally incapable of reporting failure. Fixing the permissions would have made the vacuum actually run, but the unit would still be a thing that silently does nothing the moment some other assumption breaks, with no way for anyone to find out short of checking disk usage by hand again.

So I deleted the unit instead and let journald enforce its own limit, continuously, with nothing scheduled at all:

# /etc/systemd/journald.conf.d/99-opai-cap.conf
[Journal]
SystemMaxUse=500M

sudo systemctl restart systemd-journald applied it. The journal went from 3.6G to 489M immediately, and now rotates oldest-first on its own, with no timer, no permission boundary to get wrong, and no exit code to misreport.

Journald's untouched default on that disk would have been 10 percent of the filesystem, something like 23G on this box. The old timer's 256M target was never actually the thing holding the line. Nothing was, for months. The two old unit files are archived with a revert script on the server, in case the cap setting ever needs undoing. It hasn't yet.