Can't write to /tmp in systemd service with PrivateTmp=true

Solution 1:

I found the problem.

I had tmpreaper enabled and configured to clean up old files and directories under /tmp. I didn't have an exclude rule for /tmp/systemd-private-*, so tmpreaper was deleting the private tmp directory for apache2.