Hyder B.
Hyder B.

Reputation: 12206

Issue with setting up Vagrant

I have just set up a new Linux box and trying to install vagrant on it. The issue is that when I am running vagrant up command, I am getting the following error:

Vagrant failed to initialize at a very early stage:

The directory Vagrant will use to store local environment-specific state is not accessible. The directory specified as the local data directory must be both readable and writable for the user that is running Vagrant.

Any idea how to fix this?

Upvotes: 9

Views: 15397

Answers (4)

HelloWorld
HelloWorld

Reputation: 11

I encountered the same issue four years later and could not fix it using chmod or even @Ziya's comment under the initial question (which brought me closer to the resolution though).

In my case, I use Vagrant 2.2.6 on Windows 10, and use Cygwin as a command line interface.

For the error to disappear, I had to :

  1. open Windows Explorer
  2. right-click .vagrant folder in the location where I typed vagrant up
  3. access the "Properties" menu
  4. then, in the "Security" tab, update the authorizations for my user, granting total control

Properties window screenshot

Hope this can help someone else.

Upvotes: 1

Wentai Chen
Wentai Chen

Reputation: 187

I met the same problem and I solved it by run the terminal with"run as administrator". It's quite easy. Hope this can help you.

Upvotes: 2

Safwan Umer
Safwan Umer

Reputation: 11

Please follow these steps:

1) install vagrant 1.7.1
2) install virtual box 4.1, 4.2, or 4.3
3) use the administrator name in the custom directory (e.g., for windows users c:\users\AdminName\myvagrant or for Mac/Linux users /home/Admin/myvagrant)

For instance: c:\users\safwan\myvagrant where safwan is the user with administrator rights/privileges.

Copy the file name Vagrantfile in the myvagrant forlder.

4) Now open DOS window as shown in the picture and follow the steps in the DOS window changing the admin name

enter image description here

Upvotes: -1

Manoj Awasthi
Manoj Awasthi

Reputation: 3520

I think a better way is to provide your user the required permission to the directory by making the user the owner - where you want the vagrant to be booted:

$ sudo chown -R <user> <directory>

and then you will be easily able to do:

$ vagrant up

Using sudo for vagrant up is unusual as why do you want to run your virtual machine as a root user.

Upvotes: 12

Related Questions