idevicerestore icon indicating copy to clipboard operation
idevicerestore copied to clipboard

iPhone 12 stuck in "no serial number" or "Verification Error" in Windows 10

Open jryuen opened this issue 3 years ago • 2 comments

Firstly, I ran idevicerestore and get "ERROR: could not retrieve device serial number. Can't continue.", so I commented related code and add proper code, then idevicerestore could continue.

  • idevicerestore.c // if (client->srnm == NULL) { // error("ERROR: could not retrieve device serial number. Can't continue.\n"); // if (delete_fs && filesystem) // unlink(filesystem); // return -1; // }

  • restore.c, changed the function: restore_is_current_device static int restore_is_current_device(struct idevicerestore_client_t* client, const char* udid) { if (!client) { return 0; } // if (!client->srnm) { // error("ERROR: %s: no SerialNumber given in client data\n", func); // return 0; // }

    idevice_t device = NULL; idevice_error_t device_error; restored_client_t restored = NULL; restored_error_t restore_error; char *type = NULL; uint64_t version = 0;

    device_error = idevice_new(&device, udid); if (device_error != IDEVICE_E_SUCCESS) { debug("%s: can't open device with UDID %s\n", func, udid); return 0; }

    restore_error = restored_client_new(device, &restored, "idevicerestore"); if (restore_error != RESTORE_E_SUCCESS) { debug("%s: can't connect to restored\n", func); idevice_free(device); return 0; } restore_error = restored_query_type(restored, &type, &version); if ((restore_error == RESTORE_E_SUCCESS) && type && (strcmp(type, "com.apple.mobile.restored") == 0)) { debug("%s: Connected to %s, version %d\n", func, type, (int)version); } else { debug("%s: device %s is not in restore mode\n", func, udid); restored_client_free(restored); idevice_free(device); return 0; }

    plist_t node = NULL; restore_error = restored_get_value(restored, "SerialNumber", &node); if ((restore_error != RESTORE_E_SUCCESS) || !node || (plist_get_node_type(node) != PLIST_STRING)) { error("ERROR: %s: Unable to get SerialNumber from restored\n", func); restored_client_free(restored); idevice_free(device); if (node) { plist_free(node); } return 0; } restored_client_free(restored); idevice_free(device);

    char* this_srnm = NULL; plist_get_string_val(node, &this_srnm); plist_free(node);

    if (!this_srnm) { return 0; }

    if (!client->srnm) { client->srnm = strdup(this_srnm); }

    return (strcasecmp(this_srnm, client->srnm) == 0); }

Secondly, iPhone 12 entered restore mode, app uploaded data to device, and finally get message: "info:Status: Verification Error", then quit.

log.txt is attached log.txt

jryuen avatar Oct 12 '21 07:10 jryuen

It looks like the Serial Number is absent on restore mode on some iPhone 12 (SRNM empty with irecovery -q). I'm not sure why this is happening, but I think this is a bug of the device because after a restore with iTunes, the SRNM appears again.

On idevicerestore, It seems the serial number is only used on restore_is_current_device().

@nikias Do you think we can use another id (ECID or EDID) instead of SRNM to control if this is current device ? It can be a solution to support the few iPhones 12 who have this problem.

Orbif avatar Mar 07 '22 10:03 Orbif

@Orbif how about this: cc05503fdddc5a10b4fa6c62ad91899502021b6b ?

nikias avatar Mar 07 '22 12:03 nikias