Skip to content

os: 1bit-install shows the whole install - a step per line, with progress, logs and a countdown (#710) - #725

Merged
bong-water-water-bong merged 1 commit into
osv2/706-grow-datafrom
osv2/710-install-progress
Nov 1, 2026
Merged

bong-water-water-bong merged 1 commit into
osv2/706-grow-datafrom
osv2/710-install-progress

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Fixes #710. The installer printed a partition plan and then worked mostly silently.

Every step is now on the screen from the start and flips pending -> running -> done with its elapsed time
(target disk, partition table, ESP, data partition, boot files, their sha256 read back from the disk, the /data
copy, .installed + keys, final verification). The data copy shows MB/total, MB/s and an ETA; the failure path
stops on the failing step with the command's own output. Every line also goes to ttyS0 (the QEMU install gate
reads it) and to /data/install.log on the stick and on the new disk. The machine reboots into the installed
system after a 10 s countdown, unless 1BIT_INSTALL_NO_REBOOT=1 (which the gate sets).
PR-READY.

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 6b755e1)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

710 - Partially compliant

Compliant requirements:

  • Full-screen install view with step-by-step progress on tty1
  • All steps show pending -> running -> done with elapsed time
  • Progress tracking for data copy with MB/s and ETA
  • Logs written to both stick and new disk, and to ttyS0
  • Error handling stops at failing step with command output
  • Install complete screen with 10s countdown and reboot

Non-compliant requirements:

  • None

Requires further human verification:

  • Visual confirmation of the install screen appearance and behavior on actual hardware
  • Verification that all steps are properly logged to both locations
  • Confirmation that the countdown and reboot behavior works correctly in a real environment
⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Potential race condition in step tracking

The installer uses a temporary file (/tmp/install-steps) to track step states, but there's no explicit locking mechanism. If multiple processes or threads were to access this file simultaneously (which is unlikely in this single-threaded script but worth noting), it could lead to race conditions where step states are not properly updated. The script relies on sequential execution and file I/O, but in a high-concurrency environment, this could be a concern.

STEPS=/tmp/install-steps
STEP_TOTAL=0
STEP_T0=0

log() { echo "$*" >> "$LOG" 2>/dev/null; [ -w /dev/ttyS0 ] && echo "$*" > /dev/ttyS0 2>/dev/null; return 0; }
screen() { [ -w "$SCREEN" ] && printf '%s\n' "$*" > "$SCREEN" 2>/dev/null; return 0; }

steps_add() {   # <title>: a pending step, drawn on the screen below the header
    STEP_TOTAL=$((STEP_TOTAL + 1))
    echo "$STEP_TOTAL|pending|$1" >> "$STEPS"
}
Incomplete error handling for copy_tree function

The copy_tree function does not handle cases where find commands fail or produce unexpected output. If /tmp/install-dirs or /tmp/install-files are not properly created or contain invalid data, the loop could behave unexpectedly. While the function has a fail call on copy failure, it doesn't explicitly check for errors in the find operations themselves.

copy_tree() {       # <n> <src-dir> <dst-dir>: copy a tree, showing MB copied / total, MB/s and ETA
    cp_n=$1; cp_src=$2; cp_dst=$3
    cp_total=$(du -sb "$cp_src" 2>/dev/null | cut -f1); cp_total=${cp_total:-0}
    cp_tmb=$((cp_total / 1048576))
    cp_t0=$(date +%s); cp_done=0; cp_rate=0
    find "$cp_src" -type d > /tmp/install-dirs 2>/dev/null
    while IFS= read -r d; do
        mkdir -p "$cp_dst/${d#"$cp_src"}" || fail "$cp_n" "cannot create $cp_dst/${d#"$cp_src"}"
    done < /tmp/install-dirs
    find "$cp_src" \( -type f -o -type l \) > /tmp/install-files 2>/dev/null
    while IFS= read -r f; do
        rel=${f#"$cp_src"/}
        cp -a "$f" "$cp_dst/$rel" 2>>/tmp/install-step.log || fail "$cp_n" "copying $rel failed"
        [ -L "$f" ] || cp_done=$((cp_done + $(stat -c %s "$cp_dst/$rel" 2>/dev/null || echo 0)))
        el=$(( $(date +%s) - cp_t0 )); [ "$el" -lt 1 ] && el=1
        cp_mb=$((cp_done / 1048576))
        cp_rate=$((cp_mb / el))
        if [ "$cp_rate" -gt 0 ]; then cp_eta=$(( (cp_tmb - cp_mb) / cp_rate ))s; else cp_eta=unknown; fi
        step_line "$cp_n" "[..]" "copying $cp_src -> $cp_dst: ${cp_mb}/${cp_tmb} MB, ${cp_rate} MB/s, ETA $cp_eta"
    done < /tmp/install-files
    rm -f /tmp/install-dirs /tmp/install-files
    cp_summary="$cp_mb MB, ${cp_rate} MB/s"
}
Potential issue with step_end function when step_state is not OK or FAILED

The step_end function assumes that the second argument is either "OK" or "FAILED". If a different value is passed, it will be treated as "OK", which could lead to incorrect logging or display. While this is unlikely given the current usage, it's a potential source of incorrect behavior if the function is reused elsewhere.

step_end() {    # <n> [OK|FAILED] [extra]
    step_state=OK
    [ "$#" -ge 2 ] && step_state=$2
    step_extra=
    [ "$#" -ge 3 ] && step_extra=$3
    step_title=$(sed -n "s/^$1|running|//p" "$STEPS")
    sed -i "s/^$1|running|/$1|$step_state|/" "$STEPS"
    el=$(( $(date +%s) - STEP_T0 ))
    if [ "$step_state" = OK ]; then
        step_line "$1" "[ok]" "$step_title  (${el}s${step_extra:+ $step_extra})"
        log "  [$1] done in ${el}s: $step_title${step_extra:+ $step_extra}"
    else
        step_line "$1" "[!!]" "$step_title  (${el}s)"
        log "  [$1] FAILED after ${el}s: $step_title"
    fi
}

…ress, logs and a countdown (#710)

Every step is on the screen from the start and flips pending -> running -> done with its elapsed time;
the data copy reports MB/total, MB/s and an ETA; the boot files are read back from the disk and sha256'd
against the source; the failure path stops on the step with the command's own output. Every line also goes
to ttyS0 (the QEMU install gate reads it) and to /data/install.log on the stick and on the new disk. The
machine reboots into the installed system after a countdown, unless 1BIT_INSTALL_NO_REBOOT=1.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY

At d6f220fb (os/mini/install.sh +251 −33, os/mini/vmtest.sh +4 −2). The gate contract is what I checked first, since this rewrites the install screen.

The QEMU install gate still works against this installer. Three things it depends on:

  • vmtest.sh now calls 1BIT_INSTALL_NO_REBOOT=1 1bit-install … because the installer reboots itself when done — and install.sh:366 honours exactly that variable (if [ "${1BIT_INSTALL_NO_REBOOT:-0}" = 1 ] || [ ! -e "$SCREEN" ]), so a scripted run cannot restart the VM before the gate reads the installed disk. It also skips the reboot when there is no console at all, which covers the same case from the other side.
  • the success line the gate matches is unchanged: install.sh:356 still prints 1bit OS is installed on $DEV. on stdout (the ssh_vm capture), and :362 additionally sends install complete: 1bit OS is installed on $DEV (…) through log().
  • log() writes to /data/install.log and /dev/ttyS0 (line 130), which is the transcript the gates read, so the step lines land where the existing greps look.

INSTALLED appears in this diff only in comments — the string the install gate greps for is printed by the installed boot in init.sh, not here, so its absence from the new screen is correct rather than a dropped marker.

bash -n clean on both files. The screen itself (steps_add/step/failure trap, one line per step with elapsed time, same lines to ttyS0 and the log, stop on the failing step with the command's own output) is the right shape for "give the client visual feedback of the entire install", and the failure path is the important one: it prints the failing command's output rather than exiting bare.

Not verified: the screen's behaviour — repaint, spacing on a real VT, the countdown before reboot — needs the QEMU install gate, which I am not starting while another lane's VM is live on this box. What I could verify statically is the part that would break the gate, and it is intact.

tprs-ready applied; stack note as with its neighbours (#719/#720 still carry this stack).

@bong-water-water-bong bong-water-water-bong added the tprs-ready TPRS: review verdict READY posted by the standing reviewer; merge gate satisfied label Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Persistent review updated to latest commit 6b755e1

@bong-water-water-bong
bong-water-water-bong merged commit b140507 into osv2/706-grow-data Nov 1, 2026
5 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the osv2/710-install-progress branch November 1, 2026 03:57

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY

At 6b755e1, rebased after the merges ahead of it. The author patch is byte-identical to the head I reviewed (d6f220fb) — patch-id from the merge base is the same before and after — so my review stands without re-reading: only main arrived in the rebase.

Nothing new to verify. Everything in my earlier verdict on this PR applies at this head unchanged, including what I noted as not-verified-by-me there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review effort 4/5 tprs-ready TPRS: review verdict READY posted by the standing reviewer; merge gate satisfied

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant