Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a Vagrant environment that requires me to forward port 80 so I bring it up under sudo on an OS X machine. This has always been fine until I recently upgraded to Vagrant 1.2.2. Now it fails to boot.

[default] Waiting for VM to boot. This can take a few minutes.
[default] Failed to connect to VM!
Failed to connect to VM via SSH. Please verify the VM successfully booted
by looking at the VirtualBox GUI.

Because I'm running under sudo, the machine never gets added to the Virtualbox GUI, but that's always been the case for this environment.

I don't get any indication that there was a problem with the additions -- a potential source of this error, from what I've read. I can bring things up just fine if I change to using port 8080 on the host machine. I can't use the app, but the VM itself loads up and provisions nicely.

As far as I can tell, the only thing that's changed is:

  1. I upgraded my Vagrant version
  2. I updated the project's Vagrantfile to use v2 syntax.

Anyone have any idea what I might be missing? I thought I'd be able to find this pretty easily, but it's quickly becoming a very real problem.

UPDATE 27 JUN

It appears that it's an SSH key issue if VAGRANT_LOG=DEBUG is to be believed:

DEBUG ssh: Checking key permissions: /Users/robwilkerson/.vagrant.d/insecure_private_key
 INFO ssh: SSH not up: #<Vagrant::Errors::SSHKeyBadOwner: The private key to connect to the machine via SSH must be owned
by the user running Vagrant. This is a strict requirement from
SSH itself. Please fix the following key to be owned by the user
running Vagrant:

/Users/robwilkerson/.vagrant.d/insecure_private_key>
 INFO subprocess: Starting process: ["VBoxManage", "showvminfo", "3422bba7-8f35-42ad-ba1a-c127c6cb3cf6", "--machinereadable"]

I assume it wants a key owned by root since I'm under sudo, but if that's the case, why isn't it looking at root's ~/.vagrant.d/? Did v2 get more strict about this? I was able to sudo vagrant up just fine until the upgrade. Since this is my only dev environment that requires sudo to up, I'd rather not change key ownership. Is there another way?

Lots of questions, I know, but I could really use a hand understanding/fixing this one.

share|improve this question

2 Answers 2

Try changing the ownership of the vagrant.d directory:

# cd ~
# sudo chown -R root .vagrant.d/
share|improve this answer
    
It will only worse the situation: Vagrant will fail with The home directory you specified is not accessible. The home directory that Vagrant uses must be both readable and writable. –  om-nom-nom Sep 9 at 12:05
up vote 1 down vote accepted

I haven't found a better solution to this than to toggle the owner of the private key when switching between this project and others. To make it suck just a little less, I created a zsh function:

vkey() { sudo chown "$*":staff ~/.vagrant.d/insecure_private_key; }

From the command line, I can update the key owner with this:

$ vkey <new_owner_username>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.