commaai/openpilot · error · RuntimeError
could not disable USB runtime PM: {control}
Error message
could not disable USB runtime PM: {control} What it means
RuntimeError from disable_runtime_pm() in the chestnut flasher: it writes 'on' to the device's sysfs power/control file but a read-back returns something other than 'on', so runtime power management is still active and could suspend the device mid-flash. The flasher refuses to continue with nondeterministic USB power state.
Source
Thrown at openpilot/system/hardware/chestnut/flash.py:87
pass
if len(found) > 1:
raise RuntimeError(f"expected one chestnut, found {len(found)}")
return found[0] if found else (None, None, None)
def in_rom_bootloader(vid_pid, product):
# the ROM bootloader reports the config page strings, or its own when the config page is lost
return vid_pid in ROM_VID_PIDS or product == ROM_PRODUCT or (product or "").startswith("AS2462")
def disable_runtime_pm(path):
control = os.path.join(path, "power/control")
if not os.path.exists(control):
return
with open(control, "w") as f:
f.write("on\n")
if open(control).read().strip() != "on":
raise RuntimeError(f"could not disable USB runtime PM: {control}")
delay = os.path.join(path, "power/autosuspend_delay_ms")
if os.path.exists(delay):
with open(delay, "w") as f:
f.write("-1\n")
def unbind_drivers(path):
for interface in glob.glob(path + ":*"):
driver = interface + "/driver"
if os.path.islink(driver):
with open(os.path.realpath(driver) + "/unbind", "w") as f:
f.write(os.path.basename(interface))
def open_device(path):
bus, dev = int(open(path + "/busnum").read()), int(open(path + "/devnum").read())
return os.open(f"/dev/bus/usb/{bus:03d}/{dev:03d}", os.O_RDWR)
View on GitHub (pinned to 516ec1e682)
Solutions
- Run the flasher as root (sudo) so sysfs writes take effect
- Check dmesg and /sys/<dev>/power/control manually: echo on, then cat to see whether it sticks
- If in a container, run with /sys mounted rw or flash from the host
Example fix
# before python3 flash.py # as normal user # after sudo python3 flash.py
Defensive patterns
Strategy: try-catch
Validate before calling
import os
def runtime_pm_writable(sysfs_path: str) -> bool:
control = os.path.join(sysfs_path, 'power', 'control')
if not os.path.exists(control):
return True # nothing to disable
return os.access(control, os.W_OK) Try / catch
try:
disable_runtime_pm(sysfs_path)
except RuntimeError as e:
if 'runtime PM' in str(e):
raise RuntimeError('rerun the flasher as root so sysfs power/control writes take effect') from e
raise Prevention
- Run the flasher with sudo/root privileges
- Avoid flashing from containers unless /sys is mounted read-write
When it happens
Trigger: Running the flasher without root (sysfs power files are root-writable, so the write silently fails or is ignored), an unusual kernel/driver that ignores power/control writes, or a read-only sysfs mount.
Common situations: Invoking the flash tool as a normal user instead of sudo, containers without writable /sys, or a kernel where the USB driver does not honor runtime PM control for that interface.
Related errors
- flash did not converge within {FLASH_BUDGET:g}s
- expected one chestnut, found {len(found)}
- Unhandled sparse chunk type
- Raw hash mismatch '{raw_hash.hexdigest().lower()}'
- Uncompressed size mismatch
AI-assisted analysis of commaai/openpilot@516ec1e682 (2026-08-15).
Data as JSON: /api/errors/940cda21d8d02f5b.
Report an issue: GitHub.