Talk with guest OS in VirtualBox through serial port

Setup the serial configuration. Boot the VM. Then run the following to turn the unix socket into a terminal:

socat UNIX-CONNECT:/tmp/com1 PTY,link=/tmp/com1-pty

The above should block for the entire time of the conversation. If it doesn’t, there’s an issue. Fix it!

Then run a terminal program to talk with it:

screen /tmp/com1-pty

As an alternative to using screen, you can use the following in place of socat and screen above:

socat UNIX-CONNECT:/tmp/com1 STDIO,raw,echo=0

VirtualBox Serial Ports configuration page

Serial Port Configuration