Linux error creating temporary file /var/tmp/

apache-2.4centos6linuxvarnish

I'm using centos 6 – recently I am getting this error anything I want to install anything on server for example with varnish – var/tmp is empty and has root:root as owner i have checked with 777 permission on var/tmp directory but still same error –

Also checked if it was related to systemd using below command — but results showing other

pidof systemd && echo "systemd" || echo "other"

error is below

Total download size: 2.2 M
Installed size: 8.1 M
Is this ok [y/N]: y
Downloading Packages:
varnish-5.2.1-1.el6.x86_64.rpm                                               
| 2.2 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
error: error creating temporary file /var/tmp/rpm-tmp.cNUXgY: No such file or directory
error: Couldn't create temporary file for %pre(varnish-5.2.1-1.el6.x86_64): No such file or directory
Error in PREIN scriptlet in rpm package varnish-5.2.1-1.el6.x86_64
error:   install: %pre scriptlet failed (2), skipping varnish-5.2.1-1.el6
  Verifying  : varnish-5.2.1-1.el6.x86_64                                                       
1/1

Failed:
  varnish.x86_64 0:5.2.1-1.el6

Best Answer

The correct permissions for /var/tmp would be "1777". Only "777" does not set the sticky bit which could be part of the issue.

Could you check if "mktemp -d --tmpdir=/var/tmp rpm-tmp.XXXXXX" is working? This is to test if creating a temp directory is working at all. Secondly you could try to disable SELinux temporarily. Maybe RPM is changing some context internally and therefore is not allowed to created directories.

If that doesn't help we would need more information:

  • how do you install the package?
  • does it work for other packages?
  • system setup
  • recent changes, did it work before those changes?
Related Topic