NextcloudPi tries to autologin deactivated root

When I attach a monitor to my Odroid-HC4 running NCP it tries to autologin root. Since root is deactivated it fails to login and retries every few seconds.
When I check the journal via ssh (sudo journalctl -b -p warning) it logs each of those login attempts.

The question is now how do I deactivate the autologin properly?

As NCP uses getty, I localized /etc/systemd/system/getty@.service.d/override.conf and tried uncommenting ExecStart=-/sbin/agetty --noissue --autologin root %I $TERM and removing --autologin root which both did not work…

Thank you for your help!

I managed to solve the issue and hoping that it might help someone else, I’ll document the solution here:
Removing --autologin root from the ExecStart line in /etc/systemd/system/serial-getty@.service.d/override.conf and reloading by running systemctl daemon-reload solved the problem.

Full story

After digging around a little bit I realized that the error message of the failed attempts mentioned /dev/ttyAML0:

Oct 07 00:24:23 nextcloudpi nologin[1233533]: Attempted login by root (UID: 0) on /dev/ttyAML0

I finally realized that the ttyAML0 is started by serial-getty@ttyAML0. So I checked the status of that service (systemctl status serial-getty@ttyAML0 :

serial-getty@ttyAML0.service - Serial Getty on ttyAML0
     Loaded: loaded (/lib/systemd/system/serial-getty@.service; enabled; vendor preset: enabled)
    Drop-In: /usr/lib/systemd/system/serial-getty@.service.d
     Active: active (running) since Sat 2023-10-07 11:29:16 UTC; 6min ago
       Docs: man:agetty(8)
    Process: 1782 ExecStartPre=/bin/sh -c exec /bin/sleep 10 (code=exited, status=0/SUCCESS)
   Main PID: 3102 (agetty)
      Tasks: 1 (limit: 4207)
     Memory: 180.0K
        CPU: 12ms
     CGroup: /system.slice/system-serial\x2dgetty.slice/serial-getty@ttyAML0.service
             └─3102 /sbin/agetty --noissue ttyAML0 linux

I realized that this service is configured by the drop-in file /etc/systemd/system/serial-getty@.service.d/override.conf
So I removed --autologin root from the ExecStart line there:

ExecStart=-/sbin/agetty --noissue %I $TERM

After reloading the unit file systemctl daemon-reload the error is gone.

I haven’t checked yet if I can still login with another user when plugging in a monitor and a keyboard, but at least it does not seem to try to login every 10-12 seconds anymore and does not spam the journal with errors anymore.

Since I consider this a bug I reported it on github: