Map a virtual serial port on the guest(ttyS0) to a pseudo terminal(pty) on the host This has to be added to /etc/pve/qemu-server/VMID.conf:
args: -device isa-serial,chardev=myChardevice,id=s -chardev pty,id=myChardevice
After starting the VM check you will see a message:
char device redirected to /dev/pts/7 (label myChardevice)
Inside the guest, you should see now the serial port:
dmesg | grep ttyS
[0.560758] 00:04: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
Inside the guest, you can now instruct systemd to start a login process on the serial port:
systemctl start serial-getty@ttyS0.service
systemctl enable serial-getty@ttyS0.service
From the host you can now start a text terminal to login to the above:
picocom /dev/pts/7
If you don't know where to find the pts terminal, you can also use the qemu monitor to find this:
qm monitor 100
Entering Qemu Monitor for VM 100 - type 'help' for help
qm> info chardev
myChardevice: filename=pty:/dev/pts/7
If you want to get a copy of the boot messages on the text terminal, you can use:
GRUB_CMDLINE_LINUX_DEFAULT="quiet console=tty0 console=ttyS0,38400n8"
in /etc/default/grub
I just noticed instead of a custom
args: ...
line you can also useserial0: socket
, and then useqm terminal $VMID
, still have to enable theserial-getty@ttyS0
service (and/or grub commandline)