Mind Dump, Tech And Life Blog
written by Ivan Alenko
published under license Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)copy! share!
posted in category Systems Software / LineageOS
posted at 13. Aug '21

Howto Unlock Sony Xperia XZ2 Compact

Since I wanted to install LineageOS in hopes my touch layer would work properly again, I had to unlock the bootloader first and then flash LineageOS which was fun.

First get the unlock code - https://developer.sony.com/develop/open-devices/get-started/unlock-bootloader and install Android platform tools - adb and fastboot.

Then go to the system, turn on developer section and turn on USB debugging and allow OEM unlock.

Your unlock code for 355003091839123
6FBEAABB2E551123

Generate new code

$ adb reboot bootloader
$ fastboot devices
BH902KDKCU      fastboot
$ fastboot oem unlock 6FBEAABB2E551123
                                                   OKAY [ 38.907s]
Finished. Total time: 38.907s

$ fastboot devices
BH902KDKCU      fastboot
$ fastboot -w
Erasing 'userdata'                                 OKAY [ 39.614s]
mke2fs 1.45.4 (23-Sep-2019)
Creating filesystem with 12560748 4k blocks and 3145728 inodes
Filesystem UUID: 547ae5cc-a7a9-4bd5-ba61-da1c921cd3ea
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424

Allocating group tables: done
Writing inode tables: done
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done

Sending 'userdata' (4604 KB)                       OKAY [  0.020s]
Writing 'userdata'                                 OKAY [  0.001s]
Finished. Total time: 39.849s

$ fastboot --set-active
Setting current slot to 'b'                        OKAY [  0.004s]
Finished. Total time: 0.010s
$ fastboot reboot recovery
...

And bam, phone is unlocked and you lost your proprietary camera noise processing algotihms. Don’t worry the camera works. Some people write you should back up the partition, but whatever.

Add Comment