How to configure serial getty with systemd

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 7

Issue

  • How to configure a serial getty with custom parameters in RHEL 7 so that it starts on boot

Resolution

  • First copy the template:

    # cp /usr/lib/systemd/system/serial-getty@.service /etc/systemd/system/serial-getty@ttyS0.service
    
  • Then edit the file and modify the agetty line:

    [Service]
    ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM    <-- Change this parameter
    Type=idle
    
  • Reload the daemon and start the service:

    # systemctl enable serial-getty@ttyS0.service
    # systemctl start serial-getty@ttyS0.service
    
SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.