Vagrant and local tmp folder write permissions


Recently I started using vagrant. That was the best decision I made recently and I can’t imagine to work on some project without it. For all my projects I created vagrant configuration. From the beginning something was strange to me – Vagrant created many temp files and folders inside directory where Vagrantfile was located. I asked all my fellows who have had experience with Vagrant and no one faced the same problem – no additional files – only Vagrantfile. I tried to ignore this problem since I coulnd’t find a solution – even I asked Google 😀 . Then I bumped on problem – on some project I even couldn’t execute command VAGRANT UP. I found what was wrong with my OS (Ubuntu 12.04) because I got clear message from vagrant.

When I tried to execute VAGRANT UP I got this response in terminal window

    /usr/bin/vagrant up
    /opt/vagrant/embedded/lib/ruby/2.0.0/tmpdir.rb:34:in `tmpdir': could not find a temporary directory (ArgumentError)
       from /opt/vagrant/embedded/lib/ruby/2.0.0/tmpdir.rb:105:in `tmpdir'
       from /opt/vagrant/embedded/lib/ruby/2.0.0/tmpdir.rb:137:in `create'
       from /opt/vagrant/embedded/lib/ruby/2.0.0/tmpdir.rb:85:in `mktmpdir'
       from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/bundler.rb:57:in `init!'
       from /opt/vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/lib/vagrant/pre-rubygems.rb:23:in `<main>'

As you can see Vagrant was unable to find my temporary directory. I’ve checked my OS – I had that folder. I tried to find solution and I found similarities between my problem and one described here. When I set permission on my temp folder like this

sudo chmod 1777 /tmp

my problem was solved. Vagrant now creates temp files and folders in this directory not inside the project.

Leave a Reply

Your email address will not be published. Required fields are marked *