Why is /tmp getting cleaned out in Ubuntu 15.04?

I want to keep files newer than 7 days in /tmp between boots. Prior to 15.04 I did this by setting TMPTIME=7 in /etc/default/rcS. But with 15.04 and the replacement of upstart by systemd, this doesn't work. As far as I understand, the approach is through the file /usr/lib/tmpfiles.d/tmp.conf and the possibility of overriding it with /etc/tmpfiles.d/tmp.conf. But I have the default /usr/lib/tmpfiles.d/tmp.conf which has the line:

D /tmp 1777 root root -

The final - means, according to the tmpfiles.d man page, that no automatic cleanup is done. But, in fact my /tmp is cleaned out with every reboot and I could not find a way to stop that. Why is /tmp getting cleaned out, and how can I change that?


I fixed this by creating the file /etc/tmpfiles.d/tmp.conf containing:

# Override cleaning of /tmp in vendor /usr/lib/tmpfiles.d/tmp.conf,
# as documented in tmpfiles.d(5), for Kubuntu 15.04 and above that
# use systemd.  First char is 'd', instead of 'D', to avoid cleaning.

d /tmp 1777 root root -