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

Re: hangs at boot [Solved]



On Fri, Dec 09, 2022 at 01:19:46AM +0100, email.lists81@gmail.com wrote:
> As it turns out I didn't need to but for future use, do you have any tips on
> where one might find documentation about how agetty interacts with the rest
> of the debian startup process? I've searched but the results have been
> scant.

I don't know all of the pieces either.  There are a LOT of them.

By default, systemd is supposed to run a single getty on /dev/tty1, and
also passively "listen" for activity on tty2 through tty6.  Switching
to one of those VTs will cause a getty to be spawned there.  NOT switching
to them leaves them with nothing visibly running.

Before pressing Ctrl-Alt-F3:

unicorn:~$ ps -ft tty3
UID          PID    PPID  C STIME TTY          TIME CMD

After pressing Ctrl-Alt-F3:

unicorn:~$ ps -ft tty3
UID          PID    PPID  C STIME TTY          TIME CMD
root      852799       1  0 20:18 tty3     00:00:00 /sbin/agetty -o -p -- \u --n

The number of passively launched getty processes is configurable in
/etc/systemd/logind.conf.  I believe it's the NAutoVTs= parameter that
controls this.

I've forgotten the details of your problem, but if switching to tty2
gives you a login prompt, but switching back to tty1 does NOT give you
one on tty1, then there must be something going wrong with the getty
that's supposed to be started on tty1 at boot time -- but the passive
gettys controlled by systemd-logind must be working.

I think the passive ones are controlled by getty@.service (the @ sign is
some kind of wildcard).  If I read /lib/systemd/system/getty@.service
I can see

ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear %I $TERM

which appears to match the process I'm seeing on tty3:

unicorn:~$ ps w -ft tty3
UID          PID    PPID  C STIME TTY      STAT   TIME CMD
root      852799       1  0 20:18 tty3     Ss+    0:00 /sbin/agetty -o -p -- \u --noclear tty3 linux

I don't know whether the initial getty on tty1 is also controlled by
this service, or by some other service.  (I've already logged in on tty1
and done a "startx", so my whole X session is running on tty1, instead
of a getty.)  For grins:

unicorn:~$ systemctl status getty@tty1.service
● getty@tty1.service - Getty on tty1
     Loaded: loaded (/lib/systemd/system/getty@.service; enabled; vendor preset>
    Drop-In: /etc/systemd/system/getty@.service.d
             └─noclear.conf
     Active: active (running) since Thu 2022-11-17 18:05:49 EST; 3 weeks 0 days>
       Docs: man:agetty(8)
             man:systemd-getty-generator(8)
             http://0pointer.de/blog/projects/serial-console.html
   Main PID: 743 (login)
      Tasks: 0 (limit: 14198)
     Memory: 1.7M
        CPU: 48ms
     CGroup: /system.slice/system-getty.slice/getty@tty1.service
             ‣ 743 /bin/login -p --

Warning: some journal files were not opened due to insufficient permissions.

Ah, right, I configured that noclear.conf file on this system.

unicorn:~$ cat /etc/systemd/system/getty@.service.d/noclear.conf
[Service]
TTYVTDisallocate=no

So I guess getty@.service also controls the getty on tty1.  I have no idea
why it would stop working.  Check your logs (systemctl/journalctl as root)
and see what you can find.

Even though I'm still not clear on how all this stuff works, I hope some
of this rambling and pasting might be helpful.


Reply to: