Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save OndrejValenta/338035c23d70d8063aed14b4ae35af43 to your computer and use it in GitHub Desktop.

Select an option

Save OndrejValenta/338035c23d70d8063aed14b4ae35af43 to your computer and use it in GitHub Desktop.
Enable Serial Console for Rocky Linux 9 / CentOS in Proxmox

Enable Serial Console for Rocky Linux / CentOS / RHEL in Proxmox

This guide is a combination of two sources

https://www.thegeekdiary.com/centos-rhel-7-how-to-configure-serial-getty-with-systemd/

https://pve.proxmox.com/wiki/Serial_Terminal

Done in Proxmox console

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.

Done in VM

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

Back in Proxmox terminal you can now attach to the Console like this

qm terminal [VM ID]
@logan-hcg
Copy link

You don't need to copy/edit the serial-getty@.service file. This is a "template unit files", so you can just do the following directly to use the template:

systemctl start serial-getty@ttyS0.service
systemctl enable serial-getty@ttyS0.service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment