vagrant provision vs. vagrant reload --provision

6,175 views
Skip to first unread message

Jake

unread,
Feb 7, 2017, 12:42:05 AM2/7/17
to Vagrant
Hello,

I was wondering what the difference is between vagrant provision and vagrant reload --provision? For me the former does not work, but the latter does? The error message I receive when I
run vagrant provision is `SSH authentication failed! This is typically caused by the public/private keypair for the SSH user not being properly set on the guest VM.`

My Vagrantfile looks as follows:

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/trusty64"

  config.vm.synced_folder "./src", "/home/vagrant", mount_options: ["dmode=775,fmode=664"]

  config.vm.box_check_update = true
  config.vm.network "forwarded_port", guest: 80, host: 8080

  # SSH
  config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/id_rsa.pub"
  config.ssh.private_key_path = "~/.ssh/id_rsa"

  # Provisioning
  config.vm.provision "shell" do |s|
  s.path = "provision.sh"
  end

end

When I manually set config.ssh.username, vagrant provision works. However, I would like to setup SSH, so this is not a real solution to my problem.

Thanks in advance!

Jake

Alvaro Miranda Aguilera

unread,
Feb 7, 2017, 2:07:25 AM2/7/17
to vagra...@googlegroups.com

On Tue, Feb 7, 2017 at 6:42 AM, Jake <jsb...@gmail.com> wrote:
vagrant provision and vagrant reload --provision?

Hello

Vagrant provision will run all the provisioning steps now. as is in the current VM as is.

Vagrant reload will reboot the VM, if the VM was provisioned already in the next run reload will skip those by default.
vagrant reload --provision will reboot the VM and run the provision steps if any.


I think the mount you are doing in /home/vagrant is causing problems

in the home of the users are a lot of files needed to ssh.

replace   config.vm.synced_folder "./src", "/home/vagrant", mount_options: ["dmode=775,fmode=664"]
with   config.vm.synced_folder "./src", "/home/vagrant/src", mount_options: ["dmode=775,fmode=664"]

or use any other mount point outside /home/vagrant

--
Alvaro

Reply all
Reply to author
Forward
0 new messages