[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#279213: No 2nd stage after installation with netinst CD using network-console



I have created patches for both prebaseconfig and network-console.
The main fixes are in this patch for prebaseconfig.
See #279090 for the patch for network-console.

The patches can be uploaded independently.

I have tested both patches in 4 actual installations:
- netinst without network-console (no change)
  => base-config is run on console
- businesscard with network console (no change)
  => base-config is _not_ run on console, but _is_ run on login over SSH
- netinst with network-console (bug fixed)
  => base-config is now run on console, previously base-config was not
     run at all (here network-console-config fails to install)
- netinst with network-console but _without_ actually logging in over SSH
  to continue the installation
  => base-config is run on console

Although this patch may look invasive, the changes are actually minor.
Attached is the diff with all whitespace changes ignored, which gives a 
better idea of the changes than a diff from svn.

--- 90prepare-base-config	2004-11-01 01:30:04.000000000 +0100
+++ 90prepare-base-config.new	2004-11-01 01:29:53.000000000 +0100
@@ -3,6 +3,11 @@
 # Prepare to run base-config after reboot
 set -e
 
+log() {
+    logger -t prebaseconfig "$@"
+}
+
+config_dbootstrap () {
 # Only here for woody installs (ie, skolelinux)
 . /usr/share/debconf/confmodule
 if db_get mirror/suite && [ "$RET" ] ; then
@@ -12,18 +17,38 @@
     echo "# inserted by prebaseconfig"
     echo "SUITE=\"$SUITE\""
 ) >> /target/root/dbootstrap_settings
+}
 
+test_ssh_install () {
+    if [ "$TERM_TYPE" != network ] ; then
+        return 1
+    fi
+    # Check if network-console-config has been installed
+    if chroot /target dpkg -l network-console-config 2>/dev/null | grep "^ii" ; then
+        return 0
+    else
+        return 1
+    fi
+}
+
+config_inittab () {
 # Since this script is running with debconf, 'tty' does
 # not give reliable answers about what sort of terminal
 # we have.  The stdin of /sbin/debian-installer seems
 # to tell the truth.
-rawconsole=$(readlink /proc/$(pidof debian-installer)/fd/0)
+
+    # If the installation is run using network-console (over ssh),
+    # there can be two debian-installer processes; only use the first.
+
+    inst_pid=$(pidof debian-installer | cut -d" " -f1)
+    rawconsole=$(readlink /proc/${inst_pid}/fd/0)
 console=$(mapdevfs "$rawconsole")
 rawconsole=${rawconsole#/dev/}
 console=${console#/dev/}
 
 case "$console" in
 ttyS*)
+        log "Configuring /etc/inittab to run base-config for serial console"
     ttyspeed=$(chroot /target stty --file /dev/$console speed)
     ttyline=${console#ttyS}
     ttyterm="$TERM"
@@ -44,12 +69,15 @@
 	/usr/share/prebaseconfig/inittab > /target/etc/inittab
 ;;
 *)
+        log "Configuring /etc/inittab to run base-config for regular console"
     mv /target/etc/inittab /target/etc/inittab.real
     sed -e "s#CONSOLEDEV#/dev/$console#g" /usr/share/prebaseconfig/inittab \
         > /target/etc/inittab
 ;;
 esac
+}
 
+create_cd_link () {
 # Set up /dev/cdrom link to point to the device used for /media/cdrom0 in
 # /target; various programs including base-config want a /dev/cdrom.
 CDDEV=$(grep "[[:space:]]/media/cdrom0[[:space:]]" /target/etc/fstab | cut -d ' ' -f 1) || true
@@ -63,3 +91,20 @@
 	chown 0:24 /target$CDDEV || true
 	ln -sf "$CDDEV" /target/dev/cdrom
 fi
+}
+
+## MAINLINE
+config_dbootstrap
+
+if test_ssh_install ; then
+    # Note: this test fixes #279090
+    # Maybe the configuration of /etc/inittab for serial console is
+    # something that _should_ be done in this situation (without
+    # starting base-config); but as it was not done in the old
+    # situation, we leave /etc/inittab as is.
+    log "Network installation: not configuring /etc/inittab to run base-config after reboot"
+else
+    config_inittab
+fi
+
+create_cd_link

Reply to: