I am using ttyS0 as a serial console to connect to a redhat linux, which is setup using /etc/init/ttyS0.conf.

When I am connected to serial console, could not find agetty process however sees a bash shell on ttyS0. Whereas with SSH, I could see agetty process in process listing. How this work, does bash kill agetty and get itself on ttyS0 when connecting over console.

# /etc/init/ttyS0.conf

 stop on runlevel [S016]
 start on runlevel [23]
instance /dev/ttyS0
 exec agetty -h -L -w /dev/ttyS0 115200 vt102

no agetty process when connecting over console, however I see bash process with ttyS0

virsh # console --domain 1
Connected to domain LMS
Escape character is ^]
login: root
Last login: Fri Nov  9 03:33:11 from
[root@lmm ~]# ps -eaf | grep -i agetty
root      8397  8376  0 03:37 ttyS0    00:00:00 grep -i agetty
[root@lmm ~]#

[root@lmm ~]# ps -eaf | grep -i ttyS0
root      8376  5585  0 03:37 ttyS0    00:00:00 -bash

agetty process when connecting over SSH to machine

[root@lmm ~]# ps -eaf | grep -i agetty
root      5585     1  0 03:32 ttyS0    00:00:00 agetty -h -L -w /dev/ttyS0 115200 vt102

When you connect using a terminal managed by agetty, which is the case here when you connect over the serial port, agetty replaces itself with login without forking (see the implementation in util-linux). So once you’ve logged in, there is no agetty process any more.

See also When will login terminate?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.