Repository navigation
deploy: daemon holds /dev/ttyUSB0 (CP2104) and then its own flash/esptool open fails with EBUSY #1705
Copy link
Copy link
Closed
Description
fbuild 2.5.43 on Linux (NixOS). Board: classic ESP32 behind a CP2104 (10C4:EA60) on /dev/ttyUSB0.
After several successful fbuild deploy -e <env> -p /dev/ttyUSB0 runs, every later deploy fails. It fails from any project and with or without --monitor:
native write-flash failed (deploy failed: native write: failed to open serial port /dev/ttyUSB0: Device or resource busy); falling back to esptool
A fatal error occurred: Could not open /dev/ttyUSB0, the port is busy or doesn't exist.
- Before the deploy, the port opens and closes cleanly from pyserial.
fbuild port doctorreports it attached and healthy. - While the deploy runs, sampling
/proc/*/fdshows exactly one holder: thefbuild-daemonthat the deploy spawned. Its own native writer and its esptool fallback both then get EBUSY. fbuild daemon clear-locksreports that no daemon is running. Killing the daemon does not help, because the next deploy reproduces the failure.- The daemon log also shows
USB re-enumeration: port /dev/ttyUSB0 not available after 3s, thenport closed client_id="deploy_preemption".
Recent daemon log lines for this port:
2026-10-23T03:47:35.900727Z WARN fbuild_deploy::esp32::deployer: native write-flash failed (deploy failed: native write: failed to open serial port /dev/ttyUSB0: Device or resource busy); falling back to esptool port="/dev/ttyUSB0"
2026-10-23T03:47:35.900759Z INFO fbuild_deploy::esp32::deployer: flashing /home/niteris/.clud/tmp/claude-1000/-home-niteris-dev-fastled/3ac941c0-6dd1-4dc4-b6eb-d30e74e5aea0/scratchpad/hil/.fbuild/build/esp32dev_stock/release/firmware.bin to /dev/ttyUSB0 via e
2026-10-23T03:47:39.800543Z WARN fbuild_deploy: USB re-enumeration: port /dev/ttyUSB0 not available after 3s
2026-10-23T03:48:04.281057Z INFO fbuild_serial::manager: port closed port="/dev/ttyUSB0" client_id="deploy_preemption"
2026-10-23T03:48:04.399900Z INFO fbuild_deploy::esp32::deployer: verifying /home/niteris/.clud/tmp/claude-1000/-home-niteris-dev-fastled/3ac941c0-6dd1-4dc4-b6eb-d30e74e5aea0/scratchpad/hil/.fbuild/build/esp32dev_stock/release/firmware.bin on /dev/ttyUSB0 via
2026-10-23T03:48:04.402670Z WARN fbuild_deploy::esp32::deployer: native verify-flash failed (deploy failed: native verify: failed to open serial port /dev/ttyUSB0: Device or resource busy); falling back to esptool port="/dev/ttyUSB0"
2026-10-23T03:48:04.402747Z INFO fbuild_deploy::esp32::deployer: verifying /home/niteris/.clud/tmp/claude-1000/-home-niteris-dev-fastled/3ac941c0-6dd1-4dc4-b6eb-d30e74e5aea0/scratchpad/hil/.fbuild/build/esp32dev_stock/release/firmware.bin on /dev/ttyUSB0 via
A fatal error occurred: Could not open /dev/ttyUSB0, the port is busy or doesn't exist.
([Errno 16] could not open port /dev/ttyUSB0: [Errno 16] Device or resource busy: '/dev/ttyUSB0')
); proceeding with full flash port="/dev/ttyUSB0"
2026-10-23T03:48:05.756929Z INFO fbuild_deploy::esp32::deployer: flashing /home/niteris/.clud/tmp/claude-1000/-home-niteris-dev-fastled/3ac941c0-6dd1-4dc4-b6eb-d30e74e5aea0/scratchpad/hil/.fbuild/build/esp32dev_stock/release/firmware.bin to /dev/ttyUSB0 via e
2026-10-23T03:48:05.757039Z WARN fbuild_deploy::esp32::deployer: native write-flash failed (deploy failed: native write: failed to open serial port /dev/ttyUSB0: Device or resource busy); falling back to esptool port="/dev/ttyUSB0"
2026-10-23T03:48:05.757071Z INFO fbuild_deploy::esp32::deployer: flashing /home/niteris/.clud/tmp/claude-1000/-home-niteris-dev-fastled/3ac941c0-6dd1-4dc4-b6eb-d30e74e5aea0/scratchpad/hil/.fbuild/build/esp32dev_stock/release/firmware.bin to /dev/ttyUSB0 via e
2026-10-23T03:48:09.874369Z WARN fbuild_deploy: USB re-enumeration: port /dev/ttyUSB0 not available after 3s
2026-10-23T03:48:19.480399Z INFO fbuild_serial::manager: port closed port="/dev/ttyUSB0" client_id="deploy_preemption"
2026-10-23T03:48:19.906416Z INFO fbuild_deploy::esp32::deployer: verifying /home/niteris/.clud/tmp/claude-1000/-home-niteris-dev-fastled/3ac941c0-6dd1-4dc4-b6eb-d30e74e5aea0/scratchpad/hilu/.fbuild/build/esp32dev_stock/release/firmware.bin on /dev/ttyUSB0 via
2026-10-23T03:48:19.906557Z WARN fbuild_deploy::esp32::deployer: native verify-flash failed (deploy failed: native verify: failed to open serial port /dev/ttyUSB0: Device or resource busy); falling back to esptool port="/dev/ttyUSB0"
2026-10-23T03:48:19.906583Z INFO fbuild_deploy::esp32::deployer: verifying /home/niteris/.clud/tmp/claude-1000/-home-niteris-dev-fastled/3ac941c0-6dd1-4dc4-b6eb-d30e74e5aea0/scratchpad/hilu/.fbuild/build/esp32dev_stock/release/firmware.bin on /dev/ttyUSB0 via
A fatal error occurred: Could not open /dev/ttyUSB0, the port is busy or doesn't exist.
([Errno 16] could not open port /dev/ttyUSB0: [Errno 16] Device or resource busy: '/dev/ttyUSB0')
); proceeding with full flash port="/dev/ttyUSB0"
2026-10-23T03:48:20.419048Z INFO fbuild_deploy::esp32::deployer: flashing /home/niteris/.clud/tmp/claude-1000/-home-niteris-dev-fastled/3ac941c0-6dd1-4dc4-b6eb-d30e74e5aea0/scratchpad/hilu/.fbuild/build/esp32dev_stock/release/firmware.bin to /dev/ttyUSB0 via
2026-10-23T03:48:20.419206Z WARN fbuild_deploy::esp32::deployer: native write-flash failed (deploy failed: native write: failed to open serial port /dev/ttyUSB0: Device or resource busy); falling back to esptool port="/dev/ttyUSB0"
2026-10-23T03:48:20.419261Z INFO fbuild_deploy::esp32::deployer: flashing /home/niteris/.clud/tmp/claude-1000/-home-niteris-dev-fastled/3ac941c0-6dd1-4dc4-b6eb-d30e74e5aea0/scratchpad/hilu/.fbuild/build/esp32dev_stock/release/firmware.bin to /dev/ttyUSB0 via
2026-10-23T03:48:23.902882Z WARN fbuild_deploy: USB re-enumeration: port /dev/ttyUSB0 not available after 3s
Found while validating FastLED/FastLED#4911.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
- StatusShow more project fieldsTriage
Activity
zackees commentedon Oct 23, 2026
Correction: a scan of /proc fds finds no user process (fbuild-daemon included) holding /dev/ttyUSB0 when the EBUSY happens. ModemManager (root,
ID_MM_CANDIDATE=1on this CP2104) is the likely holder, so this may be a host udev/ModemManager problem rather than the daemon (see #1653).zackees commentedon Oct 24, 2026
Per the correction above (ModemManager probing the CP2104,
ID_MM_CANDIDATE=1): PR #1712 (fixes #1653) addsENV{ID_MM_DEVICE_IGNORE}="1"to the tty/usb rulesfbuild port udevgenerates, in70-fbuild.rules(before80-mm-candidate.rules). After it lands, reinstall withfbuild port udev --install; on NixOS use theservices.udev.packagesform from #1713/#1654, becauseextraRuleslands in 99-local.rules. If EBUSY persists withID_MM_CANDIDATEno longer set on the device, this is a separate fbuild bug.zackees commentedon Oct 28, 2026
Resolved — closing with host evidence re-verified today.
The follow-up correction on this issue identified ModemManager as the real holder (
ID_MM_CANDIDATE=1on the CP2104), and PR #1712 (fixing #1653) addedENV{ID_MM_DEVICE_IGNORE}="1"to the tty/usb rulesfbuild port udevgenerates, in70-fbuild.rulesso it sorts before80-mm-candidate.rules.Verified on the reporter's host (NixOS, ModemManager active):
/run/udev/rules.d/70-fbuild.rulescarriesENV{ID_MM_DEVICE_IGNORE}="1"for the tty and usb rules of each supported vendor.udevadm info -q all -n /dev/ttyUSB0→ID_MM_DEVICE_IGNORE=1.mmcli -L→No modems were foundeven though ModemManager is running (it no longer takes the board)./dev/ttyUSB0opens and closes cleanly right now (no EBUSY, no holder).If EBUSY ever returns on a device where
ID_MM_CANDIDATEis no longer set, that is a separate fbuild bug — please open a new issue with thefbuild port doctoroutput.— fbuild steward (automated)