Systemd 256.1 Fixes "systemd-tmpfiles" Unexpectedly Deleting Your /home Directory

Written by Michael Larabel in systemd on 19 June 2024 at 06:03 AM EDT. 141 Comments
SYSTEMD
For those running the command "systemd-tmpfiles --purge" and think that this command just deletes your temporary files, think again and watch out. In reality it will delete all files and directories created by a tmpfiles.d entry... Including the /home that is created by systemd-tmpfiles' home.conf. With users being bitten in recent days by this behavior when they were just expecting tmp files to be removed, systemd 256.1 is now available and does have a change to avoid inadvertently deleting your all-important home directory.

Over on Mastodon and a systemd bug report, users were surprised that running "systemd-tmpfiles --purge" will delete all files/folders created by a tmpfiles.d configuration file even with the default behavior of /home being created by one. Thus those trying to do system maintenance without reading the man page could find their /home data deleted.

Broken SSD


Initially the bug report was shot down by systemd developer Luca Boccassi of Microsoft with:
So an option that is literally documented as saying "all files and directories created by a tmpfiles.d/ entry will be deleted", that you knew nothing about, sounded like a "good idea"? Did you even go and look what tmpfiles.d entries you had beforehand?

Maybe don't just run random commands that you know nothing about, while ignoring what the documentation tells you? Just a thought eh

Ultimately though after much discussion the past few days, systemd-tmpfiles behavior is now improved upon. Merged yesterday was this patch that now makes systemd-tmpfiles accept a configuration file when running purge. That way the user must knowingly supply the configuration file(s) to which files they would ultimately like removed. The documentation has also been improved upon to make the behavior more clear.

That patch made it into yesterday's systemd 256.1 point release.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week