This guide is a combination of two sources
https://www.thegeekdiary.com/centos-rhel-7-how-to-configure-serial-getty-with-systemd/
Add serial port to VM
qm set [VM ID] -serial0 socket
Shutdown completely the VM and start it again so the serial port is active.
Copy template settings for Serial Console to ttyS0 file
cp /usr/lib/systemd/system/[email protected] /etc/systemd/system/[email protected]
Update the new file like this
[Service]
ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM <-- Change this parameter, add %I
Type=idle
Create a symlink and reload the console
ln -s /etc/systemd/system/[email protected] /etc/systemd/system/getty.target.wants/
systemctl daemon-reload
systemctl start [email protected]
systemctl enable [email protected]
Update GRUB
# in /etc/default/grub change the GRUB_CMDLINE_LINUX parameter so it contains both consoles like this
GRUB_CMDLINE_LINUX="quiet console=tty0 console=ttyS0,115200"
Apply changes and reboot
grub2-mkconfig -o "$(readlink -e /etc/grub2.conf)"
reboot
qm terminal [VM ID]
That is not precise.. I did not manage to just open a VM console with


it gets stuck with
I was able to get all data with
qm terminal
so I let it be for time being but if you find out what to do to make it fully working let me know..And yes, I have a template VM that has all the changes mentioned above implemented, even the GRUB line.. I just realized it doesn't say it specifically that you should just add the consoles there and not change whole GRUB line, I hope it's understandable