# BHyve vm console 'all ports busy'



## byrnejb (Apr 19, 2019)

I connected to a vm guest from the system console using 
	
	



```
vm console guest
```
.  When I tried to exit the console using 
	
	



```
<shift>~<shift><ctrl>D
```
  I was unable to do so and could not regain control of the system console from the guest..  I conected to the bhyve host via ssh and attempted to connect to the guest console from there.  When I tried this I encountered an error, "all ports busy" .  I tried shutting the guest down using  but that did not work.  I then used 
	
	



```
bhyvectl --vm=guest --destroy
```
 to stop it and then used 
	
	



```
vm start guest
```
 to restart it.  I still get the 'all ports busy' and now I cannot connect to the guest via ssh either because it is stuck in the bootloader stage.

How do I clear the console and get this system back on line?


----------



## Emrion (Apr 21, 2019)

`killall cu`
(From sysutils/iohyve script).


----------



## Phishfry (Apr 21, 2019)

I don't use any assist programs for bhyve except tmux. All handmade. Good learning experience.

Here is my /etc/rc.shutdown.local

```
#!/bin/sh
pkill bhyve; ##<< This sends a signal to the VM to shutdown<<##;
sleep 10; ##<< This gives the VM 10 seconds to shutdown cleanly. Adjust to suit your VM's<<##;
bhyvectl --destroy --vm=freebsd1;##<< This section destroys the VM containers.<<;
bhyvectl --destroy --vm=freebsd2
bhyvectl --destroy --vm=freebsd3
bhyvectl --destroy --vm=freebsd4
#bhyvectl --destroy --vm=freebsd5
tmux kill-server;##<< This destroys the tmux console server<<##;
```


----------



## byrnejb (Apr 23, 2019)

The issue was ultimately resolved by restarting the bhyve host.


----------

