getty
spawned from init
is a thing of the past.You've come to this page because you've said something similar to the following:
/etc/inittab
contains records instructinginit
to rungetty
.init
waits for the login session to terminate and cleans up after it.
This is the Frequently Given Answer to such statements.
/etc/inittab
is nowadays wholly a thing of the past, but this particular functionality of it has been obsolete in Unix since 1988.
That was when, with the advent of AT&T Unix System 5 Release 4, this functionality was taken out of /etc/inittab
and given to the new Service Access Facility.
init
spawned the Service Access Controller, which spawned ttymon
the port monitor for terminal devices.
ttymon
did all of the line discipline STREAMS module pushing, serial speed negotiation, and prompting, across one or more terminal devices; and handled updating the Unix login database.
It in turn spawned login
.
getty
was not in fact anywhere part of the process, its functionality subsumed by ttymon
.
System 5 init
running getty
was only the case for about half a decade and was obsolete years before Linux was even invented.
The so-called "sysvinit" for Linux is not actually AT&T System 5 init
but a clone by Miquel van Smoorenburg, written for Minix in 1992.
Alas, xe did not clone the Service Access Facility of Release 4, or IBM's System Resource Controller (also pre-dating Linux) which similarly took much of the functionality out of /etc/inittab
including run-levels, making them obsolete by 1990.
Solaris and its heirs such as OpenIndiana, SmartOS, Illumos, and Schillix all still have ttymon
.
The nosh service management toolset does not employ getty
at all for kernel virtual terminals and user-space virtual terminals, its functionality having similarly been replaced by some simple chain-loading tools that do the only parts of getty
that are actually relevant to virtual terminals (which do not have serial port speeds to negotiate in the first place, for example).
For real terminals, it runs getty
programs, but as with the SAF they are not spawned by process 1.
Process 1 is the system manager, which is not responsible for any TUI login services.
getty
processes for real terminal TUI login services are spawned by a subordinate service manager process.
See the "Terminals" chapter of the nosh Guide for more information.
systemd does not use /etc/inittab
but still uses getty
(more specifically, Wietse Venema's agetty
clone) for both kernel virtual terminals and real terminals, they are still spawned old-style by process 1, which also still does login accounting.
Of course, the BSD side of the universe never had /etc/inittab
, but it did and still does have getty
processes spawned from init
per the configuration in /etc/ttys
.
However, the login database does not have the notion of "init" or "getty" states for terminals, and init
does no login accounting at session termination.
Login accounting is done by the pam_unix
PAM, with the login
program itself doing the cleanup at log-off.