Vagrant access is denied - vagrant

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

Related

Using AWS CLI with MobaXterm on Windows

I am a newbie to both AWS and MobaXterm. I am trying to use MobaXterm to manage AWS instances because it comes with bash.
I am following the commands as per https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html.
When I run the following command $ sudo ./aws/install, I get the following error:
Unable to start 'install': There is no application associated with the
given file name extension.
I did run chmod 777 to ensure that I am able to read/write/execute. Please see attached image.
I do know that I can use Windows CLI installer in command line. However, doing SSH to EC2 is a nightmare in Windows with all certificates. With MobaXterm (because of bash), it is very easy. So, my preference is to use MobaXterm instead of Windows command prompt.
Moreover, I don't want to directly install Ubuntu. Hence, I am looking for some guidance here. I'd appreciate any help.
I am hoping that I am not missing any package. Thanks for any help.
In order for AWS cli to run on MobaXterm, you will need to run the following commands in MobaXterm:
MobApt install python2-pip
pip2 install awscli
It will take some time for MobaXterm to complete steps 1 and 2. Also, AWS cli runs super slow in MobaXterm. You are better off using cmd.
This is the site that helped me ran AWS cli on MobaXterm.
https://majornetwork.net/2017/07/installing-aws-cli-on-cygwin/

No output using vagrant Windows 10

I'm not sure if this belongs her or another site, so let me know and I'll remove it if not. So I'm attempting to install vagrant on a windows 10 machine. I have virtual box installed, I have a kali linux machine on it that I've used in the past. After using the msi to install vagrant, I rebooted as prompted. After reboot I verified vagrant was added to the path.
Issuing any vagrant command shows nothing in the output. I've tried passing -h and --version and nothing shows. Even running as admin and powershell gives no response. No hanging or freezing, just nothing in the response. Not even a command not recognized warning(more validation its in my path).
Can anyone help me find out whats going on and why none of the vagrant commands seem to respond?
OUTPUT EXAMPLE
C:\>vagrant init -h
C:\>vagrant --version
C:\>
im guessing its something to do with their latest 1.9.7 version? i installed 1.9.6 and it finally gives me some output.

vagrant ssh not working in MobaXterm on Windows

I have already found "SSH to Vagrant box in Windows" and added the git bin directory to my windows PATH. I verified that it worked by starting CMD and typing ssh, and got a usage message. (Before adding the git bin directory to my path, CMD complained that ssh wasn't a valid command.)
However...when I run vagrant ssh from MobaXterm, I get the same error I did before. (A page full of ruby errors that aren't helpful to me.) When I run it as VAGRANT_LOG=debug vagrant ssh, I see:
INFO subprocess: Starting process: ["C:\\Users\\(myname)\\DOCUME~1\\MOBAXT~1\\slash\\bin/ssh.EXE"]
This is the wrong ssh executable; it's the one installed in MobaXterm and it doesn't work if run from a CMD window.
How can I get vagrant ssh to work as it should?
Part of the trick is that I don't want to use the Windows PATH for arbitrary commands—not even for ssh, really. I want to use the versions in MobaXterm for everything. All I want is to be able to run vagrant ssh the same way I would on Linux or Mac.
The workaround I have been using, which I found somewhere online (but can't find the page again), is:
vagrant ssh-config > vagrant-ssh
ssh -F vagrant-ssh default # Works exactly the way `vagrant ssh` should
"default" is the box name for a typical Vagrant environment with only a single vagrant box. If there is more than one box, replace "default" with the box name:
ssh -F vagrant-ssh host001 # Works the way `vagrant ssh host001` would on another system
This is a good workaround with minimal changes required to workflow. But I'd still like a way to get vagrant ssh working without needing the extra file in my vagrant directory.
here you can find an explanation
In the documentation, this mention is in the "Terminal tab settings"
section, so you will find this option in the "Terminal" tab.
Go to MobaXterm global settings window, then click on the "Terminal"
tab and check the "Use Windows PATH environment". Note that if you are
using a session, you will have to do the same in this session: edit
your session, then go to the "Terminal settings" tab and check the
"Use Windows PATH" option.
Call me crazy but what about doing this:
Setup Vagrant Virtualbox VM like normal
In MobaXterm, create a "Bash" shell integration with the working directory setup as the directory of the Vagrant directory for the specific VM you are doing this for (aka ... the directory where the Vagrantfile lives for this VM)
In the "Advance Shell Settings", use this command (adjust vagrant path to where ever your Vagrant is installed as MobaXterm bash sees it):
command /drives/c/HashiCorp/Vagrant/bin/vagrant ssh-config >
vagrant-ssh-config && ssh -A -F vagrant-ssh-config default
Vagrant VM needs to be up for MobaXterm Bash entry for the VM to work. I just setup two Bash shell settings for two Vagrant Virtualbox VMs I created and it seems to work just fine.
Updated: I went a little further since I've figured this out .. at least for me I did :). I added additional CMD shell sessions MobaXterm for each of my Vagrant VM. These additional CMD shell sessions do Vagrant halt, up, and restart (combo of halt and up) commands against the VMs they are specific to. This is what restart looks like:
vagrant halt
vagrant up
set /p value="Press Enter to continue"
exit
The Startup Directory for the above session is, again, the directory where the Vagrantfile lives for this VM. Oh, and make sure that "Use Windows PATH" is checked in Terminal Settings.
you can install git (https://git-scm.com/downloads) during install git choose "use git and optional Unix tools from the windows command prompt"
Download msysgit from msysgit project page and include msysgit/bin folder to PATH, now you can run ssh and vagrant ssh form your terminal on windows.

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?
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

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