Xperia XA2: flashing worked after unlock, despite secure: yes

asked 2019-11-26 08:19:14 +0200

Jolly H gravatar image

updated 2019-11-28 08:33:50 +0200

In the end, I successfully flashed Sailfish_OS-Jolla-3.2.0.12-h3113-0.0.7.10.zip and SW_binaries_for_Xperia_Android_8.1.6.4_r1_v16_nile.zip to an Xperia XA2 (single SIM) model H3123.

However, even though the sudo fastboot oem unlock 0x... completed successfully, flash.sh was refusing to proceed because getvar secure was yes. When I ran the oem unlock again, it told me that the device was already unlocked. I sabotaged the getvar secure check in flash.sh. (I edited a copy of the script, because flash.sh itself is covered by the MD5 check.) With the getvar secure check sabotaged, flashing worked without any problem.

I now have Sailfish running on the XA2 and it works.

When I run sudo fastboot getvar secure now, it says secure: no.

It is perhaps relevant that when I did the oem unlock and the flashing, I did it without disconnecting the device between the two steps. In other words, when I made it to section 6, I skipped to step 6.5.

This is on Arch Linux. The fastboot command is from version 29.0.5-1 of the package android-tools.

It is probably obvious from the description, but this is how the script that worked differed from the original:

$ diff -U4 flash.sh my_flash.sh                                                                                                                                                                                                  
--- flash.sh    2019-11-24 22:49:05.587796864 -0800
+++ my_flash.sh 2019-11-24 22:47:39.631569661 -0800
@@ -133,9 +133,9 @@
 if [ "$($FASTBOOTCMD getvar secure 2>&1 | head -n1 | cut -d ' ' -f2 )" == "yes" ]; then
   echo; echo "This device has not been unlocked, but you need that for flashing."
   echo "Please go to https://developer.sony.com/develop/open-devices/get-started/unlock-bootloader/ and see instructions how to unlock your device."
   echo;
-  exit 1;
+  #exit 1;
 fi

 if [ -z ${BINARY_PATH} ]; then
   BINARY_PATH=./

edit retag flag offensive close delete

Comments

Did you disconnect the device from your workstation between unlock and flash commands?

Leon ( 2019-11-27 14:25:26 +0200 )edit

@Leon, no, I did not disconnect the device from the computer between the unlocking and the flashing. Specifically, I followed the following note in the instructions:

NOTE: If your device is still connected and the blue LED lit from step 4.7 it is ok to keep it that way and skip to step 6.5 below.

Jolly H ( 2019-11-28 02:43:37 +0200 )edit