# Systemd tmpfiles configuration

**URL:** <https://discourse.openondemand.org/t/systemd-tmpfiles-configuration/2679>\
**Category:** Feature Requests and Roadmap Discussion\
**Created:** [May 4, 2023, 8:09am UTC](https://discourse.openondemand.org/t/systemd-tmpfiles-configuration/2679 "2023-05-04T08:09:35Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![stdweird](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/stdweird/32/627_2.png) [@stdweird](https://discourse.openondemand.org/u/stdweird)\
**Post date:** [May 4, 2023, 8:09am UTC](https://discourse.openondemand.org/t/systemd-tmpfiles-configuration/2679/1 "2023-05-04T08:09:36Z")

</div>

hi all,

(running 2.0 on el8)

we are facing now and then issues with user sessions that always lead back to subdirectories under /var/tmp/ondemand-nginx/xyz being removed (client\_body disappearing is a “popular” one).

i only now realised this is most likely systemd-tmpfiles cleaning up things, and i was wondering what the recommendations are for this, in particular, tmpfiles completely ignore /var/tmp/ondemand-nginx

(it would be good if ood itself managed this by either settign this systemwide eg in /usr/lib/tmpfiles.d/ood.conf, or adding a per user exclude in eg /run/tmpfiles.d/ood-userxyz.conf each time the pun is started)

stijn

---

<div class="post-metadata">

**Author:** ![tdockendorf](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/tdockendorf/32/202_2.png) [@tdockendorf](https://discourse.openondemand.org/u/tdockendorf)\
**Post date:** [May 4, 2023, 2:07pm UTC](https://discourse.openondemand.org/t/systemd-tmpfiles-configuration/2679/2 "2023-05-04T14:07:46Z")

</div>

Could you test a change for us to see if we can override the defaults for “/var/tmp”? Something like this:

```auto
cat > /etc/tmpfiles.d/ondemand-nginx-tmp.conf <<EOF
d /var/tmp/ondemand-nginx 0755 root root - -
Z /var/tmp/ondemand-nginx - - - - -
EOF

```

If that kind of change resolves the issue then we can incorporate it into the OnDemand distributed tmpfiles.d files that would come with the RPM or Deb packages.

---

<div class="post-metadata">

**Author:** ![stdweird](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/stdweird/32/627_2.png) [@stdweird](https://discourse.openondemand.org/u/stdweird)\
**Post date:** [May 4, 2023, 3:48pm UTC](https://discourse.openondemand.org/t/systemd-tmpfiles-configuration/2679/3 "2023-05-04T15:48:20Z")

</div>

why the `Z` ? i’m testing with `x` now

---

<div class="post-metadata">

**Author:** ![tdockendorf](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/tdockendorf/32/202_2.png) [@tdockendorf](https://discourse.openondemand.org/u/tdockendorf)\
**Post date:** [May 4, 2023, 4:16pm UTC](https://discourse.openondemand.org/t/systemd-tmpfiles-configuration/2679/4 "2023-05-04T16:16:39Z")

</div>

The Z line ensures SELinux contexts are applied upon creation. If you don’t use SELinux you don’t need it but when we ship the change in RPMs we have to include that line as it’s required for sites using SELinux and harmless to sites not using SELinux.

---

<div class="post-metadata">

**Author:** ![stdweird](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/stdweird/32/627_2.png) [@stdweird](https://discourse.openondemand.org/u/stdweird)\
**Post date:** [May 4, 2023, 4:24pm UTC](https://discourse.openondemand.org/t/systemd-tmpfiles-configuration/2679/5 "2023-05-04T16:24:49Z")

</div>

but then i don’t understand what the purpose is of your proposed config. it’s won’t prevent the removal of some of the user dirs

---

<div class="post-metadata">

**Author:** ![tdockendorf](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/tdockendorf/32/202_2.png) [@tdockendorf](https://discourse.openondemand.org/u/tdockendorf)\
**Post date:** [May 4, 2023, 4:27pm UTC](https://discourse.openondemand.org/t/systemd-tmpfiles-configuration/2679/6 "2023-05-04T16:27:40Z")

</div>

The goal is to define a path under `/var/tmp` that do not set the age value in hopes that will override the expiration set for `/var/tmp`.

---

<div class="post-metadata">

**Author:** ![stdweird](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/stdweird/32/627_2.png) [@stdweird](https://discourse.openondemand.org/u/stdweird)\
**Post date:** [May 4, 2023, 5:13pm UTC](https://discourse.openondemand.org/t/systemd-tmpfiles-configuration/2679/7 "2023-05-04T17:13:57Z")

</div>

ok, i understand

from the man page  
“The age field only applies to lines starting with d, D, e, v, q, Q, C, x and X. If omitted or set to “-”, no automatic clean-up is done.”

so no trailing ‘-’ needed (also not for Z)

i’ll test this instead of the `x`, it’s a much better way than using ‘x’. i am assuming the /var/tmp/ondemand-nginx is configurable, but it doesn’t hurt to set this even unused (and admins using other location should take care/know better 😉

---

<div class="post-metadata">

**Author:** ![stdweird](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/stdweird/32/627_2.png) [@stdweird](https://discourse.openondemand.org/u/stdweird)\
**Post date:** [May 4, 2023, 5:54pm UTC](https://discourse.openondemand.org/t/systemd-tmpfiles-configuration/2679/8 "2023-05-04T17:54:11Z")

</div>

/var/tmp has 30d in our (default?) el8 setup.  
i’ll try to construct something quicker to test your proposal

---

<div class="post-metadata">

**Author:** ![stdweird](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/stdweird/32/627_2.png) [@stdweird](https://discourse.openondemand.org/u/stdweird)\
**Post date:** [September 14, 2023, 12:07pm UTC](https://discourse.openondemand.org/t/systemd-tmpfiles-configuration/2679/9 "2023-09-14T12:07:45Z")

</div>

@tdockendorf apologies for not following through, but this works and imho should be the default
