libimobiledevice / idevicerestore

Restore/upgrade firmware of iOS devices
https://libimobiledevice.org
GNU Lesser General Public License v3.0
1.25k stars 387 forks source link

APFS Image Inversion Error During iPad Restore #656

Open Leon-cam opened 1 week ago

Leon-cam commented 1 week ago

Description

I encountered an issue while attempting to restore an iPad using the idevicerestore tool. The process fails at the step involving the inversion of the APFS image.

Environment

Steps to Reproduce

  1. Connect the iPad in Recovery mode.
  2. Run the idevicerestore command with the appropriate IPSW file.
  3. Observe the process fail with the error related to inverting the APFS image.

Log Output

Below is an excerpt from the log file where the error occurs: Checkpoint FAILURE id: 0x6B4 result=1101: [0]D(failed to invert APFS image) Checkpoint FAILURE id: 0x67B result=1101: [0]D(failed to invert APFS image)

The complete log file is attached. complete_restore_ios_log.txt

Additional Information

Leon-cam commented 1 week ago

Description

This issue was changed after updating the following dependencies from master branches :

Errors:

Tag found Unhandled progress operation 55 (55) restore_handle_data_request_msg: type = FUDData restore_handle_data_request_msg: type = FUDData Tag found ERROR: Unable to send data to ASR. Sent 0 of 131092 bytes. Unable to send filesystem payload chunk, retrying... ERROR: Unable to send data to ASR. Sent 0 of 131092 bytes. Unable to send filesystem payload chunk, retrying... ERROR: Unable to send data to ASR. Sent 0 of 131092 bytes. Unable to send filesystem payload chunk, retrying... ERROR: Unable to send data to ASR. Sent 0 of 131092 bytes. Unable to send filesystem payload chunk, retrying... ERROR: Unable to send payload to ASR ERROR: Unable to send filesystem ERROR: Unable to restore device

Log Output

The complete log file is attached. restore_ipad_log.txt

Leon-cam commented 1 week ago

After making a few tweaks in the code and running idevicerestore with an administrative user on Windows, I encountered the following error:

Debug: restore_handle_data_request_msg: type = FUDData info: Extracting 092-64485-001.dmg.mtree (Firmware/092-64485-001.dmg.mtree)... info: Personalizing IMG4 component Ap,SystemVolumeCanonicalMetadata... debug: Tag found info: Sending IsFUDFirmware for Ap,SystemVolumeCanonicalMetadata... [libusbmuxd] usbmuxd_send: Error 1 when sending: Operation not permitted error: ERROR[-2]: Unable to send data to ASR. Sent 0 of 131092 bytes. error: Unable to send filesystem payload chunk, retrying... [libusbmuxd] usbmuxd_send: Error 1 when sending: Operation not permitted error: ERROR[-2]: Unable to send data to ASR. Sent 0 of 131092 bytes. error: Unable to send filesystem payload chunk, retrying... [libusbmuxd] usbmuxd_send: Error 1 when sending: Operation not permitted error: ERROR[-2]: Unable to send data to ASR. Sent 0 of 131092 bytes. error: Unable to send filesystem payload chunk, retrying... [libusbmuxd] usbmuxd_send: Error 1 when sending: Operation not permitted error: ERROR[-2]: Unable to send data to ASR. Sent 0 of 131092 bytes. error: Unable to send filesystem payload chunk, retrying... error: ERROR: Unable to send payload to ASR error: ERROR: Unable to send filesystem

ERROR -2 means IDEVICE_E_UNKNOWN_ERROR

nikias commented 1 week ago

Question, have you only tried with the compressed ipsw file? Try if it works with a fully extracted ipsw, just pass the path to the directory with all the files in it to idevicerestore as ipsw "file".

Leon-cam commented 6 days ago

Yes, previously I only tried with the compressed IPSW file. After specifying the unzipped directory, it successfully went through the restoring process. Many thanks for your information.

nikias commented 6 days ago

I pushed a fix to master. It was a concurrency issue with zip file access.

adventurousAardvark commented 5 days ago

Hi @nikias thanks for applying the fix. Do you know if this patch is universal? Unfortunately, I am having the same issue with Mac mini (M1) after patch.

I have tried both the compressed ipsw file and the extracted "ipsw" directory.

IPSW file version: UniversalMac_15.0_24A5279h_Restore.ipsw

Mac mini M1 running Ventura.

Do you have any other suggestions on how to remedy this issue?

<dict>
    <key>Command</key>
    <string>Payload</string>
</dict>
</plist>
Filesystem validated
Sending filesystem now...
Restoring image (13)
ERROR: Unable to send data to ASR. Sent 130912 of 131072 bytes.
Unable to send filesystem payload chunk, retrying...
ERROR: Unable to send data to ASR. Sent 0 of 131072 bytes.
Unable to send filesystem payload chunk, retrying...
ERROR: Unable to send data to ASR. Sent 0 of 131072 bytes.
Unable to send filesystem payload chunk, retrying...
ERROR: Unable to send data to ASR. Sent 0 of 131072 bytes.
Unable to send filesystem payload chunk, retrying...
ERROR: Unable to send payload to ASR
ERROR: Unable to send filesystem
Checkpoint completed id: 0x675 (init_gigalocker) result=0
ReverseProxy[Ctrl]: Terminating
ReverseProxy[Ctrl]: (status=2) Terminated
ERROR: Unable to restore device

Thank you!

Leon-cam commented 4 days ago

Thanks, @nikias! It’s working now without the need to unzip the file beforehand.