Reputation: 187
I have started using Vagrant. I have some issues in restarting my VM. My Vagrantfile is:
Vagrant.configure("2") do |config
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
I open SSH by Vagrant SSH. Now if i give "sudo reboot"
the connection to the VM is closed. I get the following:
vagrant@precise32:~$ sudo reboot
vagrant@precise32:~$
Broadcast message from vagrant@precise32
(/dev/pts/0) at 9:43 ...
The system is going down for reboot NOW!
Connection to 127.0.0.1 closed by remote host.
Connection to 127.0.0.1 closed.
How to solve this? Why is this happening?
Upvotes: 3
Views: 2497
Reputation: 84
I had a similar problem. When I rebooted, I couldn't log back in. I tried shutting down instead. That seemed to work.
vagrant@precise32:~$ sudo shutdown -h now
vagrant@precise32:~$
Broadcast message from vagrant@precise32
(/dev/pts/0) at 5:16 ...
The system is going down for halt NOW!
vagrant@precise32:~$ exit
logout
Connection to 127.0.0.1 closed.
foo$ vagrant status
Current machine states:
default poweroff (virtualbox)
The VM is powered off. To restart the VM, simply run `vagrant up`
foo$ vagrant up
Upvotes: 0
Reputation: 13920
When you run sudo reboot
, it reboots the vagrant VM, as a part of the reboot process it'll kill all daemons and processes. Of course the sshd will be stopped or killed, as a result the connection to it (I mean vagrant ssh
) will be lost.
Once the vagrant VM is up and running again, you can vagrant ssh
to it again. Use vagrant status
to check VM status.
The vagrant way of restarting a box is:
Ctrl
+d
to exit the SSH connectionvagrant reload
Upvotes: 6