send data to serial port(ttyS0) in vm from host serial port(ttyS0)

serveryang

Member
Feb 21, 2022
12
0
6
37
1、PVE(host) can get receive data from serial port。

1651820156108.png
2、serial port (ttyS0) in VM can't receive data。
1651820327949.png
1651820406372.png
how to let serial port(ttyS0) in VM received data from COM?
 
I think socat can setup a bidirectional pipe between the socket (maybe use qm showcmd 100 to find out where it is) and the /dev/ttyS0, but I have not experience with it.
 
I think socat can setup a bidirectional pipe between the socket (maybe use qm showcmd 100 to find out where it is) and the /dev/ttyS0, but I have not experience with it.
how to use `socat` setup bid pipe between host and vm?
qm showcmd 100 output:
/usr/bin/kvm -id 100 -name louwa -no-shutdown -chardev 'socket,id=qmp,path=/var/run/qemu-server/100.qmp,server=on,wait=off' -mon 'chardev=qmp,mode=control' -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' -mon 'chardev=qmp-event,mode=control' -pidfile /var/run/qemu-server/100.pid -daemonize -smbios 'type=1,uuid=8bd9a368-67fe-420e-9033-9ee7e78cf865' -smp '12,sockets=1,cores=12,maxcpus=12' -nodefaults -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' -vnc 'unix:/var/run/qemu-server/100.vnc,password=on' -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep -m 16384 -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' -device 'vmgenid,guid=4e6d169b-351b-4023-9081-d1f2f2dd3c88' -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -chardev 'socket,id=serial0,path=/var/run/qemu-server/100.serial0,server=on,wait=off' -device 'isa-serial,chardev=serial0' -device 'qxl-vga,id=vga,max_outputs=4,bus=pci.0,addr=0x2' -device 'virtio-serial,id=spice,bus=pci.0,addr=0x9' -chardev 'spicevmc,id=vdagent,name=vdagent' -device 'virtserialport,chardev=vdagent,name=com.redhat.spice.0' -spice 'tls-port=61001,addr=127.0.0.1,tls-ciphers=HIGH,seamless-migration=on' -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:10433c2839cf' -drive 'file=/mnt/sdb/template/iso/CentOS-7-x86_64-DVD-1804.iso,if=none,id=drive-ide2,media=cdrom,aio=io_uring' -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=101' -device 'virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5' -drive 'file=/mnt/sdb/images/100/vm-100-disk-0.qcow2,if=none,id=drive-scsi0,format=qcow2,cache=none,aio=io_uring,detect-zeroes=on' -device 'scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=100' -netdev 'type=tap,id=net0,ifname=tap100i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' -device 'virtio-net-pci,mac=2A:9F:94:C6:59:50,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=102' -netdev 'type=tap,id=net1,ifname=tap100i1,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' -device 'virtio-net-pci,mac=62:ED:4C:08:D0:F0,netdev=net1,bus=pci.0,addr=0x13,id=net1' -netdev 'type=tap,id=net2,ifname=tap100i2,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' -device 'virtio-net-pci,mac=6E:25:D8:2F:AD:12,netdev=net2,bus=pci.0,addr=0x14,id=net2' -netdev 'type=tap,id=net3,ifname=tap100i3,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' -device 'virtio-net-pci,mac=FA:FB:DD:21:26:0D,netdev=net3,bus=pci.0,addr=0x15,id=net3' -netdev 'type=tap,id=net4,ifname=tap100i4,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' -device 'virtio-net-pci,mac=F2:59:C8:97:B6:32,netdev=net4,bus=pci.0,addr=0x16,id=net4' -netdev 'type=tap,id=net5,ifname=tap100i5,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' -device 'virtio-net-pci,mac=D6:C5:AF:5F:C2:9B,netdev=net5,bus=pci.0,addr=0x17,id=net5' -machine 'type=pc+pve0'
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!