diff --git a/lib/vagrant/communication/ssh.rb b/lib/vagrant/communication/ssh.rb index 07bea992f..353260547 100644 --- a/lib/vagrant/communication/ssh.rb +++ b/lib/vagrant/communication/ssh.rb @@ -153,6 +153,12 @@ module Vagrant # This happens if authentication failed. We wrap the error in our # own exception. raise Errors::SSHAuthenticationFailed + rescue Net::SSH::Disconnect + # This happens if the remote server unexpectedly closes the + # connection. This is usually raised when SSH is running on the + # other side but can't properly setup a connection. This is + # usually a server-side issue. + raise Errors::SSHDisconnected rescue Errno::ECONNREFUSED # This is raised if we failed to connect the max amount of times raise Errors::SSHConnectionRefused diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index 778872d57..4b3686310 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -333,6 +333,11 @@ module Vagrant error_key(:ssh_connection_timeout) end + class SSHDisconnected < VagrantError + status_code(83) + error_key(:ssh_disconnected) + end + class SSHKeyBadPermissions < VagrantError status_code(12) error_key(:ssh_key_bad_permissions) diff --git a/templates/locales/en.yml b/templates/locales/en.yml index b4ee73d37..152f4e7cc 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -131,6 +131,11 @@ en: means that the VM booted, but there are issues with the SSH configuration or network connectivity issues. Please try to `vagrant reload` or `vagrant up` again. + ssh_disconnected: |- + The SSH connection was unexpectedly closed by the remote end. This + usually indicates that SSH within the guest machine was unable to + properly start up. Please boot the VM in GUI mode to check whether + it is booting properly. ssh_key_bad_permissions: |- The private key to connect to this box via SSH has invalid permissions set on it. The permissions of the private key should be set to 0600, otherwise SSH will