Sony Xperia XA2: successfully update LineageOS 16.0

local_offer
Category
IT

Updating LineageOS 16.0 on your Sony Xperia XA2 can result in no network, bluetooth and Wi-Fi. It’s a common problem, but there is a solution: update the firmware, but to an older version than 50.2.A.0.*. After that, updating to newer LineageOS versions won’t be a problem anymore. Here’s a step-by-step guide how it worked for me.

Note: If you make a mistake, you can brick your phone for good. I do not take any warranty if you do so. If you’re not sure about a step, do some research until you feel save to continue. Also consult the links at the bottom for more information.

I flashed the firmware using Gentoo Linux as my OS. If you use a different distro or OS, (some of) the commands will be different.

  1. Backup your phone data (everything will be erased)
  2. Download XperiFirm
  3. Open XperiFirm
  4. Download the “Commercial and Journalists” firmware version (50.1.A.5.59) for your Xperia XA2 model
  5. In the folder of the newly downloaded and extracted firmware, delete the following files (you don’t need them for the firmware update, but they will be copied to the phone if left in the folder):

    • kernel_X-FLASH-ALL-18AE_0x00.hash
    • kernel_X-FLASH-ALL-18AE.sin
    • persist_X-FLASH-ALL-18AE_0x00.hash
    • persist_X-FLASH-ALL-18AE.sin
    • system_other_X-FLASH-ALL-18AE_0x00.hash
    • system_other_X-FLASH-ALL-18AE.sin
    • system_other_X-FLASH-ALL-9B8D_0x00.hash
    • system_X-FLASH-ALL-18AE_0x00.hash
    • system_X-FLASH-ALL-18AE.sin
    • system_X-FLASH-ALL-9B8D_0x00.hash
    • userdata_X-FLASH-CUST-18AE.sin
    • vendor_X-FLASH-ALL-18AE_0x00.hash
    • vendor_X-FLASH-ALL-18AE.sin
    • vendor_X-FLASH-ALL-9B8D_0x00.hash

    Using linux, you can do so by running the following command:

    rm kernel_X-FLASH-ALL-18AE_0x00.hash kernel_X-FLASH-ALL-18AE.sin persist_X-FLASH-ALL-18AE_0x00.hash persist_X-FLASH-ALL-18AE.sin system_other_X-FLASH-ALL-18AE_0x00.hash system_other_X-FLASH-ALL-18AE.sin system_other_X-FLASH-ALL-9B8D_0x00.hash system_X-FLASH-ALL-18AE_0x00.hash system_X-FLASH-ALL-18AE.sin system_X-FLASH-ALL-9B8D_0x00.hash userdata_X-FLASH-CUST-18AE.sin vendor_X-FLASH-ALL-18AE_0x00.hash vendor_X-FLASH-ALL-18AE.sin vendor_X-FLASH-ALL-9B8D_0x00.hash
  6. Clone newflasher repository to your local machine:

    git clone https://github.com/newflasher/newflasher.git ~/.local/share/newflasher
  7. Install libexpat and zlib libraries:

    emerge -a dev-libs/expat sys-libs/zlib
  8. Compile newflasher:

    make -C ~/.local/share/newflasher
  9. Copy the compiled file (called newflasher) into the folder with the firmware
  10. Turn off your phone
  11. Hold the volume down button while you plug in the USB cable; the LED on your phone should turn green
  12. Open a console
  13. Go to the directory with the firmware and newflash binary
  14. Run newflash:

    ./newflasher
  15. Find out the active slot by typing

    fastboot getvar current-slot

    The result is either current-slot: _a or current-slot: _b

  16. Change slot:

    fastboot set_active b

    (if current-slot is _a) or

    fastboot set_active a

    (if current-slot is _b); the console will confirm the changed slot

  17. Unplug the USB cable
  18. Repeat step 10 and 11
  19. Install LineageOS according the official guide
  20. Restore phone data
  21. Delete the newflasher folder:

    rm -r ~/.local/share/newflasher
  22. Uninstall libexpat and zlib libraries. Using Gentoo, run

    emerge -ac dev-lib/expat sys-libs/zlib

Source: