diff --git a/CHANGELOG.md b/CHANGELOG.md index c30467f49..46c1c8a49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ FEATURES: IMPROVEMENTS: +* core: If SCP is not available, a more descriptive error message + is shown telling the user. [GH-127] * virtualbox: Delete the packer-made SSH port forwarding prior to exporting the VM. diff --git a/communicator/ssh/communicator.go b/communicator/ssh/communicator.go index cc5097777..50bf9c9e3 100644 --- a/communicator/ssh/communicator.go +++ b/communicator/ssh/communicator.go @@ -3,6 +3,7 @@ package ssh import ( "bytes" "code.google.com/p/go.crypto/ssh" + "errors" "fmt" "github.com/mitchellh/packer/packer" "io" @@ -145,6 +146,14 @@ func (c *comm) Upload(path string, input io.Reader) error { // Otherwise, we have an ExitErorr, meaning we can just read // the exit status log.Printf("non-zero exit status: %d", exitErr.ExitStatus()) + + // If we exited with status 127, it means SCP isn't available. + // Return a more descriptive error for that. + if exitErr.ExitStatus() == 127 { + return errors.New( + "SCP failed to start. This usually means that SCP is not\n" + + "properly installed on the remote system.") + } } return err