fix(device-link): handle iOS 26 DLMessagePurgeDiskSpace and disk space threshold#1677
Open
PseudoSky wants to merge 1 commit into
Open
fix(device-link): handle iOS 26 DLMessagePurgeDiskSpace and disk space threshold#1677PseudoSky wants to merge 1 commit into
PseudoSky wants to merge 1 commit into
Conversation
…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.
doronz88
requested changes
May 12, 2026
|
|
||
| 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") |
Owner
There was a problem hiding this comment.
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 |
Owner
There was a problem hiding this comment.
Have not encountered it. Please share why you believe so
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
iOS 26 introduced two MobileBackup2 regressions that prevent any backup from completing.
1.
DLMessagePurgeDiskSpaceunconditionally raisesNotEnoughDiskSpaceErroriOS 26 sends
DLMessagePurgeDiskSpaceas a routine pre-backup space probe before the transfer begins — not as an error condition indicating the host is actually full. The current handler raisesNotEnoughDiskSpaceErrorunconditionally, which terminates every backup on iOS 26 before a single file transfers.2.
DLMessageGetFreeDiskSpace— iOS 26 rejects hosts with ErrorCode 105iOS 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 asget_free_disk_space) instead of raising. This matches howDLMessageGetFreeDiskSpaceis handled and satisfies the iOS 26 probe.get_free_disk_space: reportmax(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
NotEnoughDiskSpaceErrorimport.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
download_filesre: iOS 17 beta — iOS tends to send protocol messages in new versions that the library hasn't seen before.