5

I'm getting this error during vagrant up

There are errors in the configuration of this machine. Please fix
the following errors and try again:

SSH:
* `private_key_path` file must exist: insecure_key

How do I setup the private key in order to ssh into use vagrant ssh? I'm using Windows 7.

My vagrant file

Vagrant.configure("2") do |config|
    config.vm.define "phusion" do |v|
        v.vm.provider "docker" do |d|
          d.cmd = ["/sbin/my_init", "--enable-insecure-key"]
          d.image = "phusion/baseimage"
          d.name = 'dockerizedvm'
          d.has_ssh = true
          #d.force_host_vm = true
        end
        v.ssh.port = 22
        v.ssh.username = 'root'
        v.ssh.private_key_path = 'insecure_key'
        v.vm.provision "shell", inline: "echo hello"
        #v.vm.synced_folder "./keys", "/vagrant"
    end
end
DarVar
  • 16,882
  • 29
  • 97
  • 146

2 Answers2

9

So in my case I was using cygwin with windows, and I received:

* `private_key_path` file must exist: 
C:\cygwin64\home\basic.user/.vagrant.d/insecure_private_key

After a few minutes of investigation I realized the VAGRANT_HOME environment variable was not ok, so exporting the right environment variable did the job:

VAGRANT_HOME=/cygdrive/c/Users/basic.user
export VAGRANT_HOME
Adrian H
  • 167
  • 3
  • 4
  • 1
    Thanks for this answer, this was exactly my issue. i added this to my .bash_profile and it worked flawlessly, thanks! – dmachiavello Aug 15 '15 at 01:20
  • After 2 hours, this finally fixed my issue. On windows (powershell) you can do `setx VAGRANT_HOME "/cygdrive/c/Users/Bob"` – Emre Feb 22 '17 at 07:21
2

insecure_key should be a file containing an SSH key. The file should be in the same folder where you vagrant up. The following is an alternative:

curl -o insecure_key -fSL https://github.com/phusion/baseimage-docker/raw/master/image/insecure_key chmod 600 insecure_key vagrant ssh

ivotron
  • 1,471
  • 1
  • 17
  • 21
  • https://raw.githubusercontent.com/phusion/baseimage-docker/master/image/services/sshd/keys/insecure_key – ryaz Aug 23 '17 at 22:27