I am trying to setup virtio-serial to communicate between a virtual machine and its host. For this, I am following the instructions given here:
I understand that there is a port on the host at tmp/foo
on the host which is exposed as a special character device at /dev/hvc0
on the guest. The instruction manual asks to use socat
on the host and agetty
on the guest to spawn the console ports.
However, on using agetty
, I do not get any console port, whereas, on using socat
on the guest as well, I can communicate with the host.
I would like to know what are the primary differences between socat
and agetty
and whether this is the correct way to use socat, considering /dev/hvc0
is a special character device.
I have given a look at the manual pages of both and would like a detailed description.
Socat is a command line based utility that establishes two bidirectional byte streams and transfers data between them. Because the streams can be constructed from a large set of different types of data sinks and sources, and because lots of address options may be applied to the streams, socat can be used for many different purposes.nixCraft
socat can do serial line stuff, and it can do fairly advanced functionality, like having multiple clients listen on a port, or reusing connections. The life cycle of a socat instance typically consists of four phases.
agetty opens a tty port, prompts for a login name and invokes the
/bin/login
command. It is normally invoked byinit(8)
. agetty has several non-standard features that are useful for hard-wired and for dial-in lines:ManPageExtra Sources: Socat, agetty MP