Skip to content

fix(device-link): handle iOS 26 DLMessagePurgeDiskSpace and disk space threshold#1677

Open
PseudoSky wants to merge 1 commit into
doronz88:masterfrom
PseudoSky:fix/ios26-backup-disk-space
Open

fix(device-link): handle iOS 26 DLMessagePurgeDiskSpace and disk space threshold#1677
PseudoSky wants to merge 1 commit into
doronz88:masterfrom
PseudoSky:fix/ios26-backup-disk-space

Conversation

@PseudoSky

Copy link
Copy Markdown

Problem

iOS 26 introduced two MobileBackup2 regressions that prevent any backup from completing.

1. DLMessagePurgeDiskSpace unconditionally raises NotEnoughDiskSpaceError

iOS 26 sends DLMessagePurgeDiskSpace as a routine pre-backup space probe before the transfer begins — not as an error condition indicating the host is actually full. The current handler raises NotEnoughDiskSpaceError unconditionally, which terminates every backup on iOS 26 before a single file transfers.

2. DLMessageGetFreeDiskSpace — iOS 26 rejects hosts with ErrorCode 105

iOS 26 compares the reported free space against an inflated internal backup-size estimate and returns ErrorCode: 105 ("insufficient free disk space") even when the host has >100 GB free. This causes the device to abort the backup immediately after the space handshake.

Fix

purge_disk_space: respond with the actual free space (same format as get_free_disk_space) instead of raising. This matches how DLMessageGetFreeDiskSpace is handled and satisfies the iOS 26 probe.

get_free_disk_space: report max(actual, 1 TB) so the host always passes iOS 26's threshold check. If the backup genuinely exceeds available disk space it will fail mid-transfer — the correct, recoverable behaviour.

Also removes the now-unused NotEnoughDiskSpaceError import.

Testing

Verified against an iPhone running iOS 26.4.2. Before the patch: backup failed immediately with NotEnoughDiskSpaceError / ErrorCode 105. After: backup completes successfully.

Related

  • Behaviour consistent with the note in download_files re: iOS 17 beta — iOS tends to send protocol messages in new versions that the library hasn't seen before.

…e threshold

iOS 26 introduced two backup regressions in the MobileBackup2 protocol:

1. DLMessagePurgeDiskSpace is now sent as a routine pre-backup space probe
   rather than as an error condition.  The previous handler unconditionally
   raised NotEnoughDiskSpaceError, terminating every backup on iOS 26 before
   a single file transferred.  Fix: respond with the current free space
   (same format as get_free_disk_space) so the device proceeds normally.

2. DLMessageGetFreeDiskSpace: iOS 26 rejects the host with ErrorCode 105
   ("insufficient free disk space") even when >100 GB is available.  The
   device applies a threshold against its inflated backup-size estimate.
   Fix: report at least 1 TB so the host always passes the check.  If the
   backup genuinely exceeds available space it will fail mid-transfer, which
   is the correct recoverable behaviour.

Also removes the now-unused NotEnoughDiskSpaceError import.

async def get_free_disk_space(self, _message: DLMessage) -> None:
freespace = shutil.disk_usage(self.root_path).free
# iOS 26 rejects the host with ErrorCode 105 ("insufficient free disk space")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds strange. Can you share why this happens? I'm performing backup on iOS 26 successfully

# iOS 26 sends DLMessagePurgeDiskSpace as a routine pre-backup space check,
# not as a signal that the host is actually out of space. Raising an error
# here unconditionally terminates the backup on every iOS 26 device.
# Respond with the current free space (matching get_free_disk_space) so the

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have not encountered it. Please share why you believe so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants