libimobiledevice / idevicerestore

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

Cannot flash macOS sequoia IPSW #662

Closed ey3ball closed 1 month ago

ey3ball commented 2 months ago

Using the following invocation:

/opt/idevice/bin/idevicerestore -P -d -ey /images/UniversalMac_15.0_24A5298h_Restore.ipsw

The restore process fails during the filesystem upload with the following sequence:

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 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
ERROR: Unable to restore device

This is with :

Full logs (idevicerestore in debug mode & usbmuxd) attached below : macos15.beta.log usbmuxd.log

julienkrijnen8 commented 2 months ago

Met vriendelijke groet,ok

Julien Krijnen

@.***

Op vr 2 aug 2024 om 14:30 schreef Florian Vallee @.***>:

Using the following invocation:

/opt/idevice/bin/idevicerestore -P -d -ey /images/UniversalMac_15.0_24A5298h_Restore.ipsw

The restore process fails during the filesystem upload with the following sequence:

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 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 ERROR: Unable to restore device

This is with :

  • a mac mini M1, the same seems to happen with a mac mini M2 pro & the same ipsw
  • freshly compiled idevicerestore from master

Full logs (idevicerestore in debug mode & usbmuxd) attached below : macos15.beta.log https://github.com/user-attachments/files/16470438/macos15.beta.log usbmuxd.log https://github.com/user-attachments/files/16470440/usbmuxd.log

— Reply to this email directly, view it on GitHub https://github.com/libimobiledevice/idevicerestore/issues/662, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGIALZFXA4YIVPLNBKZ4OZ3ZPN3WJAVCNFSM6AAAAABL4ORYNGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ2DIOBWGM2TMNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

fvallee-scw commented 1 month ago

FWIW the latest RC images have the same behavior, I plan on digging more this week

U-siro commented 1 month ago

Same problem on my M1 Macbook Air.

fvallee-scw commented 1 month ago

I'm still trying to make sense of it, but so far my understanding is that the RecoveryOSASRImage is now provided in AEA1 format. This format seems to require special handling as per _restore_send_file_data.

However in restore_send_filesystem no such handling exists. So we try to send the first few packets of "096-29289-572.dmg.aea " & restored abrutly closes the connection.

Looking a few USB packets atfer the initial transfer we can see the connection getting cut I think:

0000   00 80 6a c5 cb 94 ff ff 43 03 81 0a 04 00 2d 00   ..j.....C.....-.
0010   e4 4e e8 66 00 00 00 00 20 51 0c 00 00 00 00 00   .N.f.... Q......
0020   3e 00 00 00 3e 00 00 00 00 00 00 00 00 00 00 00   >...>...........
0030   00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00   ................
0040   00 00 00 01 00 00 00 3e fa ce fa ce 01 9d 03 6a   .......>.......j
0050   03 73 6f 63 6b 65 74 49 73 43 6c 6f 73 65 64 20   .socketIsClosed 
0060   73 6f 63 6b 5f 72 65 63 65 69 76 65 20 72 65 74   sock_receive ret
0070   75 72 6e 65 64 20 65 72 72 6e 6f 20 35 34         urned errno 54
fvallee-scw commented 1 month ago

According to https://theapplewiki.com/wiki/Apple_Encrypted_Archive :

Since iOS 18 / macOS 15, the root filesystem in IPSWs is encrypted into .dmg.aea files, using AEA in profile 1 (symmetric encryption but no signing). The auth data in these files contains key-value pairs in the standard AEAAuthData format, which provide the [WKMS](https://theapplewiki.com/index.php?title=WKMS&action=edit&redlink=1) parameters needed to derive the decryption key.

fvallee-scw commented 1 month ago

With the latest commits from this weekend, restore now seems to progress past the ASR upload