[Xperia Tablet Z Q&A, Help & Troubleshooting] iiontihy:
Hey everyone,

My questions are at the end below, but they need a bit of history which might be useful to someone in similar position.

I have SGP321 and used it stock for a number of years without much issues. Lately though it seems the age of the device shows itself and I wanted to try a custom LineageOS ROM on it - I 've done this before with several other devices.

I tried to follow this guide - [Guide/tutorial] Sony Xperia Tablet Z LTE or Wifi Any version to Android 8 - however the service menu of the tablet showed that the bootloader cannot be unlocked. Attempts to unlock the device using fastboot oem unlock 0xYOURUNLOCKKEY using and unlock code from https://developer.sony.com/develop/open-devices/get-started/unlock-bootloader/ showed that the bootloader of the tablet is indeed locked and the lock cannot be removed. I also tried to use the Flashtool to unlock the bootloader - again unsuccessfully.

Being stubborn as I am, I rooted the tablet using this guide - [Guide][Easiest Way]How to Root Xperia Z Android 5.1.1 Without PC and Get SuperSu - which works for Tablet Z as well. Having root access gives possibility to work around the bootloader lock to some extend since access to the tablet storage happens from the OS. I proceeded to copy twrp-3.3.1-0-pollux.img to the external sdcard of the device and executed from a root terminal on the device:

dd if=/sdcard1/twrp-3.3.1-0-pollux.img of=/dev/block/platform/msm_sdcc.1/by-name/FOTAKernel​

which completed without complaint, then I rebooted and tried to enter recovery by using repeated presses of volume-up and volume-down buttons as well as other combinations like holding them pressed simultaneously, combining the volume buttons with the power button - no positive result (most probably as I read later because the stock BL doesn't support recovery). Then I decided to install the official TWRP app and the used it to install the image to the recovery partition - again no result booting into recovery. Then (foolishly) I used the app to try to install the TWRP image in the boot partition - no problems there, however on the next reboot the tablet was bricked ;)

In this state when trying to power-on the tablet the indicator LED starts flashing in red and the screen remains black. Power-off was possible through pressing volume-up and power buttons for more than 10 seconds. It was also possible to enter fastboot mode by powering-off the tablet and holding volume-up while inserting a USB cable that was plugged to a PC - success was indicated by a continuous blue indicator LED. Attempts to use fastboot flash or fastboot boot with TWRP image didn't give any positive result - the first failed with "Operation not allowed", the second failed with "Too many links". I also tried the same with kernel.sin and fotakernel.sin files from the stock ROM FTF file downloaded using the Flashtool - again unsuccessfully.

Using the Flashtool itself to restore the stock ROM failed initially because the on-screen instructions for getting into flash/download mode - powering off and then holding the volume-down button while inserting a USB cable that was plugged to a PC - didn't work in my case. Then I decided to use this sequence:

powering off

first pressing and holding the volume-down button

second pressing and holding the power button

finally - inserting a USB cable that was plugged to a PC

I was awarded with short green flash of the indicator LED and the Flashtool recognized the device as being in flash/download mode. I then proceeded to flash the downloaded stock ROM using the default settings. The flash was successful, and I was back to square one. I also rooted the device again as described above.

My questions:

Does anyone know of a method that allows to use the root shell of the device itself to remove the bootloader lock? For example, custom copy/flash using the dd command from a root shell and partition images extracted form TWRP/Custom non-stock ROMs.

Is it possible in the situation of my device to install/flash custom recovery/kernel/ROM if we assume that the bootloader cannot be changed?

Thanks in advance for your time and thoughts...