yashsingh1/xdaforums huggingface dataset:
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
I am using Xiaomi Mi A2, jasmine-sprout, Android 10 and it is rooted with magisk without gapps. Also, I am using the official LinageOS.

I am trying to update my LineageOS, but it always says "Your data may be corupted". I just don't want to delete my data (factory reset), just to update my os...

I have that problem since I installed lineage for the very first time in Nov.2020. It does not work manually with twrp and neither with lineage's recovery. It also doesn't work with the inbuild updater app.

While updating with twrp, I viewed the logcat using `adb logcat' and it installed successfully. But after rebooting it booted to stock lineage recovery telling me my data may be corrupted. (btw, I booted twrp using `fastboot boot twrp')

If I press on that `try again' button often enough, it boots into the os again.. But that os isn't updated...

I know there are a lot of issues like that, but none solved mine...

I reflashed the os again and did a factory reset once. It worked after doing a factory reset, but I cannot do that for every update.

The problem is that I also can't backup my whole files, apps and settings because seedvault wouldn't recovery them correctly and via twrp everything is encrypted (Seems to be an Android 10 issue... Besides: I also had to use an unoffical twrp somewhere from here, because the official one didn't even start).

On this offical site https://wiki.lineageos.org/devices/jasmine_sprout/install they told me I could ask for support on freenode. However, after 4 hours only one person tried to help, another stuff member just told me "i'm not interested in figuring out your issue". However, that very same person told me that that screen (the screen with try again / format data.) I get is called `rescue party'.

Edit: The staff member told me that there is an os on slot a and b and that the recovery is on both (I thought on one slot there is the recovery and on the other one there's the os). So that my device boots after pressing often enough on the `try again' button is because it boots the othere slot which still contains the unupdated os (that's what the support told me).

Since this issue couldn't be solved by their support as well, they finally pointed me to you.

I really hope you can help me! And if you need anything, just ask for it.
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
OK @User699 I have some ideas as to what your issues are.

But I have several questions and/or requests for you in order to determine what your issues are.

It sounds to me like your userdata is encrypted and LineageOS has access to the encryption keys, but perhaps your recovery does not have access to the keys.

FYI: RescueParty is a boot subsystem that attempts to recover if a bootloop is detected.

Here are some questions or requests that I need you to answer:

1. When you boot your system normally, you DO have access to your userdata partition.

You can install or remove apps and otherwise function normally when you boot into LineageOS, correct ?

2. Which recovery (type and version, ie: TWRP ver 3.4.0.1) do you currently have installed ?

You mentioned booting into TWRP by telling fastboot to boot the TWRP directly.

3. You say you have Magisk installed, so I need you to boot up, enable adb, connect a USB cable and open up a Windows command line.

in the command line, type:

adb shell + enter

You should see something like:

jasmine_sprout: / $

Now type:

su + enter

you should see:

jasmine_sprout: / #

Now type:

ls /dev/block/by-name -l + enter

copy the output and post it to this thread.

Thanks.

4. You can boot your phone into fastboot mode and run fastboot commands from as PC, correct ?

5. Download this image: https://androidfilehost.com/?fid=17248734326145702860

I will tell you what to do with it in a minute

Once you respond, I will tell you what you need to do next. If you can get to the adb shell and get root by running su, we should be able to backup everything, so worst case we CAN wipe your data, update your ROM, then restore your data
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
I am so glad to hear about the TWRP being able to read your encrypted partitions.

The first thing I see is that your system is using a partition layout known as treble.

Treble is designed to make updates, especially OTA (over the air) updates safer.

To make the updates safer, treble has an a and b image of pretty much every partition that might change during an update.

The bootloader has an active slot indicator

When an OTA update is loaded, It updates the NON active slot. If the OTA is successful, the bootloader changes the active slot (from A to B, for instance), then reboots

Do you see that you have an a and b partition for:

boot

system

vendor

bluetooth

abl

cmnlib64

cmnlib

devcfg

dsp

hyp

keymaster

and several others

So I need you to boot the phone to fastboot, connect it to your PC and type:

fastboot getvar all + enter

Save the results and post them to this thread

Next, try flashing the TWRP image I had you download by placing the file twrp-3.5.0-jasmine_sprout.img in the folder containing your fastboot.exe and typing:

fastboot flash recovery twrp-3.5.0-jasmine_sprout.img + enter

If it successfully flashes recovery, type:

fastboot reboot recovery + enter

Now see if it loads up TWRP.

Thanks
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
fastboot getvar all

prompt:~$ fastboot getvar all
getvar:all FAILED (remote: unknown command)
finished. total time: 0.000s

fastboot flash recovery <twrpimagename>

prompt:~$ fastboot flash recovery ./twrp-3.5.0-jasmine_sprout.img
target reported max download size of 805306368 bytes
sending 'recovery' (35497 KB)...
FAILED (remote: Requested download size is more than max allowed
)
finished. total time: 0.000s

I could use

fastboot flash boot twrp.img

though.

EDIT: No, I can't, even though it worked that way with lineageOS' recovery. Output:

prompt:~$ fastboot flash boot ./twrp-3.5.0-jasmine_sprout.img
target didn't report max-download-size
sending 'boot' (35497 KB)...
FAILED (remote: Requested download size is more than max allowed
)
finished. total time: 0.000s

Any idea @tecknight ?
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
fastboot oem device-info

prompt:~$ fastboot oem device-info
...
(bootloader) Verity mode: true
(bootloader) Device unlocked: true
(bootloader) Device critical unlocked: false
(bootloader) Charger screen enabled: true
OKAY [ 0.001s]
finished. total time: 0.001s

Yes, fastboot getvar all only gave me the above output (the one I inserted in my previous reply).
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
OK, try:

fastboot getvar partition-type:recovery

fastboot getvar partition-size:recovery

My deviceinfo:

C:\Program Files (x86)\Tiny ADB and Fastboot>fastboot oem device-info

(bootloader) Verity mode: true

(bootloader) Device unlocked: true

(bootloader) Device critical unlocked: true

(bootloader) Charger screen enabled: true

OKAY [ 0.005s]

Finished. Total time: 0.006s
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
fastboot getvar partition-type:recovery

prompt:~$ fastboot getvar partition-type:recovery
getvar:partition-type:recovery FAILED (remote: unknown command)
finished. total time: 0.000s

fastboot getvar partition-size:recovery

prompt:~$ fastboot getvar partition-size:recovery
getvar:partition-size:recovery FAILED (remote: GetVar Variable Not found)
finished. total time: 0.001s
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Something is odd about it... I tried different getvar commands found here http://adbcommand.com/fastboot and after I typed in fastboot getvar product, the fastboot picture on my device disappeared and showed

instead.

I did that and it rebooted normally into my system. However, I bootet into fastboot again and tried the exact command again and it gave me that:

prompt:~$ fastboot getvar product
product: jasmine
finished. total time: 0.001s

Right after that I inserted the same again and it gave me

prompt:~$ fastboot getvar product
getvar:product FAILED (remote: unknown command)
finished. total time: 0.000s

and after I tried again I got the same text again which I quoted above...
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Do you think it's a problem, that mine says false?
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
OK, do you have a Micro SD ?

If you do, make sure it's in your phone and lets boot TWRP:

fastboot boot recovery twrp-3.5.0-jasmine_sprout.img

do a backup to your MicroSD using TWRP.

When it's done stay in TWRP, cuz we need to do more stuff
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
No, this device doesn't have an sdcard. But I did a backup checking every option twrp provides and transfered it (and my pictures, files etc) to my computer.
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
Yes it might be a problem
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
Good, so we have a backup ?
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
Boot into fastboot and try this command:

fastboot oem unlock-critical
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Well, I have done two. One with every option checked and one which didn't check every option.

But somehow twrp doesn't boot now... I'll reboot, maybe it works then
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Should I run unlock-critical first? And why do I need this?
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
Download this:

Download twrp-installer-3.5.0_9-0-jasmine_sprout.zip

Download page for twrp-installer-3.5.0_9-0-jasmine_sprout.zip

dl.twrp.me
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
Lets try it without unlock-critical first

Are you able to boot the TWRP image ?
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
We are going to try to install TWRP from TWRP-- there is actually a reason for it
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Done
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
How do we do that?
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Besides, I am in twrp again. It booted after waiting a bit after booting into LineageOS again.

My first Backup has the following checked

(everything)

And my second Backup has the following checked

because the offical twrp site said that the system could be bricked if I just reflash every partition I backuped.

Do you recommend to backup some other set of those?

EDIT: I could try to

fastboot flash boot twrp.img

again if you want me to.
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
Note 1 important var in there.

current-slot:a

This var determines which partitions it attempts to boot into when it boots.

That is great that you can get your vars now . So does it now boot into Lineage recovery ?
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Yes, it does
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
OK great, so do you want to try the OTA upgrade or just flash the full latest version of Lineage ?

I would backup your data first with Lineage recovery

Remember when flash to an A/B system, it normally flashes the inactive slot, which in your case is currently b

as your:

current-slot:a

So once you are done flashing or applying an OTA update you need to run the following command from fastboot:

fastboot set_active b

then

fastboot reboot

to boot into the new system.

Have you looked over this post ?

[GUIDE] Flashing and updating custom ROMs

Flashing for Dummies In this guide we'll go over how to flash custom ROMs with root and TWRP in addition to updating this guide will always be updated Read the ENTIRE guide before you start Your warranty is now void. We are not responsible...

xdaforums.com

Here are some important things to consider from that post:

things to keep in mind:​

1- when you flash a ROM through TWRP, it will flash to your inactive slot, that's why you need to switch slot after flashing it and then flash everything else, think of it like an OTA update except you need to switch active slot yourself​

​

2- when you change your active slot in TWRP, it will only change after you reboot, your active slot will always be the one you're currently booted on​

​

3- the order of flashing anything that modifies boot is​

1) TWRP​

2) custom kernel​

3) noverity​

4)Magisk​

​

@User699,

I like you you are not afraid to dive in and get your hands dirty. I assure you, it is the BEST way to learn about these things
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
I want to do the ota update. My only goal is to update my OS (OTA-update) without having to factory reset my device.

So if we find a solution to perform this update without factory reseting, my problem would be solved.

Lineage Recovery has no backup function, but I have that twrp backup and could also boot into twrp if that would be necessary.
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Well I did all that with lineageOS' recovery exactly as they told on their official site. Since Lineage's OTAs are the whole os.zip, I only need to apply an update via recovery, right?
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
Yes. However you may need to uninstall Magisk before you apply the update, then re-apply Magisk after the update.

You could try the update with Magisk in place, but if it fails then I would suggest updating an unmodified LineageOS
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Okay, did that. But the result is the rescue party again. It says slot b is affected and if I press the 'Try again' button often enough, it boots back to the unupdated slot a

Yep, thank you! I totally agree with you!
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Oh, I see. Do you think just `uninstall' Magisk would do it, or do I have to remove other things as well?
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
Your Lineage install image is here:

https://mirrorbits.lineageos.org/recovery/jasmine_sprout/20210227/lineage-17.1-20210227-recovery-jasmine_sprout.img
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
I think that the Magisk patched boot image might need to be unpatched, but what the heck, try it without unpatching first, it might work
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Yes, I know. It has been downloaded via the inbuild updater app, but I cannot apply this update because it always opens rescue party and says my data may be corrupted.
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
You uninstall Magisk by running this uninstaller .zip under recovery:

https://github.com/topjohnwu/Magisk/releases/download/v21.4/Magisk-uninstaller-20210117.zip
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Like first uninstalling it without unpatching? However, I never thought Magisk could cause that issue as I thought it doesn't affect the system in that way, since it's systemless.

Still thank you and hanks once again!
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
If it says that, then reformat/wipe your userdata and cache partitions in recovery before installing. We can restore your data from backup after install.

Good luck my friend
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
I did a fresh install of lineage because it told me that. But it hasn't been solved through that.

I mean I could just flash the whole OS again, but I cannot actually do that for every single update they release. That's why I was hoping it would be possible to solve this issue, to update the OS without factory resetting all the time
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
It runs and tells me

-EDIT: After applying the unpatch-Magisk.zip and removing Magisk it remained the same.
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
The RescueParty message is clearly about the encryption.

The Lineage installer probably can't find the encryption keys.

There is another possibility: you could flash this .zip after wiping and reformatting userdata and cache:

Zackptg5 - Android

zackptg5.com

It is a DM-VERITY & FORCEENCRYPT DISABLER, it should prevent Lineage boot from encrypting userdata or cache, so your next OTA update will not get the error.

Either try this or try uninstalling Magisk Manager from the boot image before updating ?
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
The

cannot access /data

is clearly due to the encryption
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
So it's an issue from lineageOS' site?

I mean I wouldn't really want to lose encryption "just" to update my os... Is there anything else I could try?
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Yep. I unpatched Magisk but result is the same... rescue party. What does stock android/recovery do that LineageOS/LineageOS' recovery/TWRP can't do?
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
The error message certainly appears to be all about the encryption or lack of decryption.

You could try removing Magisk from the boot image as I suggested.

I had an encryption issue on my Xiaomi Redmi Note 9S, and I solved it by setting a PIN in recovery.

Once I typed in that PIN, OrangeFox recovery figured out how to decrypt my partitions.

You might try that or even try OrangeFox recovery.

What do you think ?
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Using that zip you provided? Yep, did that (see a few messages above).

If you mean something else, please explain what you mean.
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
I have a password and twrp asked for it, could decrypt my userdata and still failed to apply that update (at least the os still booted into rescue party).

I could also try to catch the logs while installing if that helps you?
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
The cannot access /data message is a very strong indication that userdata is not mounted when the installer launches. Make CERTAIN you can read/write userdata before running the installer.

and sure, grab the TWRP logs
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
So I could check via twrp if /data is mounted and mount it if necessary? If I can view /data via twrp, shouldn't it be mounted so the installer can access it?
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
Yes, if /data is mounted, I don't see the installer getting that particular error.

You can tell when TWRP can't decrypt a partition. When you try to check the partition on the mount screen, it refuses to check
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
So TWRP had /data mounted already. I can also write and remove thinks in /data/ directory and read everything (it's not encrypted anymore). I tested that using

touch myFile.txt
rm myFile.txt

and it worked just fine

EDIT: Don't know if that helps, but: I cannot uncheck /data in the mount screen from twrp. It's always on.

EDIT2: It says Failed to unmount '/data' (Device or resource busy)
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
Use the terminal app within TWRP.

Actually launch the terminal app

then try:

ls /data/adb

If it shows:

magisk magisk.db modules ...

your userdata is successfully decrypted and mounted
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Yes, they are.
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
So, here's the log which I got using

adb logcat > myFile.txt

EDIT: Log removed. See extracts of my logcat in my next answer on this post if you're interessted.
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Update: I tried this https://www.thecustomdroid.com/install-ota-update-rooted-android-device-guide/ as well, but it won't boot either. There's just the rescue party.
[Xiaomi Mi A2 / 6X Questions & Answers] User699:
Update:

FIXED my error (at least I can update my system now).

Here's what I did

1) I applied that LOS system update to my inactive slot (b, in my case).

2) Rebooted. And got rescue party. The log shows decryption problems, but I just proceeded anyways.

3) I pressed the back arrow in the rescue party to get back to the main screen of LOS' recovery.

4) Since I was in slot b now, I sideloaded the update package which is going to be applied to slot a in my case.

5) Rebooted into system.

6 DONE.

I did't had to reset my data and the os in slot a is bootable and updated.

However, slot b still is unbootable... But atleast I can Update my OS.

Thank you @tecknight for all of your help and time! Even though we couldn't solve the unbootable slot b, you still helped me to learn a lot of interessting things and even provided a version of twrp which can decrypt my user data. Really, thank you!
[Xiaomi Mi A2 / 6X Questions & Answers] tecknight:
@User699 I'm glad you got this fixed.

I was out of town for a couple days.

Also I'm glad you (we) learned a lot in the process.

It was a pleasure working with you. I expect to see you helping others as you are a quick learner, my friend.
[Galaxy SNAPDRAGON S20 S20+ S20 Ultra Development] jrkruse:
Must Have An Unlocked Bootloader To Do This!

This A full stock firmware file I have created to flash with odin to automatically install TWRP recovery along with Disable VBMETA image. The Userdata _AIO tar file will also automatically install magislk root along with remove force encryption and patch bluetooth library file. It will also patch safetynet. No flashing of zips is required

Info For Bootloader Unlocks Can Be Found In Post 2

I Do Not Recommend Mixing Bit 1 And Bit 2 Firmware!!!!

​

Downloads

SM-G981U/U1/W- Model

G981USQU3HWB3_Bit1_Safe --This will bring you to Android 13 without loosing unlock

SM-G986U/U1/W- Model

G986USQU3HWB3_Bit1_Safe --This will bring you to Android 13 without loosing unlock

SM-G988U/U1/W- Model

G988USQU3HWB3_Bit1_Safe --This will bring you to Android 13 without loosing unlock

Odin3_v3.14.1_3B_PatcheD.zip

TWRP Recovery Provide by @afaneh92

Be prepared to have your data wiped. The process tries to determine if you do or do not need to have data wipe but as a precaution just assume your data will be wiped. Especially if using U1 or W firmware

Install Instructions

You must be OEM Unlocked Bootloader

1. On Initial unlock of phone you must through setup and be signed into your google account.

2. Reboot phone too download mode and make sure KG STATUS=CHECKING (see pic) and not PRENORMAL. If PRENORMAL then do step 1 again

View attachment 5217631

3. Use patched 3.14 odin and load files in appropriate odin slots

4. Phone will reboot to TWRP and remove encryption which will wipe phone. Phone will reboot back too TWRP to finish install then reboot to setup

Features

No patches or mod zips are needed phone will already be rooted

Fix Safetynet

Bluetooth is patched for pairing to survive reboots

Samsung Health working

Bugs

Samsung Pay, Secure Folder and Samsung Pass do not work as on most Samsung Rooted Roms

Thanks To People That Make My Life Easier

elliwigy

klabit87

Krog18

me2151

stang5litre

Raymonf for modified odin

rayan-refoua for boot animation

TheMadScientist

afaneh92

kdrag0n for safetynet fix

3arthur6 for bluetooth patch zip

JDBarlow for test S20 stuff

markfm For Bitsafe Firmware

Source For Userdata AIO
[Galaxy SNAPDRAGON S20 S20+ S20 Ultra Development] jrkruse:
Info For U Model Bootloader Unlocking Can Be Found

[CLOSED][Android][UNSAMLOCK] Bootloader Unlock for Samsung US/Canada Devices

Important notice: If you are already updated post February 2021, do not update to April 2023 security update (XXXXXXXXXXWCX) or later. Examples: G998USQS6EWCA, N986USQU4HWD1. Samsung has patched the bootloader unlock again on those updates...

xdaforums.com

Below US snapdragon devices can be bootloader unlocked with above service as long as bootloader version meets below criteria. Bootloader version can be determined from the 5th character from the right on the baseband version or build number, in some cases from kernel version

Z Fold2 5G BL V1

Fold 5G BL V1-4

Fold BL V1-4

Z Flip 5G BL V1

Z Flip BL V1-3

Note series 20 BL V1

S20 series BL V1

S20 FE 5G BL V1-2

Note 10 series BL V1-5

S10 Lite BL V1-3

Note 10+ 5G N976U BL V1-4

Note 10+ 5G N976V BL V1-5

S10 5G BL V1-5

S10 series BL V1-4

Note 9 BL V1-7

S9 series BL V1-9

Tab S6 BL V1-3

Tab S7 BL V1

Tab S7+ BL V1

A71 5G BL V1-2

A51 BL V1-5

A51 5G BL V1-4

A50 A505W BL V1-A

A50 A505U BL V1-B

S21 BL V1

A32 5G BL V1-3

Tab Active Pro 10.1 BL V1-4

XCover Pro BL V1-7
[Galaxy SNAPDRAGON S20 S20+ S20 Ultra Development] jhr5474:
Good to see you here, I will make use of this. Thanks, I hope to see you playing with roms!