Solved How to pass a real serial port to bhyve guest?

Using -l com1,/dev/cuau0 parameter with bhyve() doesn't seem to work.
I'm testing this with MS Windows 10 + PuTTY and getting garbage.
Thanks for directions!
 
It look that I have to set the port parameters explicitly in the host:
Code:
stty -f /dev/cuau0 -ixon -ixoff speed 115200
 
Interesting to know.

Bit more hassle but if a serial port is a hard requirement, you may also be able to use a pci serial card and pass it to the guest of the host supports vt-d. Obviously requires getting a card, but if it works it would be no different than having physical ports in the guest (theoretically)
 
to use a pci serial card and pass it to the guest
That's a good idea, but so far I didn't have luck with PPT devices: always get "not page aligned" error...
Also, for flexibility a null-modem port nmdm() can be passed to the guest with -l com1,/dev/nmdm0A and then connected with net/socat to a real one:
Code:
socat /dev/cuau0,clocal=1,ispeed=115200,ospeed=115200,raw,echo=0, /dev/nmdm0B,clocal=1,ispeed=115200,ospeed=115200,raw,echo=0
 
Ahh, ok. I haven’t used passthrough yet although I’ve heard it can be a bit hit and miss. Was just trying to think of a way of getting a com port into the guest that doesn’t require additional commands on the host before it can be used.
 
I'd prefer to pass through a USB controller ― it's a more universal solution with serial port as a subset. No luck so far...
 
Using -l com1,/dev/cuau0
For me the /dev/cuau* device nodes only seem to work with my cellular modems.

For what you are doing I would start with the /dev/ttyU* device nodes like I use with cu for a serial terminal.
I do have to pass the speed through with -s 115200
 
You're right, /dev/tty* work for me with direct connections to BBBs etc (I use it every day for that purpose), but in this case namely /dev/cuau0 is perfectly working. Also, I noticed when was playing with net/socat, sometimes the latter doesn't work with /dev/tty* (now I can't tell for sure in what situations).
 
I need to use the physical uart (in the host) into a VM Ubuntu. I'm newbie with FreeBSD (TrueNAS r12). Can anyone help me with a more detailed sequence of operation that I have to do ? Thanks
 
Have you tried what I described in the post above?
Of course, with replacing /dev/cuau0 with the actual device node corresponding to your physical port.
How do you start your bhyve? If you have a script, you should add this flag -l com1,/dev/nmdm0A to the bhyve command and start it. It will create /dev/nmdmA and /dev/nmdmB nodes. Now start the socat command.
Also, since the issue of the original post was reported 2 years ago, maybe now it's fixed and working, I haven't tried this for long time.
 
Have you tried what I described in the post above?
Of course, with replacing /dev/cuau0 with the actual device node corresponding to your physical port.
How do you start your bhyve? If you have a script, you should add this flag -l com1,/dev/nmdm0A to the bhyve command and start it. It will create /dev/nmdmA and /dev/nmdmB nodes. Now start the socat command.
Also, since the issue of the original post was reported 2 years ago, maybe now it's fixed and working, I haven't tried this for long time.
How to start the bhyve that it's my problem to understand, because TrueNAS did it, I using the web interface of the TrueNAS to start my VM (Ubuntu Server). So in order to change the command line to start the VM I have to know where I have to see.
 
Back
Top