I have 6 VM’s running Ubuntu 16.04, the host is also Ubuntu 16.04. Vagrant version 1.8.1
When I run vagrant halt, I get the error:
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.
Watching the VirtualBox GUI I see the VM shuts down. But the vagrant script stops and does not try and shut down the other VMs. I have to run “vagrant halt” once for each VM I have running. Each time it shuts down the next VM, but then dies again with the SSH connection error.
When I boot up the VMs again, I have not noticed any problems with them.
I found a suggestion to install libpam-systemd: “otherwise networking stops before sshd and the connection gets left open.” I used apt to install libpam-systemd on each VM, but I’m still getting the SSH connection error.
Advertisement
Answer
It was a vagrant bug fixed in later versions. Instead of using the ubuntu apt package I installed the latest from vagrants website.