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/serial-getty@.service /etc/systemd/system/serial-getty@ttyS0.service
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/serial-getty@ttyS0.service /etc/systemd/system/getty.target.wants/
systemctl daemon-reload
systemctl start serial-getty@ttyS0.service
systemctl enable serial-getty@ttyS0.service
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
![image](https://user-images.githubusercontent.com/6738956/248597660-2702d01e-8ed9-4dfd-9b32-57a8c54d5e53.png)
![image](https://user-images.githubusercontent.com/6738956/248597676-01c3beb2-26d2-4cb9-ad25-a3deff57cdc6.png)
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