diff --git a/otaclient/app/ota_client.py b/otaclient/app/ota_client.py index 27ef12fcd..eb3f144d8 100644 --- a/otaclient/app/ota_client.py +++ b/otaclient/app/ota_client.py @@ -310,13 +310,19 @@ def _process_persistents(self): # NOTE(20240220): fast fix for handling swapfile if str(_per_fpath) in ["/swapfile", "/swap.img"]: - _new_swapfile = standby_slot_mp / _per_fpath + # NOTE: here we probe the current running system's swapfile at /. + if not _per_fpath.is_file(): + continue + + _new_swapfile = standby_slot_mp / _per_fpath.relative_to("/") try: _swapfile_size = get_file_size(_per_fpath, units="MiB") assert _swapfile_size is not None, f"{_per_fpath} doesn't exist" create_swapfile(_new_swapfile, _swapfile_size) except Exception as e: - logger.warning(f"failed to create {_per_fpath}, skip: {e!r}") + logger.warning( + f"failed to create swapfile {_per_fpath} to standby slot, skip: {e!r}" + ) continue if (