Issue with setting up Vagrant - 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?

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.

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.

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 :
open Windows Explorer
right-click .vagrant folder in the location where I typed vagrant up
access the "Properties" menu
then, in the "Security" tab, update the authorizations for my user, granting total control
Properties window screenshot
Hope this can help someone else.

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

Related

Vagrant command doesn't work without Sudo

I have installed homestead with Vagrant in my MacOS. I have installed all with Virtual Box, but when i try to use vagrant command in my terminal for running Virtual Machine appear this error:
The VirtualBox VM was created with a user that doesn't match the
current user running Vagrant. VirtualBox requires that the same user
be used to manage the VM that was created. Please re-run Vagrant with
that user. This is not a Vagrant issue.
I try with sudo vagrant up and it work but is not the best choice.
Anyone can help me?
There's a screenshot of the terminal Error:
Terminal Error with command vagrant up and vagrant ssh.
Try deleting .vagrant directory
rm -r .vagrant
I suspect you copied or moved project folder from one place to another.
Alternatively you need to update the creator_uid file in .vagrant/. Check out this blog post.

Vagrant up fails due to lookup file id_rsa.pub

I have this problem on my machine, vagrant up --provision (suddenly only works with sudo prefix) hangs on the lookup for the file id_rsa.pub.
The file is created, in place, still gives me this error:
I checked this site explaining the error, no match for me
also this stackoverflow question is not relevant
So, why i'am getting this error, even the file is created, in place & exists.
The above error is rooted in the Ansible provisioning, not vagrant specifically. You mentioned that you are running vagrant provision as root, which means the relative path ~/.ssh/id_rsa.pub would be /var/root/.ssh/id_rsa.pub. I would revisit why you are using sudo to run vagrant provision as this is incorrect.
I was due to user access rights mismatch from so many different installs over the years that i had to re-install mac os-x, after that all worked like it should be.
Vagrant was not asking for sudo, no fails during setup Virtualbox.
Everything worked like a charm.

Vagrant access is denied

I'm using Windows 8.1. I get "access is denied" when i execute
vagrant
using windows command prompt, but it works well using Git Bash (msysgit)
I reinstall vagrant, but still access denied.
Any suggestions?
I was also facing the same issue.
How I solved the problem is by assigning/setting VAGRANT_HOME
It was not present by default because as i had installed vagrant in other directory, in my case it was D.
Just run this command on powershell/cmd and make sure you have administrator rights
setx VAGRANT_HOME "D:\your\path\vagrant.exe"
After executing the command sign out and sign in
Link for reference
There is a chance that things might not properly and you may get ERRNO:EXISTS kind of error. To solve this error make sure the user on which you have installed virtualbox is the one who using vagrant commands are SAME.
Link for reference
use vagrant --debug to print stacktrace log.
You dont have permission to run powershell because vagrant use powershell to execute commands.
you can also check powershell status with vagrant powershell
Make sure you have the rights permission on powershell

Laravel Homestead: Adding an additional virtual machine using vagrant box

There has been a recent change lately when attempting to clone the laravel/homestead package from GitHub. I haven't had trouble in the past trying to add additional virtual machines to my system but now I'm running into a problem.
If you go into GitHub to look at the latest repository for Laravel Homestead you will see that the 'homestead.yaml' file is not in the root directory any longer and has now been replaced by the file 'homestead'.
In the past, I have used the steps below for creating additional virtual machines in my command prompt:
1) Create a new directory (Code2) from within the root directory where VirtualBox and VagrantBox are installed
2) Go into 'cmd' and change to 'Code2' directory
3) Type in 'vagrant box add laravel/homestead --force'
4) Type in 'git clone https://github.com/laravel/homestead.git Homestead_temp'
5) Go into the newly created 'Homestead_temp' directory, copy and paste the files from inside that directory into your 'Code2' root directory.
6) Edit 'src/stubs/homestead.yaml' so that it contains the correct paths for your 'Code2' directory.
7) Go back into 'cmd' and type in 'vagrant up'. When I try to do this, I keep getting a 'read: No such file or directory C:/Users/Jeff/.homestead/Homestead.yaml'
I haven't had trouble in the past adding additional virtual machines but now I am prevented from doing so. Any help is greatly appreciated.
I'm not really sure if this answers my question or not, I'll have to do some research on it but for anybody that is curious about the recent Laravel Homestead changes, check out this article for Laravel 2.0
Hope this information helps!

vagrant fails to start up in osx mountain lion

I am using Vagrant version 1.1.5 and virtual box 4.2.22. when i do vagrant up, It fails with the following error
Error: The VM failed to remain in the "running" state while attempting to boot. This is normally caused by a misconfiguration or host system incompatibilities. Please open the VirtualBox GUI and attempt to boot the virtual machine manually to get a more informative error message.
I check the virtual box logs, It says /Applications directory is writable by everyone. So I fixed it by removing the write permission for the work for /Applications directory.
But the problem is the permission gets reset almost daily. I have to redo the above the fix daily to use vagrant. Any body know why this is happening or any direction I could take to fix this ?
Regards
Rajesh
I dont think the issue is to do with the permissions - well probably not... that will probably just be a warning.
Try running vagrant in Gui mode to see if you can see any errors in the VM itself.
http://docs.vagrantup.com/v2/virtualbox/configuration.html
First check if you are able to do
VAGRANT_LOG=debug vagrant ssh
if not the following solution is most probable.
One of the common error is configuration of ssh key .which one the notice using.
VAGRANT_LOG=debug vagrant up
There if you see vagrant looping for ssh key.
you can easily fix that using following commands .
vkey() { sudo chown "$*":staff ~/.vagrant.d/insecure_private_key;
vkey <new_owner_username>
here vkey() is the zsh function.
credits: https://superuser.com/questions/612376/vagrant-vm-fails-to-boot
-let me know if problem still exists
Cheers

Resources