NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

/var/tmp cleared on reboot?

Solved!
Go to solution

Hi all,

 

I have a third-party driver that depends on files placed in /var/tmp (not /tmp == /var/volatile/tmp). These files appear to be deleted on reboot.

according to stack overflow (https://superuser.com/questions/168125/how-long-are-files-kept-in-var-tmp-and-how-to-use-the-directo...) and the linked standard (https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard), var/tmp should not be cleared between reboots. I added my own small text file and can confirm its deleted between boots.

 

Is there a script/feature/something I can turn off to make /var/tmp persist?

 

Thanks

0 Kudos
Message 1 of 3
(4,317 Views)
Solution
Accepted by topic author smithed180

Hi smithed180,

 

You are correct that /var/tmp is cleared after a reboot on our systems. While the FHS does state that /var/tmp should not be cleared on a reboot, not every Linux distribution follows that recommendation 100% and the Wiki page notes such. In our case, we base our distribution on a fork of the Yocto OpenEmbedded distribution. That upstream distribution links /var/tmp to the /var/volatile/tmp directory (as you can see if you call ls -l on /var/tmp). 

 

If you want to change the behavior, I'd recommend familiarizing yourself with the /etc/init.d/populate-volatile.sh script. That script populates the volatile storage for the system at boot using the /etc/volatile.cache file or the config files located at /etc/default/volatiles/. Modifying the configurations should allow you to set the /var/tmp directory to persist between reboots instead of being mapped to /var/volatile/tmp once you clear the cache and reboot. Note that you'll want to update /tmp as well since it currently links to /var/tmp (instead of /var/volatile/tmp) by default.

Charlie J.
National Instruments
0 Kudos
Message 2 of 3
(4,258 Views)

Thanks Charlie, I just noticed the symlink when I deployed a new driver version -- the vendor got back to me a few minutes ago and they just went ahead and changed their driver's init procedure to re-create the temp files on boot.

 

I'm not sure if we'll leave it as-is, but thank you for letting me know the location for where all of that stuff gets set up. If we run into any more issues with it I'll dig into trying to change the behavior.

 

0 Kudos
Message 3 of 3
(4,253 Views)