Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission Denied error for Vagrant

I made the mistake of once running "sudo vagrant up" and now whenever I run "vagrant up" it gives me the following error

==> default: Running cleanup tasks for 'chef_solo' provisioner...
/opt/vagrant/embedded/gems/gems/vagrant-1.7.1/lib/vagrant/environment.rb:492:in `initialize':   P Permission denied - /Users/mkv/.vagrant.d/data/lock.fpcollision.lock (Errno::EACCES)

I've tried deleting the .vagrant folder and also the Cheffile but I always get the same error.

What can I do to sort this out?

like image 911
Michael Victor Avatar asked Dec 27 '14 18:12

Michael Victor


2 Answers

The issue is related with permission which you accidentally run the application with root.

Follow the steps:

  1. Delete /Users/mkv/.vagrant.d/data/lock.fpcollision.lock and run vagrant up again.

  2. Find any files are owned by root under /Users/mkv, include hide files. if found, change it back to your own user account.

You can run below command to find out files owned by root

  find /Users/mkv -type f -user root -print
like image 73
BMW Avatar answered Oct 05 '22 10:10

BMW


For those who wonder how to change a user to your current one, using find command:

sudo find ~/.vagrant.d/data/lock.fpcollision.lock -type f -user root -exec chown $USER {} \;
like image 28
Alex Pogiba Avatar answered Oct 05 '22 09:10

Alex Pogiba