HOW TO: Enable Getty in Red Hat EL or CentOS 7
The following example uses ttyj04.
Created a custom file called: "/lib/systemd/system/serial-getty-digi@.service" by copying the serial-getty@.service file:
cp /lib/systemd/system/serial-getty@.service /lib/systemd/system/serial-getty-digi@.service
Set the fixed baud rate (in this example 9600) on the "ExecStart" line and added the –L flag (hard-wired terminal). We commented out the Type line, although we don't know if it is necessary:
# This file is part of systemd.
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
Description=Serial Getty on %I
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
ExecStart=-/sbin/agetty -L %I 9600
We gave the file executable permissions (not sure if this is required):
# chmod a+x serial-getty-digi@.service
Use systemctl to create the symbolic link and startup the login service via agetty on device: "/dev/ttyj04". Linux systemd will start this automatically during subsequent system boot up:
# systemctl enable email@example.com
# systemctl start firstname.lastname@example.org
Check the status:
# systemctl status email@example.com -l
In our case, we had to reboot the server to get this working reliably, however this may not be neccessary.
To stop the agetty process:
# systemctl stop firstname.lastname@example.org
To disable the service and remove the symbolic link:
# systemctl disable email@example.com
Last updated: Aug 08, 2017