Page MenuHomePhabricator

Vagrant stops accepting SSH key after provisioning
Closed, InvalidPublic

Description

First vagrant provision succeeded, subsequent attempts failed complaining about SSH connection errors. The SSH key is in the usual place but Vagrant seems to have forgotten about it:

$ vagrant ssh
vagrant@127.0.0.1's password: 

$ ssh -i .vagrant/machines/default/virtualbox/private_key vagrant@10.11.12.150
<works>

Event Timeline

INFO ssh: Invoking SSH: ssh ["vagrant@127.0.0.1", "-p", "2201", "-o", "Compression=yes", "-o", "DSAAuthentication=yes", "-o", "LogLevel=FATAL", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-o", "IdentitiesOnly=yes", "-i", "/home/tgr/Wikimedia/vagrant/PageViewInfo/.vagrant/machines/default/virtualbox/private_key", "-o", "ForwardX11=yes", "-o", "ForwardX11Trusted=yes", "-o", "ForwardAgent=yes"]

the culprit is the IdentitiesOnly parameter, somehow. (See also T155798: MediaWiki-Vagrant gives "SSH authentication failed" for no apparent reason)

In the end I just commented out /usr/lib/ruby/vendor_ruby/vagrant/util/ssh.rb line 120 which sets IdentitiesOnly by default. Note that this might cause SSH to fail if you have more than three public keys in your SSH agent.

Still not quite working (vagrant ssh works but reload/reprovision does not). FWIW I am using Ubuntu 16.04 with vagrant 1.8.1. This affects one box but not the others.

This should probably be reported upstream but upstream only accepts bug reports for the current Vagrant version and I don't have time to figure out how to install that (and possibly break the working boxes as well in the process) :/

Destroying and rebuilding the box seems to have fixed the issue so I guess there is no point in putting more effort to it.