DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk4 min

systemd-tmpfiles Isn’t Cleaning Up: Common Causes and Fixes

When systemd-tmpfiles leaves old files behind, verify the cleanup command, matching age rule and timestamps, then check exclusions, locks, permissions, and boot units.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If systemd-tmpfiles is not removing old files, first confirm that cleanup—not creation or removal—was actually run. Then check whether a matching rule has an age, whether the relevant timestamps exceed that age, and whether an exclusion, file lock, permission issue, or boot-time option is preventing cleanup. The systemd manuals describe the general behavior, but installed rules and unit overrides can change what happens on a particular distribution.

1. Confirm that the cleanup operation ran

Run systemd-tmpfiles --clean in the context that owns the files. --clean evaluates configured age rules. --create and --remove are separate operations, so a successful create run does not show that stale files were checked. System and user configuration are separate scopes; system cleanup does not read user configuration. See the systemd-tmpfiles manual.

As an Amazon Associate I earn from qualifying purchases.

For more detail while diagnosing, run the command with increased log verbosity and check its output, exit status, and system logs. The manual distinguishes invalid-configuration errors from operational failures. If you changed system rules, restart systemd-tmpfiles-clean.service to apply settings that can safely run at runtime.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Verify that a matching rule is eligible for age cleanup

Inspect the actual tmpfiles.d configuration that applies to the path, including administrator overrides. An age field only enables age-based cleanup on rules whose type supports it: d, D, e, v, q, Q, C, x, or X. A missing age or an age of - means that line has no age-based cleanup. A rule that only creates a directory will not make it eligible unless its type and age specify that behavior. The tmpfiles.d manual documents the rule types and fields.

Look for exclusions

Rules of type x and X exclude matching paths from aging cleanup. Check whether an exclusion matches the file or a parent path before changing it; these rules may be deliberately protecting data.

3. Check the configured age against the timestamps

The age is a threshold, not a promise that a file will be deleted after a fixed number of calendar days regardless of activity. An entry must be older than the current time minus the configured age, using the timestamps selected by the rule. By default, the aging algorithm considers access, modification, and status-change timestamps for files; it ignores status-change time for directories. The age-by option can change which timestamps are considered. Review the tmpfiles.d manual and compare the relevant timestamps with the rule’s age.

The systemd project documents defaults of 10 days for files in /tmp/ and 30 days for files in /var/tmp (file hierarchy documentation). These are documented defaults, not guarantees for every distribution or host: local rules and overrides may differ.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Check locks, permissions, and execution context

BSD locks can protect files and directories

During aging cleanup, entries with a shared or exclusive BSD file lock are skipped. If a directory is locked, entries beneath it are skipped too. An application may use this behavior to preserve temporary work while it is active. Identify the process and purpose of a lock before changing the application or removing the protection.

Use the appropriate privileges

The systemd-tmpfiles manual warns that cleanup run as a non-root user can update access times on directories being checked. That can make those directories appear too recent for cleanup. When testing system paths, use the system service or appropriate privileges, and inspect logs and the command’s exit status for permission or execution errors.

5. If manual cleanup works, inspect the timer and service

When a manual --clean run works but automatic cleanup does not, inspect systemd-tmpfiles-clean.timer and systemd-tmpfiles-clean.service on the affected host, as well as their journal entries. Unit overrides and behavior vary by distribution and systemd version, so verify the installed unit contents rather than assuming the upstream defaults. The systemd-tmpfiles manual describes the cleanup service.

Boot-only rules need --boot

A tmpfiles.d line marked with ! is considered only when systemd-tmpfiles is invoked with --boot. Verify that the local boot-time unit actually runs the needed combination of --clean and --boot.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A July 4, 2022 report from an Arch Linux user running systemd 251 said the listed boot units did not invoke systemd-tmpfiles --clean --boot, while running that command manually did perform cleanup (upstream issue #23848). That report describes one version and system, not current behavior across distributions.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

6. Apply the narrowest safe fix

  • If cleanup never ran, correct the command, service, or schedule so the age-clean operation runs in the intended system or user context.
  • If no applicable rule can age-clean the path, correct the rule type, path, or age only after checking which timestamps govern eligibility.
  • If an x or X exclusion is unintended, change it only after confirming the path is safe to clean.
  • If a process holds a lock, establish whether it is protecting live temporary work before altering its behavior.
  • If cleanup is meant to happen only at boot, confirm the installed unit passes both required options for the local systemd version before changing a unit.

Do not use /tmp or /var/tmp for durable storage. The systemd project notes that /tmp is typically backed by tmpfs and flushed on reboot; /var/tmp is intended for temporary data that should persist across a reboot (file hierarchy documentation).

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.