Skip to content

Commit 7487439

Browse files
authored
fix: rpi_boot.update_firmware: ensure /tmp folder exists when doing flash-kernel (#499)
Forward port the fix in #498 to main branch.
1 parent 5100333 commit 7487439

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/otaclient/boot_control/_rpi_boot.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,13 @@ def _prepare_flash_kernel(target_slot_mp: StrOrPath) -> Generator[None, Any, Non
296296
sys_mp = target_slot_mp / "sys"
297297
mounts[str(sys_mp)] = "/sys"
298298

299+
# NOTE(20250314): ensure that tmp folder exists on standby slot
300+
_tmp_on_standby = target_slot_mp / "tmp"
301+
# also handle the case when /tmp is a symlink
302+
if _tmp_on_standby.is_symlink():
303+
_tmp_on_standby = _tmp_on_standby.resolve()
304+
_tmp_on_standby.mkdir(exist_ok=True, parents=True)
305+
299306
try:
300307
for _mp, _src in mounts.items():
301308
cmdhelper.mount(
@@ -329,6 +336,7 @@ def update_firmware(self, *, target_slot: SlotID, target_slot_mp: StrOrPath):
329336
# must set this env variable to make flash-kernel work under chroot
330337
env={"FK_FORCE": "yes"},
331338
)
339+
logger.info("flash-kernel succeeded!")
332340
os.sync()
333341
except subprocess.CalledProcessError as e:
334342
_err_msg = f"flash-kernel failed: {e!r}\nstderr: {e.stderr.decode()}\nstdout: {e.stdout.decode()}"

0 commit comments

Comments
 (0)