VMware has an option to create virtual serial ports. The “Named Pipe” used under Linux is actually a UNIX domain socket, which is not easily accessed by most tools. My goal was to be able to connect to the virtual serial port using minicom the same way I would connect to a physical device with a real serial port.
The solution is to use socat along with Unix98 pseudo-terminals (/dev/pts/*).
I set up the Virtual Machine to “Use named pipe”, “This end is the client”, “The other end is an application”, and “Yield CPU on poll”. I put the pipe in /export/vmware/DUT.serial0.
At host startup I run the following socat command using start-stop-daemon:
# start-stop-daemon --start --pidfile /var/run/socat.DUT.pid \
--background --make-pidfile \
--exec /usr/bin/socat -- \
-ly -d -lpsocat:DUT \
PTY,b115200,raw,link=/dev/ttyDUTSerial0,group=uucp,mode=660 \
UNIX-LISTEN:/export/vmware/DUT.serial0,fork,owner=frank,group=frank,mode=755
DUT is a placeholder for the virtual machine’s name.
I can then make a minicom config using /dev/ttyDUTSerial0 for the serial port and work as usual.
The above is actually wrapped up in some Gentoo init scripts.
Read the rest of this entry »