[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: What is agetty, and why can't it be stopped?



On Wed, Jun 05, 2019 at 10:04:09PM -0400, Gene Heskett wrote:

[agetty]

People have given very useful answers, so I'll restrict myself
to some history.

Gene, you've been wasting your time with junk OSes, otherwise
you'd know who "getty" is. Agetty is just an alternative
implementation of that.

Back then [TM], when we were young and handsome [1], a Unix
box had several terminals connected to it. Typically users
would show up at one of these terminals, perhaps hit ENTER,
and be presented with some greeting -- something like "Login:",
perhaps.

Entering user name and password gave the user an interactive
session, courtesy of a shell.

The process responsible to start all of this was "getty",
which just waited on a terminal until something happens,
and then set off the whole authentication - session dance.

Getty stayed the parent of that whole session "process
tree", which at the end of the session folded nicely back.
On termination of getty's child, getty itself terminated.

To get the ball rolling again, getty's parent (typically
init) started a new getty (in our jargon, "respawn"). You
could configure that behaviour in a file called /etc/inittab.

So, what you're seeing is not "agetty" "changing its PID",
as you see (I don't think Unix allows that!), but a "new"
instance of agetty being started. And you can kill as fast
as you will -- I don't think you're going to out-kill init.

I don't know where /etc/inittab is under that newfangled
init system, but I'm sure others will chime in. On a
recent (stretch) Debian with SysV, this file still exists,
and you can see (this is just the relevant snippet):

  # Note that on most Debian systems tty7 is used by the X Window System,
  # so if you want to add more getty's go ahead but skip tty7 if you run X.
  #
  1:2345:respawn:/sbin/getty 38400 tty1
  2:23:respawn:/sbin/getty 38400 tty2
  3:23:respawn:/sbin/getty 38400 tty3
  4:23:respawn:/sbin/getty 38400 tty4
  5:23:respawn:/sbin/getty 38400 tty5
  6:23:respawn:/sbin/getty 38400 tty6
  
  # Example how to put a getty on a serial line (for a terminal)
  #
  #T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
  #T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100

Cf. man inittab for details. See? Still gettys being started
here, for the Linux virtual consoles. And some examples on
how to do it for serial terminals.

Cheers

[1] My memory is foggy, so I won't commit myself to remember
   whether some dinosaurs roamed the world at that time.

-- t

Attachment: signature.asc
Description: Digital signature


Reply to: