fix: use getty auto-login instead of systemd TTY service for first-boot setup

Replaces kiosk-firstboot.service (which got SIGHUP'd by getty) with a
simpler approach: configure getty@tty1 to auto-login root, run kiosk-setup
from .bash_profile. Cleaner TTY ownership — no service/getty conflicts.
install-kiosk.sh now removes the auto-login config and kiosk-setup script
on completion so root doesn't auto-login after the kiosk is running.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 23:36:42 +00:00
parent d3b05f981f
commit 165e77b9b8
2 changed files with 23 additions and 26 deletions
+18 -25
View File
@@ -2,9 +2,8 @@
set -e
# Downloaded and run by the preseed late_command after Debian base install.
# Fetches install-kiosk.sh and installs it as a first-boot setup service.
# The service runs interactively on the first reboot, prompts for name/username,
# then installs the kiosk and reboots into kiosk mode.
# Fetches install-kiosk.sh, configures getty@tty1 to auto-login as root,
# and runs the setup wizard automatically on first reboot.
REPO_BASE="https://gitea.jgitta.com/jgitta/senior-kiosk/raw/branch/master"
@@ -12,30 +11,24 @@ echo "==> SeniorNet: downloading setup script..."
curl -fsSL "$REPO_BASE/install-kiosk.sh" -o /usr/local/bin/kiosk-setup
chmod +x /usr/local/bin/kiosk-setup
echo "==> SeniorNet: installing first-boot service..."
cat > /etc/systemd/system/kiosk-firstboot.service << 'EOF'
[Unit]
Description=SeniorNet Kiosk First-Boot Setup
After=network-online.target
Wants=network-online.target
Conflicts=getty@tty1.service
After=getty@tty1.service
echo "==> SeniorNet: configuring auto-login on TTY1..."
mkdir -p /etc/systemd/system/getty@tty1.service.d
cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << 'EOF'
[Service]
Type=oneshot
ExecStart=/usr/local/bin/kiosk-setup
StandardInput=tty
TTYPath=/dev/tty1
TTYReset=yes
IgnoreSIGPIPE=no
RemainAfterExit=no
[Install]
WantedBy=multi-user.target
ExecStart=
ExecStart=-/sbin/agetty --autologin root --noclear %I $TERM
EOF
systemctl enable kiosk-firstboot
# Boot to text mode for the first-boot wizard, then kiosk setup switches to graphical
echo "==> SeniorNet: configuring setup to run on first login..."
cat >> /root/.bash_profile << 'EOF'
# SeniorNet first-boot setup — runs once then removes itself
if [ -x /usr/local/bin/kiosk-setup ]; then
/usr/local/bin/kiosk-setup
fi
EOF
# Boot to text mode for the setup wizard
systemctl set-default multi-user.target
echo "==> SeniorNet: ready. First-boot setup will run on next reboot."
echo "==> SeniorNet: ready. Setup wizard will run automatically on next reboot."