How to fix Vagrant error: the file `private_key_path` must exist:

I used PuPHPet to create virtual development environments.

Yesterday I created a configuration file for a new window. When I try to deploy it using the command vagrant up, I get the following error message:

C: \ xx> vagrant up

Bringing the machine by default to a virtual box provider ... Errors in the configuration of this device. Correct the following errors and try again:

SSH: * private_key_pathfile must exist: P: //.vagrant.d/insecure_private_key

I stumbled upon this question and moved the insecure_private_key from puphpet \ files \ dot \ ssh to the same directory where the Vagrantfile is located. However, this gives the same error.

The directory specified in the error message also confuses me;

P: //.vagrant.d/insecure_private_key

Why is drive 'P' mentioned?

My Vagrantfile can be found here .

Please rate any recommendations for resolving this error.

+4
source share
6 answers

I fixed the problem by replacing the path with insecure_private_key by hard-coding the path to the insecure_private_key file.

And so it happened:

config.ssh.private_key_path = [
    customKey,
    "#{ENV['HOME']}/.vagrant.d/insecure_private_key"
]

To:

config.ssh.private_key_path = [
    customKey,
    "C:/Users/My.User/.vagrant.d/insecure_private_key"
]
+5
source

It looks like this because you might have performed a stray destroy that you deleted insecure_private_key.

But the stray file is looking puphpet\files\dot\ssh files, if there are any, it is looking for insecure_private_key.

delete (rename)files id_rsainpuphpet\files\dot\ssh

!

+6

puptpet rm -rf puphpet/files/dot/ssh/*, vm .

+2

, Vagrant, :

vagrant_home = (ENV['VAGRANT_HOME'].to_s.split.join.length > 0) ? ENV['VAGRANT_HOME'] : "#{ENV['HOME']}/.vagrant.d"

- , , :

config.ssh.private_key_path = [
  customKey,
  "#{vagrant_home}/insecure_private_key"
]

, Vagrant 1.7 , . , , Vagrant private_key_path, , .

PuPHPet , Vagrant SSH-, , VM SSH, .

, , , Vagrant OSX/Linux - , Windows .

, SSH .

, , - Vagrant, .

+1

, hardcoding private_key_path .

- , VAGRANT_HOME % USERPROFILE%, /.vagrant.d. , , , ,

,

+1

PunctuationMark, VAGRANT_HOME Vagrantfile: ENV['VAGRANT_HOME'] = ENV['USERPROFILE']

0

All Articles