Help needed in understanding bootloader. - Xiaomi Mi A2 Lite Questions & Answers

So, I had an unlocked BL, rooted phone, with TWRP 3.3.1 deestroy.
For some reason, I booted into my recovery, wiped all my data, through format and advanced wipe feature. I even changed slots (just to make sure) and formatted data, and advanced wipe.
I then locked my bootloader, through adb fastboot command. Rebooted my phone, which had nothing to boot to. Then I unlocked my bootloader, rebooted my phone again, and it got booted into TWRP 3.3.1
Now my understanding is, unlocking bootloader, and using formatting options from TWRP should have wiped my data completely.
Then why did my phone boot into TWRP 3.3.1 after I unlocked the BL?

This might be helpful for you:
https://github.com/tkchn/daisyinstall

Lol. I didn't ask for how to flash a custom ROM.
Just need help understanding how the bootloader works? Where does TWRP get installed? Why after wiping did TWRP survive?

shazee666 said:
Now my understanding is, unlocking bootloader, and using formatting options from TWRP should have wiped my data completely.
Then why did my phone boot into TWRP 3.3.1 after I unlocked the BL?
Click to expand...
Click to collapse
Different things live on different partitions.
TWRP does not live on the userdata partition so wiping data cannot remove TWRP.
You need to use fastboot or miflash to do a full flash and restore a phone to stock.

Okay. This cleared somethings...

If you have tampered with the phone's partitions (TWRP patches itself into boot.img) you should never lock the Bootloader. Basically when the Bootloader is locked, the phone checks all the partitions of the phone if they've been tampered or still the same as Xiaomi designed it. In the case that they've been tampered, the phone won't boot itself, this helps with a lot of security issues. Never lock your Bootloader if you've made changes to the system, boot or other partitions (except userdata, this is why enabling cam2api and locking the BL won't mess up your device because the persist command stores the command in data partition). If you want to lock the BL, just flash the stock rom beforehand. Cheers.

Related

boot loop after installing twrp 2.8.7.2

so after i unlocked my bootloader, installed twrp 2.8.7.2, rebooted boot loader and went into recovery, i was greeted by twrp but it asked me for a decryption password (which i never set up) and Heisnberg said I wouldn't have worry about here under section 3 of how to decrypt the data partition "This is no longer necessary as long as you use TWRP 2.8.7.1 or newer". So I tried making a nandroid backup as normal, but that failed because twrp couldn't get to the data partition, unlike what Heisnberg said. So i just restarted the phone, and now I'm in a boot loop (about to flash factory image now).
So what I want to know is what twrp ppl use, do you have to do the decrypt data partition step, and the practical differences between systemless and nonsystemless root? why would anyone want to do systemless root if it doesn't work with all root apps?
Thank you so much for anyone who replies :angel:

bootloop after flashing recovery

hey,
I wanted to root my nexus 5x too, first I tried to do so with the nexus tool kit....
it was all working until it came to the root process:
it said in the log:
Rooting....
Waiting for your device....
and nothing else happened anymore.
So I tried it manually with a guide.
As the bootloader was already unlocked, I continued with flashing the recovery (twrp 2.8.7.2) in fastboot.
Then it rebooted into the recovery.
Then twrp asked me for a password, (Mount) decrypt Data. I skip it without entering a password. And I didn't add a pattern or PIN to unlock my phone at the first boot up.
I allowed the system modification then... so then before rebooting, twrp wasn't asking me if I want to flash the SuperSu.
Since this I'm stuck in a bootloop.
I can boot into the bootloader and recovery, I also tried to do a factory wipe or also formating data. But none of them worked for me. I'm still stuck in the bootloop...
I have no idea what to do now....
I'm really thankfull for every kind of help!
sorry wrong subforum...
Try to reflash TWRP over adb-console(on your pc) and then Root- Systemless version.
If you have any questions ask!!
Vulkaistos said:
Try to reflash TWRP over adb-console(on your pc) and then Root- Systemless version.
If you have any questions ask!!
Click to expand...
Click to collapse
I have to add something which i forgot to mention.....after I flashed the recovery and booted into it for the first time, twrp asked me for a password, (Mount) decrypt Data. I skip it without entering a password. And I didn't add a pattern or PIN to unlock my phone at the first boot up.
I'm not able boot my phone up anymore.... I can try to flash the recovery with fastboot again...if this is what you mean?
okay i pushed the supersu zip onto the phone, and just flashed it. And my phone is booting normally now
thank you very very much. you saved me and my phone
That's nice to hear.
Have Fun with your Phone!!!!!!!!!!!!!!

The terrible fate of refurbished N5X

Hi,
My Nexus 5X died some days ago, and Google shiped me another one. But this new device have the unbelievable "NO RPMB" message that locks the bootloader (this is a known issue where the bootloader is automatically re-locked after each reboot, making flashing factory images an harassing journey).
I installed TWRP to flash a custom rom but after each reboot on the system,TWRP was replaced by stock recovery !
Do anyone knows how resolve this problem ? I suppose if I can flash a custom rom it will solve a great part of the problem... I'm actually thinking of sell this new phone and get another device like oneplus.
Any help will be appreciated ! ?
Atok_fr said:
Hi,
My Nexus 5X died some days ago, and Google shiped me another one. But this new device have the unbelievable "NO RPMB" message that locks the bootloader (this is a known issue where the bootloader is automatically re-locked after each reboot, making flashing factory images an harassing journey).
I installed TWRP to flash a custom rom but after each reboot on the system,TWRP was replaced by stock recovery !
Do anyone knows how resolve this problem ? I suppose if I can flash a custom rom it will solve a great part of the problem... I'm actually thinking of sell this new phone and get another device like oneplus.
Any help will be appreciated !
Click to expand...
Click to collapse
Unlock bootloader, flash TWRP and boot straight to recovery without rebooting, perform a factory reset and root. That should make TWRP stick. If it doesn't, you can then use the TWRP manager to install TWRP again.
CazeW said:
Unlock bootloader, flash TWRP and boot straight to recovery without rebooting, perform a factory reset and root. That should make TWRP stick. If it doesn't, you can then use the TWRP manager to install TWRP again.
Click to expand...
Click to collapse
Thanks mate, it worked !
CazeW said:
Unlock bootloader, flash TWRP and boot straight to recovery without rebooting, perform a factory reset and root. That should make TWRP stick. If it doesn't, you can then use the TWRP manager to install TWRP again.
Click to expand...
Click to collapse
Quick question. As I just picked up a refurb N5X on the cheap and I plan to use it (fingers crossed it does have RPMB, not holding my breath though)- how viable are custom ROMs on this thing? The reddit thread that started this all states to leave /system unmodified but other comments say that they've flashed custom kernels.
So- if this is the case, would the order be unlock bootloader>flash stock images/noencrypt>flash TWRP>boot into TWRP> factory reset> boot into Oreo> unlock bootloader and boot into TWRP when modifications need to be made?
Thanks.
negusp said:
Quick question. As I just picked up a refurb N5X on the cheap and I plan to use it (fingers crossed it does have RPMB, not holding my breath though)- how viable are custom ROMs on this thing? The reddit thread that started this all states to leave /system unmodified but other comments say that they've flashed custom kernels.
So- if this is the case, would the order be unlock bootloader>flash stock images/noencrypt>flash TWRP>boot into TWRP> factory reset> boot into Oreo> unlock bootloader and boot into TWRP when modifications need to be made?
Thanks.
Click to expand...
Click to collapse
I use a custom kernel so that works just fine, haven't tried a custom ROM though. You don't have to unlock the bootloader every time to make changes as long as you have TWRP. I'm not entirely sure but I think rooting made the TWRP stick. If not, you can still install it from the TWRP app as you have root.
After you've installed the stock images, it should be enough to boot into TWRP, do a factory reset and flash the custom ROM.
CazeW said:
I use a custom kernel so that works just fine, haven't tried a custom ROM though. You don't have to unlock the bootloader every time to make changes as long as you have TWRP. I'm not entirely sure but I think rooting made the TWRP stick. If not, you can still install it from the TWRP app as you have root.
After you've installed the stock images, it should be enough to boot into TWRP, do a factory reset and flash the custom ROM.
Click to expand...
Click to collapse
So once TWRP is installed and "stuck", it can make modifications to traditionally "root" partitions (system, data, etc.?).
Also, did you flash the noforce encrypt boot image (and then wiping userdata)? Or does the stock image work?
negusp said:
So once TWRP is installed and "stuck", it can make modifications to traditionally "root" partitions (system, data, etc.?).
Also, did you flash the noforce encrypt boot image (and then wiping userdata)? Or does the stock image work?
Click to expand...
Click to collapse
Yes. I've for example installed all the OTAs from TWRP (except Oreo).
Stock image works.
CazeW said:
Yes. I've for example installed all the OTAs from TWRP (except Oreo).
Stock image works.
Click to expand...
Click to collapse
Thanks. Does DRM content work? I've also read conflicting reports as to apps like Netflix working on Oreo.
negusp said:
Thanks. Does DRM content work? I've also read conflicting reports as to apps like Netflix working on Oreo.
Click to expand...
Click to collapse
I don't use Netflix so can't say if that works but Play Movies worked on Nougat.
CazeW said:
Unlock bootloader, flash TWRP and boot straight to recovery without rebooting, perform a factory reset and root. That should make TWRP stick. If it doesn't, you can then use the TWRP manager to install TWRP again.
Click to expand...
Click to collapse
Hello, i have the same NO RPMB problem Im using latest stock rom 8.1 (December patch), radio, bootloader and vendor.
How can i boot straight into recovery without rebooting? Do i need to flash vendor.img too? (i would like flash latest AEX rom).
If im not wrong i should do this procedure as suggested right?
- unlock bootloader from fastboot
- flash latest twrp recovery from fastboot without rebooting (this will work? Because in the N5X root thread it's written to reboot first)
- get into twrp without rebooting (how do that?)
- install root (i will use latest Magisk)
- perform factory reset
- wipe system, data, cache, and dalvik cache
- install custom rom, gapps...
- wipe cache and dalvik, and reboot
Finally i will have a rooted device with custom rom and bootloader locked again right?
Or is preferred this solution of Reddit user?
https://www.reddit.com/r/nexus5x/comments/5hj0r0/bootloop_after_lg_replaced_mainboard_bootloader
sigibian said:
Hello, i have the same NO RPMB problem Im using latest stock rom 8.1 (December patch), radio, bootloader and vendor.
How can i boot straight into recovery without rebooting? Do i need to flash vendor.img too? (i would like flash latest AEX rom).
If im not wrong i should do this procedure as suggested right?
- unlock bootloader from fastboot
- flash latest twrp recovery from fastboot without rebooting (this will work? Because in the N5X root thread it's written to reboot first)
- get into twrp without rebooting (how do that?)
- install root (i will use latest Magisk)
- perform factory reset
- wipe system, data, cache, and dalvik cache
- install custom rom, gapps...
- wipe cache and dalvik, and reboot
Finally i will have a rooted device with custom rom and bootloader locked again right?
Or is preferred this solution of Reddit user?
https://www.reddit.com/r/nexus5x/comments/5hj0r0/bootloop_after_lg_replaced_mainboard_bootloader
Click to expand...
Click to collapse
I haven't tried this with a custom ROM but I would try it like this.
- Unlock bootloader from fastboot
- Flash TWRP from fastboot
- Select boot to recovery from the fastboot menu
- Do a factory reset
- Wipe system, cache, and dalvik cache
- Flash ROM, flash Gapps
- Flash Magisk
- Reboot

TWRP issue with stock moto fimrware :/

Hi so I was using resurrection remix but after finding my stock phone software NPP25.137-15 online I erased everything and flashed through fastboot it went perfectly and I re-locked my bootloader
but I decided to unlock my bootloader again so I could use magisk on stock firmware
my bootloader unlocked and phone still booted but my problem is with twrp
I powered off my phone
held power and volume down
connected my phone to pc while in bootloader
typed fastboot devices
typed fastboot flash recovery twrp.img
pressed power button on phone to reboot phone ( I didn't boot into recovery )
my Moto G5 XT1675 halts at phone can't be trusted ( bootloader is unlocked screen )
any idea why I can't flash twrp?
Because you haven't disabled dm verity on your device, you can't boot stock firmware with twrp while verity is still enabled, flash this: https://androidfilehost.com/?fid=673368273298927206
If it still doesn't boot, flash stock firmware again via fastboot, then flash twrp and boot DIRECTLY into twrp after it is finished installing, then trying flashing no-verity-opt-encrypt again.
Exanneon said:
Because you haven't disabled dm verity on your device, you can't boot stock firmware with twrp while verity is still enabled, flash this: https://androidfilehost.com/?fid=673368273298927206
If it still doesn't boot, flash stock firmware again via fastboot, then flash twrp and boot DIRECTLY into twrp after it is finished installing, then trying flashing no-verity-opt-encrypt again.
Click to expand...
Click to collapse
What exactly does this file do?
Also I flashed magisk which I knew modifies the boot image and the device booted perfectly with TWRP using the magisk modified boot image if that's anything interesting?
Pretty much I was working on a way to install stock firmware through twrp a few weeks ago so people would not have to use fastboot ( I know how to convert a phone backup to a flashable zip )
The flashable zip worked fine but it only booted using a modified boot file, could this be because it needs DM verity disabled?
Although twrp can restore the system image and what is on the internal storage, it will never be a fully functioning substitute for restoring stock firmware via fastboot, twrp can not run scripts that fastboot can, such as 'fastboot oem lock', I also believe that although it can restore bootloader.img and oem.img via a flashable zip, it would most likely cause the device to brick, so simply put; do not try to use twrp for what it's not meant for, twrp is a recovery for flashing zips, restoring only the system image and storage, flashing recoveries and reformatting partitions (which can be risky), just use fastboot for restoring stock firmware.
And yes, your device will boot with magisk installed as it serves the same purpose as no verity opt 5.1 and later versions, though it is usually recommended to disable dm verity before flashing magisk to stay on the safe side.
The flashable zip you installed on your device only booted with a modified boot file as it is not fully stock firmware, twrp is only capable of flashing some elements of stock firmware, this is why you can boot with dm verity still active after restoring with fastboot, again do not use twrp for restoring stock, use fastboot.
Exanneon said:
Although twrp can restore the system image and what is on the internal storage, it will never be a fully functioning substitute for restoring stock firmware via fastboot, twrp can not run scripts that fastboot can, such as 'fastboot oem lock', I also believe that although it can restore bootloader.img and oem.img via a flashable zip, it would most likely cause the device to brick, so simply put; do not try to use twrp for what it's not meant for, twrp is a recovery for flashing zips, restoring only the system image and storage, flashing recoveries and reformatting partitions (which can be risky), just use fastboot for restoring stock firmware.
And yes, your device will boot with magisk installed as it serves the same purpose as no verity opt 5.1 and later versions, though it is usually recommended to disable dm verity before flashing magisk to stay on the safe side.
The flashable zip you installed on your device only booted with a modified boot file as it is not fully stock firmware, twrp is only capable of flashing some elements of stock firmware, this is why you can boot with dm verity still active after restoring with fastboot, again do not use twrp for restoring stock, use fastboot.
Click to expand...
Click to collapse
it's not meant to be a substitute, and I know only fastboot can do OEM lock, flash partition files, modem files,etc, I've been testing my TWRP version for a while, the oem.img partition is not needed in the TWRP versionas the majority of custom roms for Moto G5 don't touch the oem partition and the oem.img file hasn't changed between the stock updates, the TWRP version is for people who want stock firmware but still want to keep twrp, flash magisk, etc, also because TWRP is a portable method and much faster flashing the system back than through fastboot flashing the system back, my twrp version is only meant to restore the system partition and a dm-verity disabled boot.img I wouldn't even think of flashing a bootloader through anything other than fastboot, I've tested a lot and have not bumped into any problems using TWRP that has caused me to use a computer, actually there has been no problems + I'm also testing on 3 other moto G5's all 3 which are also XT1675 models and same there no problems
Then your query has been resolved.
Exanneon said:
Then your query has been resolved.
Click to expand...
Click to collapse
yes, how do I go about closing this discussion well if you know how to?
Rename it to [closed], that's what many do.

Experience os 43 to completely stock

I'm on Experience OS 43 (OB) i wanted to go back to stock completely and lock the bootloader. If I do following can I completely go back to stock ?
Copy OB/OOS zip file to internal storage
Flash stock recovery (fastboot)
Clean Flash OOS from recovery
Setup the device
Lock bootloader
werty733 said:
I'm on Experience OS 43 (OB) i wanted to go back to stock completely and lock the bootloader. If I do following can I completely go back to stock ?
Copy OB/OOS zip file to internal storage
Flash stock recovery (fastboot)
Clean Flash OOS from recovery
Setup the device
Lock bootloader
Click to expand...
Click to collapse
First thing.. Never lock the bootloader. Unlocked bootloader comes bearing gifts. Eg: if you somehow face issues you can use unlocked bootloader to flash twrp to recover at least data.
Take a complete backup if all your data, internal storage , System partion just in case.
Now if you want to go back to stock, first flash twrp(if you dont have) , wipe data/cache/dalvik partition complete.
Donot wipe internal storage for now.
Now goto bootloader, flash stock recovery based on your OS version.
Now reboot to recovey.
Now flash stock OOS.
Now wipe everything if you donot want internal storafe data.
If you want it, try to boot. If everything goes good, its fine. Else. You have a encrypted internal storage and you have to wipe everything with stock recovey
Never lock bootloader if you unlocked it already.
Never lock bootloader if you unlocked it.already.
Never lock bootloader if you unlocked it already

Categories

Resources