{"id":6690,"date":"2017-05-08T12:38:26","date_gmt":"2017-05-08T04:38:26","guid":{"rendered":"http:\/\/rmohan.com\/?p=6690"},"modified":"2017-05-08T12:38:26","modified_gmt":"2017-05-08T04:38:26","slug":"centos-rhel-7-how-to-configure-serial-getty-with-systemd","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6690","title":{"rendered":"CentOS \/ RHEL 7 : How to configure serial getty with systemd"},"content":{"rendered":"<p>With SysV init, by default, getty processes are started on the first six virtual consoles. They can be accessed with the Ctrl+Alt+F1 to Ctrl+Alt+F6 key combination. systemd starts the getty processes only when needed. That means, only after you change to, for instance, the second virtual terminal by pressing Ctrl+Alt+F2 is the getty process started in that terminal.<\/p>\n<p>The \/usr\/lib\/systemd\/system\/getty@.service file is responsible for the virtual terminals (\/dev\/tty[X]). \/usr\/lib\/systemd\/system\/serial-getty@.service is responsible for all other terminals, such as a serial terminal on \/dev\/ttyS0.<\/p>\n<p>Systemd provides a template unit file for serial getty. Template file can be found here<\/p>\n<p>\/lib\/systemd\/system\/serial-getty@.service<br \/>\nSteps<\/p>\n<p>1. First copy the template:<\/p>\n<p># cp \/usr\/lib\/systemd\/system\/serial-getty@.service \/etc\/systemd\/system\/serial-getty@ttyS0.service<br \/>\n2. Then edit the file and modify the agetty line:<\/p>\n<p>[Service]<br \/>\nExecStart=-\/sbin\/agetty &#8211;keep-baud 115200,38400,9600 %I $TERM    <-- Change this parameter\nType=idle\n3. Create a symlink:\n\n# ln -s \/etc\/systemd\/system\/serial-getty@ttyS0.service \/etc\/systemd\/system\/getty.target.wants\/\n4. Reload the daemon and start the service:\n\n# systemctl daemon-reload\n# systemctl start serial-getty@ttyS0.service\n# systemctl enable serial-getty@ttyS0.service\n\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With SysV init, by default, getty processes are started on the first six virtual consoles. They can be accessed with the Ctrl+Alt+F1 to Ctrl+Alt+F6 key combination. systemd starts the getty processes only when needed. That means, only after you change to, for instance, the second virtual terminal by pressing Ctrl+Alt+F2 is the getty process started [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6690"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6690"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6690\/revisions"}],"predecessor-version":[{"id":6691,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6690\/revisions\/6691"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}