fix autologin: use empty-id inittab line so it survives cold restart

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
d4nn13andClaude Opus 4.7 committed 2026-04-23 19:30:24 +02:00
1 parent 61711e0e6b
commit 7406096b79
1 file changed
+5 -4
+5 -4
View File
@@ -167,11 +167,12 @@ exec /bin/login -f root
AUTOLOGIN AUTOLOGIN
pct exec "$VMID" -- sh -c ' pct exec "$VMID" -- sh -c '
# Drop ANY existing getty line for tty1 (Alpine LXC inittab uses an empty # Alpine LXC inittab uses an empty id field: "::respawn:/sbin/getty 38400 tty1".
# id field: "::respawn:/sbin/getty 38400 tty1"), then add the auto-login # A non-empty id makes busybox init try to open /dev/<id> as the controlling
# variant with an explicit id so our line wins on any future re-run. # tty before exec — which fails on cold lxc-start and respawn-throttles the
# line into silent-disabled. Keep the empty-id form so we survive reboots.
sed -i -E "/getty.*tty1$/d" /etc/inittab sed -i -E "/getty.*tty1$/d" /etc/inittab
echo "tty1::respawn:/sbin/getty -n -l /usr/local/sbin/autologin-root 38400 tty1" >> /etc/inittab echo "::respawn:/sbin/getty -n -l /usr/local/sbin/autologin-root 38400 tty1" >> /etc/inittab
# Reload init and kick any running getty so it respawns from the new config. # Reload init and kick any running getty so it respawns from the new config.
kill -HUP 1 2>/dev/null || true kill -HUP 1 2>/dev/null || true
pkill -KILL getty 2>/dev/null || true pkill -KILL getty 2>/dev/null || true