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:
1 parent
61711e0e6b
commit
7406096b79
1 file changed
+5
-4
@@ -167,11 +167,12 @@ exec /bin/login -f root
|
||||
AUTOLOGIN
|
||||
|
||||
pct exec "$VMID" -- sh -c '
|
||||
# Drop ANY existing getty line for tty1 (Alpine LXC inittab uses an empty
|
||||
# id field: "::respawn:/sbin/getty 38400 tty1"), then add the auto-login
|
||||
# variant with an explicit id so our line wins on any future re-run.
|
||||
# Alpine LXC inittab uses an empty id field: "::respawn:/sbin/getty 38400 tty1".
|
||||
# A non-empty id makes busybox init try to open /dev/<id> as the controlling
|
||||
# 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
|
||||
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.
|
||||
kill -HUP 1 2>/dev/null || true
|
||||
pkill -KILL getty 2>/dev/null || true
|
||||
|
||||
Reference in new issue
Block a user