Package: release.debian.org
Severity: normal
Tags: buster
User: release.debian....@packages.debian.org
Usertags: pu

Hi folks,

We released buster with a new feature in d-i: support for running d-i
on multiple consoles. This is very useful on some systems (e.g. arm64
machines with both serial console and normal graphical console), but
had an unexpected side-effect: preseeded installations with more than
one console defined would end up trying to run the preseeded d-i on
all the consoles in parallel, with unpredictable behaviour. See
#940028, #932416.

I've added a workaround/fix for this in unstable already, in rootskel
1.132. Here's a debdiff which just cherry-picks that one fix into a
1.131+10u1 for a buster upload. We'd like to fix this for the 10.4
point release.

I've already got kibi's ACK for this.

-- System Information:
Debian Release: 10.3
  APT prefers stable-debug
  APT policy: (500, 'stable-debug'), (500, 'stable'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-6-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru rootskel-1.131/debian/changelog rootskel-1.131+10u1/debian/changelog
--- rootskel-1.131/debian/changelog     2019-06-13 20:28:44.000000000 +0100
+++ rootskel-1.131+10u1/debian/changelog        2020-02-11 16:33:42.000000000 
+0000
@@ -1,3 +1,15 @@
+rootskel (1.131+10u1) buster; urgency=medium
+
+  [ Steve McIntyre ]
+  * Backport fix from unstable:
+    Tweak how multiple consoles are used. If we detect that we're
+    trying to run using preseeding, do *not* run on multiple consoles
+    in parallel as that causes race conditions and weird
+    behaviour. Instead, just run on the "preferred" console. Hopefully
+    Closes: #940028, #932416
+
+ -- Steve McIntyre <93...@debian.org>  Tue, 11 Feb 2020 16:33:54 +0000
+
 rootskel (1.131) unstable; urgency=medium
 
   * Team upload
diff -Nru rootskel-1.131/src/sbin/reopen-console-linux 
rootskel-1.131+10u1/src/sbin/reopen-console-linux
--- rootskel-1.131/src/sbin/reopen-console-linux        2019-06-02 
12:29:14.000000000 +0100
+++ rootskel-1.131+10u1/src/sbin/reopen-console-linux   2020-02-11 
16:28:51.000000000 +0000
@@ -16,6 +16,17 @@
 LOGGER_UP=0
 LOG_FILE=/var/log/reopen-console
 
+# If we're running with preseeding, we have a problem with running d-i
+# on multiple consoles. We'll end up running each of those d-i
+# instances in parallel with all kinds of hilarious undefined
+# behaviour as they trip over each other! If we detect that we're
+# preseeding (via any of the possible preseed methods), DO NOT run d-i
+# multiple times. Instead, fall back to the older, more simple
+# behaviour and run it once. If the user wants to see or interact with
+# their preseed on a specific console, they get to tell us which one
+# they want to use.
+PRESEEDING=0
+
 log() {
        # In very early startup we don't have syslog. Log to file that
        # we can flush out later so we can at least see what happened
@@ -32,6 +43,20 @@
        rm $LOG_FILE
 }
 
+# If we have a preseed.cfg in the initramfs
+if [ -e /preseed.cfg ]; then
+    log "Found /preseed.cfg; falling back to simple mode for preseeding"
+    PRESEEDING=1
+fi
+
+# Have we been told to do preseeding stuff on the boot command line?
+for WORD in auto url; do
+    if (grep -qw "$WORD" /proc/cmdline); then
+       log "Found \"$WORD\" in the command line; falling back to simple mode 
for preseeding"
+       PRESEEDING=1
+    fi
+done
+
 consoles=
 preferred=
 # Retrieve all enabled consoles from kernel; ignore those
@@ -44,7 +69,7 @@
        status=$(echo "$kernelconsoles" | grep $cons | sed -n -r -e 's/(^.*) 
*.*\((.*)\).*$/\2/p' )
        if [ -e "/dev/$cons" ] && [ $(echo "$status" | grep -o 'E') ]; then
                consoles="${consoles:+$consoles$NL}$cons"
-               log "   Adding $cons to consoles list"
+               log "   Adding $cons to possible consoles list"
        fi
        # 'C' console is 'most prefered'.
        if [ $(echo "$status" | grep -o 'C') ]; then
@@ -64,6 +89,13 @@
        log "Found no preferred console. Picking $preferred"
 fi
 
+# If we're preseeding, do simple stuff here (see above). We just
+# want one console. Let's pick the preferred one ONLY
+if [ $PRESEEDING = 1 ]; then
+    log "Running with preseeding. Picking preferred $preferred ONLY"
+    consoles=$preferred
+fi
+
 for cons in $consoles
 do
        echo "/dev/$cons " >> /var/run/console-devices
@@ -88,7 +120,7 @@
 flush_logger
 
 # Finally restart init to run debian-installer on discovered consoles
-log "Restarting init to start d-i on the consoles we found"
+log "Restarting init to start d-i on the console(s) we found"
 kill -HUP 1
 
 exit 0

Reply via email to