From 14fad9a49ebafe54998bb934988657d5177f35fc Mon Sep 17 00:00:00 2001 From: d4nn13 Date: Sun, 19 Apr 2026 19:34:13 +0200 Subject: [PATCH] create-lxc: fix tty1 auto-login regex (Alpine uses empty id field) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous sed pattern required ^tty1::respawn: but Alpine's LXC inittab has no id field — the line is ::respawn:/sbin/getty 38400 tty1. Match any line containing "getty.*tty1$" instead, and pkill getty after the reload so init respawns with the new command. --- proxmox/create-lxc.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/proxmox/create-lxc.sh b/proxmox/create-lxc.sh index ecbb82c..a8bf0dc 100755 --- a/proxmox/create-lxc.sh +++ b/proxmox/create-lxc.sh @@ -142,13 +142,14 @@ exec /bin/login -f root AUTOLOGIN pct exec "$VMID" -- sh -c ' - # Replace the tty1 getty line; if none exists, append one. - if grep -qE "^tty1::" /etc/inittab; then - sed -i "s|^tty1::respawn:.*|tty1::respawn:/sbin/getty -n -l /usr/local/sbin/autologin-root 38400 tty1|" /etc/inittab - else - echo "tty1::respawn:/sbin/getty -n -l /usr/local/sbin/autologin-root 38400 tty1" >> /etc/inittab - fi + # 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. + sed -i -E "/getty.*tty1$/d" /etc/inittab + echo "tty1::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 ' # --- optional: start web UI -------------------------------------------------