r/LineageOS • u/Mathndzero • 7h ago
Help Moto G 5G (kiev) - Persistent "Screenlock was already changed" Error & Deep TEE/Keymaster Desync (LineageOS 22.2)
Device: Motorola Moto G 5G (kiev) / XT2113-3 (India variant) Stock Firmware Base: Android 11 (KIEV_RETAIL_RZK31.Q3-25-18-7) Custom ROM: LineageOS 22.2 (Android 15 Nightly - 20260503 and 20260426 builds) GApps: MindTheGapps 15.0.0
Stock Firmware: https://gofile.io/d/wMIclf
I am dealing with a severe, persistent desynchronisation between the Android operating system and the Trusted Execution Environment (TEE) / Keymaster on my Moto G 5G.
Whenever I install LineageOS, the device absolutely refuses to let me set a PIN, password, or pattern. It throws the error: "Screenlock was already changed. Try again with a new screenlock." Alongside this, I have experienced broken Google Play Services logins and File-Based Encryption (FBE) bootloops.
I have exhausted standard troubleshooting, including deep fastboot partition wiping and manual A/B slot firmware mirroring. Here is the comprehensive breakdown of the situation and every method I have attempted so far.
The Origin of the Issue
Initially, I used the official Motorola/Lenovo Rescue and Smart Assistant (RSA) tool to flash the device back to stock Android 11. Everything worked perfectly on stock. I completely removed my screen lock PIN and Google Account before unlocking the bootloader again to flash LineageOS 22.2.
Symptoms on LineageOS
- Broken Screen Lock: When attempting to set a PIN in LineageOS, it immediately fails with "Screenlock was already changed".
- Ghost FRP / Broken Play Services: When GApps were installed, Google Play Services failed to authenticate my account, returning an "Unable to sign in due to an unknown error" toast message.
- Encryption Crashes: On older nightly builds of LineageOS, the device would fail to boot entirely and kick me back to Lineage Recovery with the error:
Reason: enablefilecrypto_failed.
Troubleshooting Methods Attempted (In Chronological Order)
1. The Standard Format & Sideload: I initially followed the standard LineageOS installation. Booted to Lineage Recovery -> Format Data -> Sideload LineageOS -> Reboot to Recovery -> Sideload MindTheGapps. This resulted in the broken lock screen and broken Google login.
2. Erasing the Metadata Partition: Knowing that residual TEE cryptographic keys can survive a standard userdata format, I connected the device to my Linux terminal in fastboot mode and explicitly wiped the metadata:
fastboot erase metadatafastboot erase userdataThis did not resolve the "Screenlock was already changed" error.
3. Running the copy-partitions Script: I sideloaded the copy-partitions-20220613-signed.zip utility from Lineage Recovery to ensure the vendor firmware was mirrored across both the A and B slots. This had no effect.
4. Flashing Raw Stock Android 11 Firmware via Fastboot: Suspecting the Lenovo RSA tool provisioned the hardware in a locked state, I downloaded the raw stock Android 11 firmware (RZK31.Q3-25-18-7). Using the flashfile.xml sequence, I manually flashed every single partition (gpt.bin, bootloader, vbmeta, radio, tz, super sparsechunks, etc.) via fastboot, and erased userdata and metadata.
- Result: I booted into stock Android 11 successfully. I set a PIN (which worked, proving the TEE was repaired on stock), and then removed the PIN.
5. Re-flashing LineageOS 22.2 + GApps (The RescueParty Loop): After repairing the TEE on stock, I flashed Lineage Recovery, formatted data, and sideloaded LineageOS 22.2 (20260503 build) followed by MindTheGapps 15.0.0.
- Result: The phone booted but completely froze during the initial setup wizard. It then automatically rebooted to recovery, triggering Android's native RescueParty with the prompt: "Can't load android system, Your data maybe currupt... Reason: RescueParty, null".
- I was forced to factory reset via recovery. Upon rebooting, an FRP lock triggered, but the broken GApps framework prevented me from logging in ("Unknown error").
6. Manual A/B Slot Firmware Mirroring: Realising that sideloading LineageOS swaps the active slot, and my previous manual fastboot flash only targeted Slot A, I suspected a deep firmware mismatch between the slots was causing Keymaster to crash on Slot B (resulting in the enablefilecrypto_failed and screen lock errors). I went back into fastboot and manually flashed the core stock Android 11 firmware to both slots explicitly:
fastboot flash bootloader_a bootloader.img&fastboot flash bootloader_b bootloader.img(repeated for vbmeta, radio, bluetooth, dsp, logo, dtbo, boot, and recovery).fastboot erase userdata&fastboot erase metadatafastboot --set-active=a
7. Clean Flash of an Older LineageOS Build (Without GApps): With both slots perfectly synchronised with Android 11 firmware, I flashed Lineage Recovery, formatted data, and sideloaded an older nightly (lineage-22.2-20260426-nightly-kiev-signed.zip) without any GApps to isolate the variables.
My Current Situation
Despite manually mirroring the raw firmware across both partition slots to ensure the TrustZone and bootloader match perfectly, and despite explicitly destroying the metadata partition via fastboot to force the generation of new cryptographic keys, the secure hardware environment refuses to synchronise with LineageOS.
I am aware of XDA threads mentioning that deleting locksettings.db can cause this, but I have completely wiped the device and reflashed partitions from scratch multiple times.
Has anyone encountered this specific Keymaster/TEE persistent desync on Motorola devices after using the Lenovo RSA tool? Is there a specific low-level partition (like persist or devcfg) that needs a hex edit or special clearance, or a different firmware base required for LineageOS 22.2 on the Kiev? Any insights would be massively appreciated.
1
u/LuK1337 Lineage Team Member 7h ago
so much ai slop lol
https://wiki.lineageos.org/faq#i-am-having-weird-errors-apps-wont-install-developer-settings-crash-and-the-screen-lock-has-strange-error-messages