bhyve How to properly exit vm-bhyve console back to the host?

Hello everyone!

I am playing with vm-bhyve right now but I am finding it impossible to exit the console to a VM once I am inside of it. CTRL-D does not work, the vm-bhyve GitHub says that a somewhat cryptic ~+CTRL-D should do it... I have not idea what that means though. And if it means pressing SHIFT+`+CTRL+D on a US keyboard then it does not work either...

There was once an issue on GitHub related to this problem, but it can hardly be said that anything was resolved there...

In addition to that, if I just kill the shell wherein I entered the VM console this makes it impossible to ever do
Code:
vm console
again before rebooting the system. Otherwise the console only shows undecipherable gibberish...

So how do you people exit your vm-bhyve console once inside?
 
vm(8) uses cu(1) for this. Hit enter a couple of times, then ~^D or ~.

Code:
     ~^D or ~.
             Drop the connection and exit.  Only the connection is dropped –
             the login session is not terminated.

And if it means pressing SHIFT+`+CTRL+D on a US keyboard then it does not work either...
That's the correct key combination. It's more shift+` then ctrl-D quickly after it (not all 4 keys simultaneously). But hit enter a couple of times beforehand, it has to be done on a "clear" line or else it won't get picked up.
 
  • hitting enter once is enough.
  • If you're inside another cu(1) session, type ~~. to send the exit to the "inner" one. I have no explanation for this but I found I also need this inside ssh (using openssh from ports), otherwise the connection was terminated...
 
Alright everyone! I will give it a try again tomorrow. I might also try the tmux way, since I am using tmux.

Thanks! I will be back tomorrow and let you all know if it worked!
 
Alright, I tried it and it works! First hitting ENTER, then SHIFT+` and then CTRL+D. Thanks for the quick help everyone!
 
Back
Top