Querying the operational status of your Ubuntu server or workstation using systemctl --failed only to see a failed unit status for systemd-tmpfiles-clean.service (Failed to start Clean Up Network Temporary Directories / Cleanup of Temporary Directories) alerts you to system maintenance issues. In Linux, systemd-tmpfiles-clean executes automatically via systemd-tmpfiles-clean.timer to prune obsolete files and stale Unix domain sockets from volatile directories such as /tmp and /var/tmp. When custom software packages install corrupted configuration syntax inside /etc/tmpfiles.d/, root filesystems mount in read-only mode, or permissions on the sticky bit of /tmp become misconfigured, the cleanup engine terminates with an exit failure code. Correcting directory permissions, auditing tmpfiles rules, and resetting failed units restores automated maintenance.
Inspect Failure Logs via Journalctl and Dry-Run Execution
The systemd journal logs record the precise filename and configuration line number that triggered the tmpfiles parser abort.
- Open your terminal and query recent journal entries for the failed unit:
journalctl -u systemd-tmpfiles-clean.service -e --no-pager - Look for log entries indicating Failed to parse line or Operation not permitted.
- Execute a dry-run test of the tmpfiles cleanup utility to view detailed diagnostic output in your terminal:
sudo systemd-tmpfiles --clean --dry-run - Observe which specific configuration rule in
/usr/lib/tmpfiles.d/,/run/tmpfiles.d/, or/etc/tmpfiles.d/causes the engine to throw an error.
Audit and Repair Custom Configuration Files in /etc/tmpfiles.d/
Third-party container software, database tools, or custom build scripts often drop non-standard tmpfiles configuration snippets that violate modern systemd syntax.
- Inspect custom tmpfiles rules:
ls -la /etc/tmpfiles.d/ - If an obsolete or malformed file exists (such as a legacy package cleanup rule with missing column parameters), open it in a text editor:
sudo nano /etc/tmpfiles.d/problematic-file.conf - Standard systemd tmpfiles syntax requires specific column orders:
Type Path Mode UID GID Age Argument(e.g.d /tmp 1777 root root 10d -). - Correct any malformed lines or temporarily move the file out of the directory to verify stability:
sudo mv /etc/tmpfiles.d/problematic-file.conf /root/
Restore Correct Permissions and Sticky Bit on /tmp and /var/tmp
If application installers or manual chmod commands stripped the sticky bit from temporary folders, standard unprivileged cleanup cannot safely unlink sockets.
- Verify permissions on
/tmpand/var/tmp:ls -ld /tmp /var/tmp - The permissions must display as
drwxrwxrwt(octal 1777 with the trailing sticky bit ‘t’). - If permissions are incorrect, restore them immediately:
sudo chmod 1777 /tmp /var/tmp sudo chown root:root /tmp /var/tmp - Reset the failed systemd unit counter:
sudo systemctl reset-failed systemd-tmpfiles-clean.service - Trigger a clean run manually to verify error-free execution:
sudo systemctl start systemd-tmpfiles-clean.service systemctl status systemd-tmpfiles-clean.service