Background
I'm running FreeBSD 12.1-RELEASE as a host for bhyve virtual machines.
I have a FreeBSD 12.1-RELEASE guest running inside a VM. I would like to have two TTY-class devices configured for it.
According to the manual page, in order to start the VM with two TTY-class devices I have to start bhyve with command-line options similar to those: -l com1,/dev/nmdm0B -l com2,/dev/nmdm1B
. Then I should be able to connect to the guest via those two nullmodem terminals with cu -l /dev/nmdm0A
and cu -l /dev/nmdm1A
.
Problem
The first command works as expected: cu -l /dev/nmdm0A
shows me the main console of the guest.
The second command, however, attaches to the guest, but shows nothing. I would expect to show me a login prompt as if switched to another TTY.
What am I missing?
Additional details
-
The guest is a fresh installation of FreeBSD.
-
The output of
dmesg | grep uart
on the guest is as follows:uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0 uart0: console (115200,n,8,1) uart1: <16550 or compatible> port 0x2f8-0x2ff irq 3 on acpi0
-
I've tried setting
hint.uart.1.flags
first to0x10
and then to0x80
(although this one is for kernel debuggers from what I understand from uart(4)) and rebooted after each change. It didn't work.
Best Answer
The solution is to modify
/etc/ttys
on the guest. On amd64, it has the following defaults:As you can see, the status of every ttyu terminal device is set to
onifconsole secure
(thesecure
part is irrelevant here). It means that this those terminal devices are only turned on if they act as a console. In order to make it possible to access those devices from the host we just need to replaceonifconsole
withonifexists
.In my particular case, I had to replace the following line:
with:
As a result, it is now possible to connect to the guest system using the second console: