1

I was considering making /var/tmp a tmpfs mount, similar to systemctl enable tmp.mount in order to meet a security rule requesting /var/tmp be on a separate partition. I did not make that physical partition at linux install time.

The FHS (File hierarchy standard) states The /var/tmp directory is made available for programs that require temporary files or directories that are preserved between system reboots. Therefore, data stored in /var/tmp is more persistent than data in /tmp.

Specifically, for RHEL 8.8 or later, can having /var/tmp as a tmpfs (where it will be cleared after every reboot), cause a yum update to fail? Is YUM [DNF] in RHEL 8 once of those programs? If so, under what conditions would some sort of failure occur with /var/tmp as tmpfs? And if so, is there a manner in which to run yum/dnf that can allow it to work with a tmpfs /var/tmp? I ask because I see various /var/tmp/yum-xxxx folders from time to time.

reference posts:

/tmp and /var/tmp as tmpfs and volatility

What can go wrong if /var/tmp is on a temporary filesystem?

ron
  • 6,575
  • In any case, do not do it. It is not the purpose of /var/tmp. If you think a program can work with just /tmp, file a bug, so they use /tmp instead of /var/tmp. Personally I do not think it is a problem. Persistent data should go in /var/{lib, ...}, and rest in /var/cache but we never know (and you are removing a good helper to debug problems) – Giacomo Catenazzi Oct 02 '23 at 15:19

1 Answers1

0

DNF won't care, it shouldn't even use this directory. I'm a little bit surprised about

I ask because I see various /var/tmp/yum-xxxx folders from time to time.

because RHEL 8 used DNF internally. Yum exists only as a symlink to DNF.

AFAIK in RHEL 8.x /var/tmp is already tmpfs or maybe it was introduced in version 9. Anyways, it'll work.

  • /var/tmp is definitely NOT tmpfs in RHEL 8.8. – ron Oct 02 '23 at 18:36
  • RHEL9 that is, then. It should work regardless like I said. /var/tmp was designated to survive reboots but in practice it's OK to wipe it clean on each reboot/power cycle. The important volatile data must be stored elsewhere regardless. /tmp|/var/tmp|/dev/shm are the three directories that contain truly transient data. – Artem S. Tashkinov Oct 02 '23 at 18:38
  • if RHEL 9 actually does /var/tmp as a tmpfs how can you claim that it will be ok in RHEL 8? I said I see /var/tmp/yum-xxx folders there in RHEL 8.8 (as I have in RHEL 7.9) and you're telling me it shouldn't even use this directory? And, you say /var/tmp was designed to survive reboots which I can believe and won't disagree with but that's the point of my question if I tmpfs /var/tmp will I be creating a problem for "DNF" in RHEL 8? – ron Oct 02 '23 at 18:59
  • Your question is not upgrading from RHEL8 to 9 so I'm 100% sure you'll have no issues with /var/tmp as a tmpfs. – Artem S. Tashkinov Oct 02 '23 at 19:29