Mind Dump, Tech And Life Blog
written by Ivan Alenko
published under license CC4-BY
posted in category Systems Software / LineageOS
posted at 07. Sep '23

Howto Upgrade LineageOS From 19.1 to 20.0

Recently I upgraded Oneplus 6 and Xperia XZ2 Compact from LineageOS 19.1 to 20.0 (Android 12 -> Android 13).

OnePlus went pretty smooth, there is even an upgrade guide to upgrade the firmware on the docs.

I will describe upgrade process on Xperia XZ2 Compact, because I had to upgrade boot partition this time too.

See previous parts if you have an older version:

I like LineageOS 20.0 (Android 13), while icons are larger, scrolling is faster and less microstuttery (maybe I have twisted perception from 90Hz displays about the ideal speed, but is is definitely snappier)

Preparation

Let’s describe also the tools, because I had to download the latest one.

Remember how to go to fastboot and recovery, just to prevent panic when stuff does not work as they should:

  • fastboot (bootloader, the first boot stage) - fastboot devices - volume up + connect usb cable = blue LED light, empty black screen
  • recovery (the second boot stage) - adb devices - power + volume down (don’t hold it more than couple of seconds, otherwise phone will restart once gets to recovery)

Other usual steps:

  • allow developer mode and USB debugging
  • backup data if needed, you can lose it
  • applications and data will be preserved (until something goes really wrong)
  • this time I had to add root into plugdev system group like sudo usermod -aG plugdev root (https://developer.android.com/studio/run/device) to use adb. Restart the computer after adding the group
  • I run adb and fastboot as root, but in theory a regular user in plugdev could work too
  • commands do not show the whole directory path since it was too long

Upgrade Sony Fiwmare

New device drivers cannot hurt, right?

I know Lineage 20.0 is Android 13 and binaries are for Android 12, but they work. It used to be almost impossible in Gingerbread 2.3 and KitKat 4.4 era.

root@rapthalia:~/platform-tools# ./adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
BH902KDKCU      unauthorized
# authorize it on the phone
root@rapthalia:~/platform-tools# ./adb reboot fastboot
root@rapthalia:~/platform-tools# ./fastboot devices
BH902KDKCU      fastboot

root@rapthalia:~/platform-tools# ./fastboot flash oem ~/lineage/SW_binaries_for_Xperia_Android_12_4.19_v3a_tama.img
Sending 'oem' (314068 KB)                          OKAY [  1.245s]
Writing 'oem'                                      OKAY [ 14.389s]
Finished. Total time: 15.651s

Upgrade Bootloader

I had to upgrade the bootloader (Lineage recovery), because I got this error while flashing new ROM:

E: Package is for product xz2c but expected H8324
root@rapthalia:~/lineage/platform-tools# ./fastboot devices
BH902KDKCU       fastboot

root@rapthalia:~/lineage/platform-tools# ./fastboot flash boot ~/lineage/xz2c/boot.img
Sending 'boot_a' (65536 KB)                        OKAY [  0.252s]
Writing 'boot_a'                                   OKAY [  1.415s]
Finished. Total time: 1.686s

Here I kind of panicked and thought I fucked up the boot partition since all I saw was Sony logo for minutes and downloaded latest platform tools and flashed boot partition like 7 more times - classic method used when I handled bootloop couple of years ago. Just for your information it always flashed to boot_a and copy partitions script is not usable in bootloader. It requires to be applied in the recovery.

I still don’t know if it would boot into Android, probably not since I saw Sony logo for minutes. I hold volume down and power for couple of seconds and then wait for like 2 minutes until the phone got into the recovery. Yay!

And this concludes the new bootloader.

If you see this, you are not in fastboot, but somewhere in boot process limbo:

root@rapthalia:~/lineage/platform-tools# ./fastboot devices
????????????     XFL

root@rapthalia:~/lineage/platform-tools# ./fastboot flash boot ~/lineage/xz2c/boot.img
Warning: skip copying boot_a image avb footer (boot_a partition size: 0, boot_a image size: 67108864).
Sending 'boot_a' (65536 KB)                        OKAY [  0.604s]
Writing 'boot_a'                                   FAILED (remote: 'Command not authenticated')
fastboot: error: Command failed

Turn off the phone, hold volume up and connect the USB cable.

Upgrade LineageOS

  • download ROM from here - https://download.lineageos.org/devices/xz2c/builds
  • go to the recovery
  • allow ADB from the menu
  • restart to the sideload mode and flash
  • I could not have been bothered, but here you should restart again to the recovery and apply ZIP with Google Apps - https://wiki.lineageos.org/gapps. I still have microG there which not sure if works anymore and can’t be bothered with Google Apps on this phone
root@rapthalia:~/lineage/platform-tools# ./adb sideload ../xz2c/lineage-20.0-20230901-nightly-xz2c-signed.zip 
Total xfer: 1.00x
root@rapthalia:~/lineage/platform-tools#

And then restart and all is good. Enjoy!

Add Comment