Support / Knowledge Base / HOW TO: Enable Getty in Red Hat EL or CentOS 7

HOW TO: Enable Getty in Red Hat EL or CentOS 7

 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
Documentation=man:agetty(8) man:systemd-getty-generator(8)
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, even though
# 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 serial-getty-digi@ttyj04.service
systemctl start serial-getty-digi@ttyj04.service
Check the status:
# systemctl status serial-getty-digi@ttyj04.service -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 serial-getty-digi@ttyj04.service

To disable the service and remove the symbolic link:

# systemctl disable serial-getty-digi@ttyj04.service
Last updated: Aug 08, 2017

Recently Viewed Articles

No recently viewed articles
Contact a Digi expert and get started today! Contact Us