From edf7db6ee0d3b968d3ea0f12e5f84257a0475d95 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 18 Jun 2025 15:44:27 +0200 Subject: system: show which consoles are automatically added It's particularly complicated to figure which consoles are being added to /etc/inittab without any indication at the moment. Let's simply write them while they're being added. It will greatly help users figure what a login prompt doesn't show up on certain consoles. --- sbin/init.d/system | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sbin/init.d/system b/sbin/init.d/system index a231e62..1ed0734 100755 --- a/sbin/init.d/system +++ b/sbin/init.d/system @@ -154,10 +154,12 @@ function update_consoles { if [ ${use_vt} -ne 0 ] && [ -n "${opt_vt_consoles}" ] && [ "${opt_vt_consoles}" -ge 0 ]; then [ "${opt_vt_consoles}" -lt 64 ] || opt_vt_consoles=63 sed -i -e '/^[^:]*:[^:]*:[^:]*:\([^/]*\/\)*agetty.*\btty[0-9]\+\b/d' /etc/inittab + echo "Adding virtual consoles..." num=1 while [ ${num} -le ${opt_vt_consoles} ]; do name="tty${num}" path="/dev/${name}" + echo -n " $name" if [ ! -e "${path}" ]; then mkdir -p "${path%/*}" mknod c "${path}" 4 ${num} @@ -168,6 +170,7 @@ function update_consoles { ((num++)) touched=1 done + echo fi # Then we'll add all remaining consoles that were passed by the boot @@ -176,11 +179,15 @@ function update_consoles { # optionally have a baud rate after a first colon, and a term type after # the second colon. num=0 + if [ -n "${ser_consoles[*]}" ]; then + echo "Adding virtual consoles..." + fi for name in "${ser_consoles[@]}"; do name="${name}:" spd="${name#*:}"; name="${name%%:*}" term="${spd#*:}"; spd="${spd%%:*}" term="${term%%:*}" + echo -n " $name:$spd:$term" sed -i -e "/^[^:]*:[^:]*:[^:]*:\([^/]*\/\)*agetty.*\b${name##*/}\b/d" /etc/inittab # missing entries in /dev for existing devices will not magically # appear under us so we must create them. Other ones are not a @@ -200,6 +207,9 @@ function update_consoles { ((num++)) touched=1 done + if [ -n "${ser_consoles[*]}" ]; then + echo + fi if [ $touched != 0 ]; then # suppress an eventual /dev/console entry in inittab -- 2.17.5