0

I'm doing a preseeded installation that involves displaying debconf INFO messages right inside the debian installer. At the end of the late_command, I'm expecting the system to eject the installation cdrom, and reboot my instance. The problem is that instead of behaving this way, it gets back to the debian installer menu, and to finish the installation process it leaves me only the option to manually shutdown and to boot from the disk in order to eject the installation cdrom.

It's important to precise that this unexpected behavior only appeared when I started using debconf INFO messages (it was working as expected before, so the preseed.cfg is normally properly configured), it's thus directly related to it.

Below are the following : My late_command part, the script that is launched by the late_command which involves debconf, the syslog when the installation finishes,es and the screen in which I'm led back.

late_command :

d-i preseed/late_command string \
cp -rf /cdrom/build /target/home/device; \
/bin/sh /target/home/machine/build/deployment-preseed-track.sh; \
chmod +x /target/home/machine/build/deployment-preseed.sh; \
in-target --pass-stdout ./home/machine/build/deployment-preseed.sh > /target/var/log/installation.log; \
in-target rm -rf /home/machine/build;

deployment-preseed-track.sh (It basically scans lively the log to detect the deployment progress)

#!/bin/sh

. /usr/share/debconf/confmodule
. "/home/machine/build/variables.sh"

logFile="/target${INSTALLATION_LOG_LOCATION}"
templatePath="/target/tmp/deployment_progress_tracker.templates"

cat > "${templatePath}" << 'EOF'
Template: deployment_progress_tracker/progress/fallback
Type: text
Description: ${STEP}...
EOF

debconf-loadtemplate deployment_progress_tracker "${templatePath}"
db_progress START 0 1 deployment_progress_tracker/progress

watchLogs () {
  deploymentDone=false
  while ! $deploymentDone
  do
    if [ -f "${logFile}" ]; then
      step=$(grep -E -o -a -h "Progress-step: .*" "${logFile}" | tail -1 | sed 's/Progress-step: //')
      if [ -z "${step##*$DEPLOYMENT_FINISHED*}" ]; then
        deploymentDone=true
      elif [ -n "${step}" ]; then
        db_subst deployment_progress_tracker/progress/fallback STEP "${step}"
        db_progress INFO deployment_progress_tracker/progress/fallback
      fi
    fi
    sleep 3
  done
}

syslog

leading back to this screen

1 Answer 1

0

I will reply to myself after days of failed attempts.

Debconf was not the culprit. What happened was the way I was orchestrating the scripts calls (tracker in background and deployment script in foreground) was giving no chance to debian installer to kill the background script in a clean, expected way. As soon as the deployment script was inconsistently killed or not killed, leading to a successful or a failing deployment, randomly.

I've had a hard time trying to play with debconf before understanding what was happening, but since I finally got it, this is what I ended up with to make it work seamlessly, every time.

Instead of launching the deployment script deployment-preseed.sh as a foreground process and the tracker deployment-preseed-track.sh as a background process, I did the exact opposition, ie: deployment-preseed-track.sh as a foreground process, and deployment-preseed.sh as a background process.

I accordingly updated the late_command :

d-i preseed/late_command string \
cp -rf /cdrom/build /target/home/device; \
chmod +x /target/home/machine/build/deployment-preseed.sh; \
(in-target --pass-stdout ./home/machine/build/deployment-preseed.sh > /target/var/log/installation.log &); \
/bin/sh /target/home/machine/build/deployment-preseed-track.sh; \
in-target rm -rf /home/machine/build;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .