Repository navigation
Description
Symptom
Nightly Platforms (2026-08-21, run 32466862619) and 5 board build-matrix jobs (ESP32-P4/H2/C5/C3/C6/C2) fail at the elf2image step:
build error: build failed: selected esptool executable could not be launched — cannot convert firmware.elf to firmware.bin.
executable: /home/runner/.fbuild/prod/cache/toolchains/tasmota-esptool/8eef29399855b7a6/5.3.0/esptool-linux-amd64/esptool
Error: failed to spawn [...]: No such file or directory (os error 2)
The binary was verified runnable (esptool version spawn OK) during package resolution ~65 s earlier in the same build.
Root cause
PackageBase::staged_install early-returns when install_path.exists() without bumping the DiskCache LRU timestamp — unlike is_cached(), whose contract is explicitly "on a cache hit, bumps the LRU timestamp in the DiskCache index".
Esptool::ensure_installed (#954) takes exactly that path on a warm cache: remove_invalid_cached_install → staged_install → early return. So a cache-restored esptool install keeps the last_used_at from whenever it was originally installed.
Then the daemon's background GC (fbuild-daemon/src/main.rs: first pass 60 s after daemon start, then every 5 min) evicts LRU-first (lru_installed_entries orders by last_used_at ASC) once installed_bytes > installed_budget. Budgets auto-scale to disk: 5% of total disk per phase, so a GitHub runner (~72 GB) gets an ~3.6–4.2 GB installed budget. The Actions-restored toolchain cache plus the freshly extracted ~1.5 GB GCC toolchain exceeds it, and the stale-LRU esptool entry is the first thing deleted — mid-build, between provisioning and elf2image.
Timeline from run 96725838930 (ESP32-P4):
| t | event |
|---|---|
| 09:25:02 | build starts; daemon starts |
| 09:25:12–22 | GCC toolchain download+extract (~1.5 GB fresh install) |
| ~09:25:15 | esptool warm hit → selected + verified, no LRU touch |
| ~09:26:05 | daemon's first background GC pass fires (start+60 s); over budget → evicts esptool (oldest last_used_at) |
| 09:26:28 | firmware.elf linked |
| 09:26:29 | elf2image → ENOENT |
Intermittent by nature: needs restored-cache-over-budget + GC firing inside the provision→elf2image window + esptool older than other entries.
Fix
Treat an existing-install hit in staged_install as a use: call the same LRU touch is_cached() performs on both early-return paths. That makes a warm esptool hit the last eviction candidate instead of the first. Regression test asserts last_used_at advances after a warm staged_install call.
Follow-ups (not required for this fix)
- The GC doc comment says "skip pinned/leased" but
run_gcnever consults lease state, and nothing takes a lease for the duration of a build. A real pin/lease held while a build holds a validated path would close the whole class (including over-budget pressure evicting recently-touched entries). reconcile()Phase 1 deletes indexed installs with missing.install_completesentinels without any lease check either.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriage
Activity
fix(packages): count warm staged_install hits as LRU use (#1342)
feat(disk): release a pre-committed reserve when a build hits ENOSPC (#…