Description
I've found the following issue in Fileserver with Proxmox LXC.
The container-getty service restarts every minute and spams the syslog in an endless loop.
To reproduce:
- install
debian-12-turnkey-fileserver_18.0-1_amd64.tar.gz
in Proxmox LXC - finish the initial config
- reboot the container
- wait a few minutes and check the syslog with
journalctl -e
:
Mar 15 17:13:08 filetest systemd[1]: Started container-getty@1.service - Container Getty on /dev/tty1.
Mar 15 17:13:08 filetest inithooks[4551]: [01empty] skipping
Mar 15 17:13:08 filetest inithooks[4552]: Inithook run completed, exiting.
Mar 15 17:14:08 filetest systemd[1]: container-getty@1.service: Deactivated successfully.
Mar 15 17:14:08 filetest systemd[1]: container-getty@1.service: Scheduled restart job, restart counter is at 102.
Mar 15 17:14:08 filetest systemd[1]: Stopped container-getty@1.service - Container Getty on /dev/tty1.
Mar 15 17:14:08 filetest systemd[1]: Started container-getty@1.service - Container Getty on /dev/tty1.
Mar 15 17:14:08 filetest inithooks[4587]: [01empty] skipping
Mar 15 17:14:08 filetest inithooks[4588]: Inithook run completed, exiting.
Mar 15 17:15:08 filetest systemd[1]: container-getty@1.service: Deactivated successfully.
Mar 15 17:15:08 filetest systemd[1]: container-getty@1.service: Scheduled restart job, restart counter is at 103.
Mar 15 17:15:08 filetest systemd[1]: Stopped container-getty@1.service - Container Getty on /dev/tty1.
Mar 15 17:15:08 filetest systemd[1]: Started container-getty@1.service - Container Getty on /dev/tty1.
Mar 15 17:15:08 filetest inithooks[4623]: [01empty] skipping
Mar 15 17:15:08 filetest inithooks[4624]: Inithook run completed, exiting.
Mar 15 17:16:08 filetest systemd[1]: container-getty@1.service: Deactivated successfully.
Mar 15 17:16:08 filetest systemd[1]: container-getty@1.service: Scheduled restart job, restart counter is at 104.
Mar 15 17:16:08 filetest systemd[1]: Stopped container-getty@1.service - Container Getty on /dev/tty1.
Mar 15 17:16:08 filetest systemd[1]: Started container-getty@1.service - Container Getty on /dev/tty1.
Mar 15 17:16:08 filetest inithooks[4659]: [01empty] skipping
Mar 15 17:16:08 filetest inithooks[4660]: Inithook run completed, exiting.
Mar 15 17:17:08 filetest systemd[1]: container-getty@1.service: Deactivated successfully.
root@filetest ~# turnkey-version
turnkey-fileserver-18.0-bookworm-amd64
The systemd service definition is the following:
root@filetest ~# systemctl cat container-getty@1.service
# /lib/systemd/system/container-getty@.service
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Container Getty on /dev/tty%I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=man:machinectl(1)
After=systemd-user-sessions.service plymouth-quit-wait.service
After=rc-local.service getty-pre.target
Before=getty.target
IgnoreOnIsolate=yes
ConditionPathExists=/dev/tty%I
# IgnoreOnIsolate is an issue: when someone isolates rescue.target,
# tradition expects that we shut down all but the main console.
Conflicts=rescue.service
Before=rescue.service
[Service]
# The '-o' option value tells agetty to replace 'login' arguments with an option to preserve environment (-p),
# followed by '--' for safety, and then the entered username.
ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear - $TERM
Type=idle
Restart=always
RestartSec=0
UtmpIdentifier=tty%I
StandardInput=tty
StandardOutput=tty
TTYPath=/dev/tty%I
TTYReset=yes
TTYVHangup=yes
IgnoreSIGPIPE=no
SendSIGHUP=yes
# /etc/systemd/system/container-getty@1.service.d/10-container-getty-tkl-login.conf
[Service]
EnvironmentFile=
EnvironmentFile=/etc/default/inithooks
ExecStart=
ExecStart=-/sbin/agetty -n -l /bin/bash -o "/usr/lib/inithooks/bin/login_script.sh" --noclear --keep-baud pts/%I 115200,38400,9600 $TERM
The default agetty process is changed by the inithook from
-/sbin/agetty -o '-p -- \\u' --noclear - $TERM
to
-/sbin/agetty -n -l /bin/bash -o "/usr/lib/inithooks/bin/login_script.sh" --noclear --keep-baud pts/%I 115200,38400,9600 $TERM
The service is defined with Restart=always
so as soon as the process finishes, systemd restarts the service.
The login_script.sh
calls the login
program.
root@filetest ~# cat /usr/lib/inithooks/bin/login_script.sh
#!/bin/bash
. /etc/default/inithooks
${INITHOOKS_PATH}/run
clear
echo -en "\nDebian GNU/Linux $(lsb_release -rs) $(hostname) tty1\n\n"
login -p
The login
waits for LOGIN_TIMEOUT seconds defined in /etc/login.defs
.
#
# Max time in seconds for login
#
LOGIN_TIMEOUT 60
After 60 seconds, the login process exits, and the sytemd restarts the service. And it is happening forever while the container is running.