Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vagrant temp files being saved to code directory instead of ~/.vagrant.d/tmp #3493

Closed
gauravspatel opened this issue Apr 17, 2014 · 5 comments

Comments

@gauravspatel
Copy link

I'm using Vagrant 1.5.3 on CentOS 6.5. When I run vagrant up, vagrant provision, etc, temp files end up saved in my code's directory.

Below is a small snippet of the ls of my code's directory.

vagrant20140329-1996-1bzouma         vagrant20140329-5163-c4lpx0
vagrant20140329-1996-1bzouma2        vagrant20140329-5163-c4lpx02
vagrant20140329-1996-1bzouma2.lock   vagrant20140329-5163-c4lpx02.lock
vagrant20140329-1996-fz5f8y          vagrant20140329-5488-1kjj4hq
vagrant20140329-1996-fz5f8y1         vagrant20140329-5488-1kjj4hq2
vagrant20140329-21161-1o2ucmy        vagrant20140329-5488-1kjj4hq2.lock

Setting VAGRANT_HOME or TMPDIR does not help the location of the cache files. I was expecting (based on the documentation) that the files be saved to ~/.vagrant.d/tmp or /tmp. I uninstalled Vagrant, deleted ~/.vagrant.d/ and reinstalled to make sure their were no weird permissions issues on my VAGRANT_HOME.

I've set VAGRANT_LOG to debug and checked for any of the filenames or portions of the filename but they are never recorded in the debug output.

Any ideas on which setting I could set or what is going on? Having vagrant* files litter my code directory seems like odd behavior.

@mitchellh
Copy link
Contributor

I've heard of this happening before, and there have been a couple other issues, but I've never actually been able to figure this out. I just committed some stuff to better clean up temporary files.

In the mean time, here is how Ruby figures out the temporary dir: https://github.com/ruby/ruby/blob/2254fc650b681c2582f25aa0d2be2cc8aba3cb8e/lib/tmpdir.rb#L25

@gauravspatel
Copy link
Author

A quick ruby program confirmed that my tmpdir is set to pwd.

require 'tmpdir'

print Dir.tmpdir()

I think the problem has to do with /tmp being world writable thus failing tmpdir()'s check. I changed TMPDIR, TMP and TEMP to ~/tmp under my home directory and everything loads to ~/tmp instead of pwd.

Thanks for the insight.

@stumbata
Copy link

So "/tmp" directory is by default with "sticky" flag, I run chmod 777 and break that and having the same problem. To make your "/tmp" sticky you need to run:
chmod 1777 /tmp
or
chmod +t /tmp

@valter-silva-au
Copy link

@stumbata suggestion has worked for me! Just run chmod +t /tmp and you should be good to go!

@ghost
Copy link

ghost commented Apr 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants