How To Guide How to manually switch the active slot - ASUS ZenFone 8

How to manually switch the active slot
Switching the active slot on phones with A/B slots is normally only used by the updater to install a new OS update (see https://source.android.com/docs/core/ota/ab for details)
This functionality can also be quite useful if you have two different operating systems on your phone and want to switch between them without reinstalling.
Since the data on all partitions that do not belong to the A/B partitions is used by both operating systems (the one in slot A and the one in slot B), this functionality is limited by the installed operating systems.
The data in most partitions that are only present once should be usable for all operating systems (see here), but this does not apply to the data in the partition that is mounted to /data.
Switching the active slot does work if the OS (including the OS version) installed in slot A and B are equal. It does work most of the time if the OS installed in slot A and B are equal but with different OS versions.
And it should work if the OS installed in slot A and slot B use different directories in /data, e.g. in slot A is a Android based OS installed and in slot B a not on Android based OS (like for example pocketMarketOS)
It does not work (most of the times) if there are different Android distributions in slot A and B: e.g. I did not get it to work if the OS in slot A is the original Android 12 from ASUS and the OS in slot B is OmniROM 12.
(Probably it would work after removing one or more OS related directories from /data but I do not know which - infos on how to use these OS in parallel are welcome)
The instructions below where done on an ASUS Zenfone 8 but I believe they should work with other phones with A/B slots also.
Please note that you should have a working TWRP image for your phone on hand to restore the active slot in case of boot problems.
To get the current slot while the OS is running use the shell command getprop, e.g. execute in a shell on the phone or in an adb shell:
Code:
[email protected]_I006D:/ # getprop ro.boot.slot_suffix
_a
[email protected]_I006D:/ #
To get the active slot in fastboot mode or while the phone is booted into the bootloader execute on the PC connected to the phone:
Code:
sudo fastboot getvar current-slot
There are various methods to manual switch the active slot:
1. Switching the slot using fastboot
Switching the slot via fastboot works if TWRP is installed in the boot partition.
To use it connect the phone to an USB port of the PC and issue these commands on the PC:
Bash:
# boot the phone into fastboot either if in the bootloader
#
sudo fastboot reboot fastboot
#
# or if the phone is booteind into the recovery or in the normal mode
#
adb reboot fastboot
# wait until the phone is booted in fastboot mode
# get the current slot
#
sudo fastboot getvar current-slot
# change the current slot
#
sudo fastboot set_active b
# check the result
#
sudo fastboot getvar current-slot
# reboot the phone from new current-slot
#
sudo fastboot reboot
Example:
Code:
[email protected] /data/develop/android/scripts_on_linux]$ sudo fastboot reboot
Rebooting OKAY [ 0.000s]
Finished. Total time: 0.201s
[[email protected] /data/develop/android/scripts_on_linux]$ adb reboot fastboot
[[email protected] /data/develop/android/scripts_on_linux]$ sudo fastboot getvar current-slot
current-slot: a
Finished. Total time: 0.001s
[[email protected] /data/develop/android/scripts_on_linux]$
[[email protected] /data/develop/android/scripts_on_linux]$ sudo fastboot set_active b
Setting current slot to 'b' OKAY [ 0.042s]
Finished. Total time: 0.043s
[[email protected] /data/develop/android/scripts_on_linux]$
[[email protected] /data/develop/android/scripts_on_linux]$
[[email protected] /data/develop/android/scripts_on_linux]$ sudo fastboot getvar current-slot
current-slot: b
Finished. Total time: 0.000s
[[email protected] /data/develop/android/scripts_on_linux]$
[[email protected] /data/develop/android/scripts_on_linux]$ sudo fastboot reboot
Rebooting OKAY [ 0.000s]
Finished. Total time: 0.251s
# check the result
#
[[email protected] /data/develop/android/scripts_on_linux]$ adb shell getprop ro.boot.slot_suffix
_b
[[email protected] /data/develop/android/scripts_on_linux]$
Notes:
Switching the active slot in fastboot mode does not work if the boot image from the original Android 12 from ASUS or from the OmniROM is installed:
Code:
[[email protected] /data/develop/android/scripts_on_linux]$ sudo fastboot set_active b
Setting current slot to 'b' FAILED (remote: 'Unable to set slot')
fastboot: error: Command failed
[[email protected] /data/develop/android/scripts_on_linux]$
The same is true it the phone is booted into the bootloader:
Code:
[ OmniRomDev - [email protected] /data/develop/android/test ] $ sudo fastboot --set-active=a
Setting current slot to 'a' FAILED (remote: 'Slot Change is not allowed in Lock State')
fastboot: error: Command failed
[ OmniRomDev - [email protected] /data/develop/android/test ] $
Be aware that changing the lock state via
Code:
fastboot flashing lock|unlock
will do a factory reset.
2. Switching the slot using TWRP
The active slot for the next reboot can also be changed in the reboot dialog from TWRP.
This can also be done if the phone is booted from the TWRP image.
Note:
This is the fallback to get the phone booting again in case the reboot of the other slot fails for whatever reason.
3. Switching the Slot via Magisk
The active slot can also be changed in the Magisk App. This is used to update the boot partition after an OTA (see here https://topjohnwu.github.io/Magisk/ota.html for details) but can also be used to manual change the active slot.
Open the Magisk App and choose the "install" button to install Magisk into the boot partition. In the next dialog use the method "Install to inactive Slot (After OTA)".
This works also if no update (OTA) was installed and it does not change the Magisk config - it just replaces the Magisk files in the inactive boot partition and activates the inactive boot partition. To reboot the phone then from the now active partition press the "Reboot" button after the update of the boot partition by Magisk is done.
This only works if the OS in both slots is supported by Magisk, of course.
4. Using the binary bootctl
There is binary called bootctl that can be used to switch the active slot. The source code of bootctl is part of the source for the Android OS but as far as I know the binary is not compiled by default and therefor also not installed on the phone.
But there is Magisk module to install the bootctl binary; that Magisk Module can be downloaded from here:
https://github.com/roihershberg/bootctl-binary
Unfortunately the current version of the Magisk Module with bootctl does not install and work out of the box on Android 12 or OmniROM 12 for the ASUS Zenfone 8. Therefor I created a corrected version of the Magisk Module.
The corrected Magisk Module can be downloaded here:
https://bnsmb.de/files/public/Android/bootctl-binary-v2.1.1.zip
The Changelog for the corrected Magisk module for bootctl is:
Update 21.09.2022 /bs
- changed the max. API version in customize.sh to 32 so that the module can be installed in Android 12
- renamed the binary to bootctl.bin
- added the wrapper script bootctl to start bootctl because the directory /vendor/lib64 with the necessary libraries for the binary is not in the default library path in Android 12
Click to expand...
Click to collapse
bootctl must be executed by the root user in a shell on the phone or in an adb shell.
To change the active slot with bootctl use
Code:
bootctl set-active-boot-slot SLOT
SLOT is either 0 (for slot A) or 1 (for slot B); the next reboot will then boot from that slot.
To get the active booted slot with bootctl use
Code:
bootctl get-current-slot
Notes:
The usage help for bootctl is:
Code:
[email protected]_I006D:# bootctl -h
./bootctl - command-line wrapper for the boot HAL.
Usage:
./bootctl COMMAND
Commands:
hal-info - Show info about boot_control HAL used.
get-number-slots - Prints number of slots.
get-current-slot - Prints currently running SLOT.
mark-boot-successful - Mark current slot as GOOD.
get-active-boot-slot - Prints the SLOT to load on next boot.
set-active-boot-slot SLOT - On next boot, load and execute SLOT.
set-slot-as-unbootable SLOT - Mark SLOT as invalid.
is-slot-bootable SLOT - Returns 0 only if SLOT is bootable.
is-slot-marked-successful SLOT - Returns 0 only if SLOT is marked GOOD.
get-suffix SLOT - Prints suffix for SLOT.
set-snapshot-merge-status STAT - Sets whether a snapshot-merge of any dynamic
partition is in progress. Valid STAT values
are: none, unknown, snapshotted, merging,
or cancelled.
get-snapshot-merge-status - Prints the current snapshot-merge status.
SLOT parameter is the zero-based slot-number.
The source code for bootctl is here:
https://android.googlesource.com/platform/system/extras/+/master/bootctl/bootctl.cpp
https://android.googlesource.com/pl...ware/+/master/include/hardware/boot_control.h
There is also a simple app to change the active slot via the bootctl binary: Switch-My-Slot-Android
Note that the app can only be installed after the Magisk Module for bootctl is installed.
Trouble Shooting
If you get an error like this after rebooting from the previously inactive slot
Code:
Cannot load Android System. Your data may be corrupt. if you continue o get this message, you may need to perform a factory data reset and erase all user data storeed on this device
or if the phone boots only in the bootloader after the reboot from the previously inactive slot boot the phone from the TWRP image to activate the previous slot again.
e.g. for the phone ASUS Zenfone 8:
Code:
sudo fastboot boot /data/backup/ASUS_ZENFONE8/twrp/twrp-3.6.1_12-1-I006D.img
Then in TWRP select to reboot the phone and in the dialog to reboot switch the slot back to the previous active slot. You can ignore the error messages printed by TWRP after changing the active slot - just continue rebooting the phone.
Note:
On the ASUS Zenfone 8 press the buttons Up, Down, and Power at the same time for about 10 or more seconds to turn off the phone. Afterwards you can boot into the bootloader.
History
06.11.2022 /bs
The section about changing the slot in fastboot mode was not correct: fastboot mode and bootloader mode are differents states of the phone.
06.11.2022 /bs (2)
Switching the slot in fastboot mode does only work if TWRP is installed in the boot partition

Can i change slot via wifi adb? I'm not root

xaloundros said:
Can i change slot via wifi adb? I'm not root
Click to expand...
Click to collapse
If connecting via Wifi adb you can only change the current slot using a CLI command while the Android OS is running . And as far as I know changing the active slot in an adb session can only be done by the user root.
regards
Bernd

bnsmb said:
If connecting via Wifi adb you can only change the current slot using a CLI command while the Android OS is running . And as far as I know changing the active slot in an adb session can only be done by the user root.
regards
Bernd
Click to expand...
Click to collapse
Thank you for answer, i have problem with my phone and my pc doesn't recognize when is fastboot mode that's I ask if I can change the slot via wifi

xaloundros said:
Thank you for answer, i have problem with my phone and my pc doesn't recognize when is fastboot mode that's I ask if I can change the slot via wifi
Click to expand...
Click to collapse
Hi
just out of curiosity:
so why do you want to change the slot?
I'm assuming you've already done the obvious, like changing the cable or using a different operating system on your PC via LIve CD or something similar to get the USB connection working.
Without root access and without a working USB connection IMHO the only method to change the active slot is to install an OS update.
regards
Bernd

bnsmb said:
Hi
just out of curiosity:
so why do you want to change the slot?
I'm assuming you've already done the obvious, like changing the cable or using a different operating system on your PC via LIve CD or something similar to get the USB connection working.
Without root access and without a working USB connection IMHO the only method to change the active slot is to install an OS update.
regards
Bernd
Click to expand...
Click to collapse
I try everything cable other pc different ports because i have rog 3 but because I was playing around with diag mode i believe that i make damage on Motherboard.
I like to change slot because i was android 11 with Root and TWRP and i make ota update to android 12 and I'm thinking if i change slot maybe i still have root and TWRP installed on inactive slot.

xaloundros said:
I try everything cable other pc different ports because i have rog 3 but because I was playing around with diag mode i believe that i make damage on Motherboard.
I like to change slot because i was android 11 with Root and TWRP and i make ota update to android 12 and I'm thinking if i change slot maybe i still have root and TWRP installed on inactive slot.
Click to expand...
Click to collapse
which recovery is installed in your working slot?

bnsmb said:
which recovery is installed in your working slot?
Click to expand...
Click to collapse
Stock rocovery

xaloundros said:
Stock rocovery
Click to expand...
Click to collapse
then I'm out of ideas here

bnsmb said:
then I'm out of ideas here
Click to expand...
Click to collapse
Thank you for your help

Thanks much.
I softbricked oneplus 8 pro last night after I tried to flash a boot.img patched with Magisk.
I successfully changed the slot to b using
sudo ./fastboot set_active b.
The phone can boot with slot b now but it start from the Hello screen which means I have to set up the phone from scratch. Will it erase everything if I set up the phone again? I am a bit hesitating if I will lose all data.

huangjqiu said:
Thanks much.
I softbricked oneplus 8 pro last night after I tried to flash a boot.img patched with Magisk.
I successfully changed the slot to b using
sudo ./fastboot set_active b.
The phone can boot with slot b now but it start from the Hello screen which means I have to set up the phone from scratch. Will it erase everything if I set up the phone again? I am a bit hesitating if I will lose all data.
Click to expand...
Click to collapse
Will it erase everything if I set up the phone again? I am a bit hesitating if I will lose all data.
Click to expand...
Click to collapse
It shouldn't ... but I recommend to power off the phone, boot the phone from a TWRP recovery image, backup your data and then reboot the Android OS again to finish the config
regards
Bernd

bnsmb said:
It shouldn't ... but I recommend to power off the phone, boot the phone from a TWRP recovery image, backup your data and then reboot the Android OS again to finish the config
regards
Bernd
Click to expand...
Click to collapse
Unfortunately, there is no TWRP recovery image for Oneplus 8 Pro on Android 13. It took me hours to set up the phone and customize it. Luckily most data can be recovered from google backup.

huangjqiu said:
Unfortunately, there is no TWRP recovery image for Oneplus 8 Pro on Android 13. It took me hours to set up the phone and customize it. Luckily most data can be recovered from google backup.
Click to expand...
Click to collapse
Is there a recovery from LineageOS for that phone?
There is also adb support in the recovery from the LineageOS (at least for the Asus Zenfone 8) but it must be enabled manually in the booted Recovery
regards
Bernd

I am not familiar with custom ROMs. I have always been using stock ROM with this phone. Thanks for the suggestion! I will keep that in mind next time when updates go wrong.

bnsmb said:
Is there a recovery from LineageOS for that phone?
There is also adb support in the recovery from the LineageOS (at least for the Asus Zenfone 8) but it must be enabled manually in the booted Recovery
regards
Bernd
Click to expand...
Click to collapse
Stealing the thread a bit here
I moved from MIUI to LOS20 on my Mi mix 4 which uses A/B, after using it for a while some bugs were found (probably due to dirty flashing 2-3 times across the updates). Is there any way to completely format the system partition (wherever that is) so I can install the latest LOS again cleanly? I noticed that by installing without wiping system (which isn't possible on A/b for what I tried) the install isn't clean. Some apps are logged in right after re-install

abcezx said:
Stealing the thread a bit here
I moved from MIUI to LOS20 on my Mi mix 4 which uses A/B, after using it for a while some bugs were found (probably due to dirty flashing 2-3 times across the updates). Is there any way to completely format the system partition (wherever that is) so I can install the latest LOS again cleanly? I noticed that by installing without wiping system (which isn't possible on A/b for what I tried) the install isn't clean. Some apps are logged in right after re-install
Click to expand...
Click to collapse
AFAIK the installation of a new OS image with Android will always overwrite the system partition. The system partition is read-only after the installation so new applications will never be written to the system partition. Instead installed applications are written into directories in the data partition . That's the reason why your application and configuration survives an OS upgrade (the OS upgrade will never touch the files in the data partition)
So to get rid of your applications either deinstall them before installing the new OS or do a factory reset (but be aware that a factory reset will delete ALL applications and user data)
There is an option to do a factory reset in the LineageOS recovery used for the installation of LOS.
IMHO it's recommended to do a factory reset before switching from one OS distribution to another (I assume MIUI is the original Android that is most probably only partially compatible with LOS)
And for the records:
In the latest Android version /system and some other partitions are not physical partitions anymore -- they are now "dynamic" partitions. Dynamic partitions are in the end only logical volumes on one of the physical volumes.
Hope this helps
regards
Bernd

bnsmb said:
AFAIK the installation of a new OS image with Android will always overwrite the system partition. The system partition is read-only after the installation so new applications will never be written to the system partition. Instead installed applications are written into directories in the data partition . That's the reason why your application and configuration survives an OS upgrade (the OS upgrade will never touch the files in the data partition)
So to get rid of your applications either deinstall them before installing the new OS or do a factory reset (but be aware that a factory reset will delete ALL applications and user data)
There is an option to do a factory reset in the LineageOS recovery used for the installation of LOS.
IMHO it's recommended to do a factory reset before switching from one OS distribution to another (I assume MIUI is the original Android that is most probably only partially compatible with LOS)
And for the records:
In the latest Android version /system and some other partitions are not physical partitions anymore -- they are now "dynamic" partitions. Dynamic partitions are in the end only logical volumes on one of the physical volumes.
Hope this helps
regards
Bernd
Click to expand...
Click to collapse
Bernd, you just enlightened me better than my 3-day-self-digging on the interwebz. Thanks a lot!
I did use LOS's factory reset feature right after this reply and while it seemed to have done it (strangely, by some operations on TWRP), it seems like the old problem still occurs: some apps are logged in right after re-install, the bugs associated with them are there as well (little bugs like videos can't play in apps, Gmail not loading chat properly).
This drove me crazy because even after re-flashing stock ROM in Fastboot, wipe internal multiple times, i believe some partition (likely data?) has never been wiped cleanly, leaving the bugs intact after every re-flash, no matter what ROM I picked.
So my question is, is there anyway to make sure I have a clean Flash? Like REALLY clean.
Again, thank you for your reply, while it didn't immediately solve my problem for now, it helped me a lot with understanding this A/B super device thingy.

abcezx said:
Bernd, you just enlightened me better than my 3-day-self-digging on the interwebz. Thanks a lot!
I did use LOS's factory reset feature right after this reply and while it seemed to have done it (strangely, by some operations on TWRP), it seems like the old problem still occurs: some apps are logged in right after re-install, the bugs associated with them are there as well (little bugs like videos can't play in apps, Gmail not loading chat properly).
This drove me crazy because even after re-flashing stock ROM in Fastboot, wipe internal multiple times, i believe some partition (likely data?) has never been wiped cleanly, leaving the bugs intact after every re-flash, no matter what ROM I picked.
So my question is, is there anyway to make sure I have a clean Flash? Like REALLY clean.
Again, thank you for your reply, while it didn't immediately solve my problem for now, it helped me a lot with understanding this A/B super device thingy.
Click to expand...
Click to collapse
Hi
This drove me crazy because even after re-flashing stock ROM in Fastboot, wipe internal multiple times, i believe some partition (likely data?) has never been wiped cleanly, leaving the bugs intact after every re-flash, no matter what ROM I picked.
Click to expand...
Click to collapse
If the errors also occurs if the original ROM is installed it might be a general (Hardware?) problem with the phone.
So my question is, is there anyway to make sure I have a clean Flash? Like REALLY clean.
Click to expand...
Click to collapse
AFAIK a factory reset should delete all apps and user data on all phones. The default partition for all user data and apps is the partition mounted to /data.
To check that the factory reset was done you might boot your phone from the TWRP image connect via adb and check that /data is mounted to the data partition and that there are no files or directories except /data/recovery in /data.
On the other hand nowadays there are a lot of partitions with device specific files on the phones. There should be no user data or apps in these partitions but you newer know.
For the ASUS Zenfone 8 ASUS provides a "raw" image that will overwrite every partition on the phone with the original data but I doubt that this also exists for other phones.
regards
Bernd

bnsmb said:
Hi
If the errors also occurs if the original ROM is installed it might be a general (Hardware?) problem with the phone.
AFAIK a factory reset should delete all apps and user data on all phones. The default partition for all user data and apps is the partition mounted to /data.
To check that the factory reset was done you might boot your phone from the TWRP image connect via adb and check that /data is mounted to the data partition and that there are no files or directories except /data/recovery in /data.
On the other hand nowadays there are a lot of partitions with device specific files on the phones. There should be no user data or apps in these partitions but you newer know.
For the ASUS Zenfone 8 ASUS provides a "raw" image that will overwrite every partition on the phone with the original data but I doubt that this also exists for other phones.
regards
Bernd
Click to expand...
Click to collapse
Thanks again Bernd, I think I might have to check if a factory reset was properly done using the command you mentioned, can you show me how to do that?

Related

Can't Root, Can't Update TWRP - Something Fishy Happening

I can't work out what's going on.
My phone lost it's root a few days ago - I only noticed when Magisk said it had a new one. So here's the lowdown:
My TWRP is out of date.
Magisk is out of date.
I've downloaded both the magisk.zip file and an img file of the latest TWRP.
I put them on the deskop, in the adb folder (in C drive) and on the phone under "downloads".
Boot into recovery, but when I navigate to install a zip file, it can only see the system files, no "downloads" folder or pictures or anything. I can't seem to change that.
Use Powershell to try and sideload the TWRP zip and it says "waiting for device" - that seems good. However, when i then boot into fastboot mode, Powershell tells me "error: cannotload twrp... .img"
So I try and look at Magisk, but I can only download the zip (of which I've done and can't flash it via recovery), or patch boot file, of which I can't navigate to as I'm currently not rooted so it can't find the boot file anyway.
What do I type into Powershell to flash the latest Magisk (I guess I can then update TWRP after using the in-
built updater?)?
When in TWRP, I click on the three lines on the right, which say:
Could not muont /data and unable to find crypto footer.
Failed to mount '/data' (no such process)
Unable to recreate /data/media folder,.
Updating partition details
Failed to mount '/data' (no such process)
... done
Unable to mount storage
Failed to mount '/data' (no such process)
Full SELinux support is present
Unable to mount /data/media/TWRP/.twrps
MTP Enabled
Failed to mount '/data' (no such process)
Click to expand...
Click to collapse
What can be causing all of this?
Probably rip UFS chip, if
Code:
fastboot format userdata
won't help, then you should send your phone for repair
Hmm.
So the only fix is to format all the data?
What data gets deleted?
I don't really want to do that if I can help it but I guess it's the only way to fix it.
Strange how it's just done it by itself.
anotherxdauser said:
Hmm.
So the only fix is to format all the data?
What data gets deleted?
I don't really want to do that if I can help it but I guess it's the only way to fix it.
Strange how it's just done it by itself.
Click to expand...
Click to collapse
Is the system bootable? If yes, then you can make a backup, if not, then you can consider your data gone.
"format userdata" removes everything you have stored on the phone
Yeah, I can boot to my Resurrection Remix rom and see everything, all my files, it's fine.
I can connect to a PC and move files to and fro the device.
It's just TWRP doesn't seem to see the storage. When looking, it just says 0Mb :S
Does Userdata mean the apps and stuff as well?
I saw a video of someone formatting the userdata to ex2, then back to ex4 but if it means I'd have to reinstall RR then it's a lot of work for something that may happen again in the near future.
I have Titanium Backup but of course, it needs root, of which I can't gain :/
Sounds a lot like a failed decrypt of an encrypted userdata partition, this is common in this phone with TWRP and custom ROMs.
Skickat från min ONEPLUS A3003 via Tapatalk
pitrus- said:
Sounds a lot like a failed decrypt of an encrypted userdata partition, this is common in this phone with TWRP and custom ROMs.
Click to expand...
Click to collapse
Is there non-destructive way to fix?
Oh, ok, I thought that the system is broken too. That's ok then, your memory chip is fine.
Can you boot an up-to-date TWRP from fastboot and try to access data?
Try with
Code:
fastboot boot twrp-3.2.3-0-oneplus3.img
Which TWRP version do you have exactly?
Sent from my ONEPLUS A3003 using Tapatalk
przemcio510 said:
Oh, ok, I thought that the system is broken too. That's ok then, your memory chip is fine.
Can you boot an up-to-date TWRP from fastboot and try to access data?
Try with
Code:
fastboot boot twrp-3.2.3-0-oneplus3.img
Click to expand...
Click to collapse
Yeah, try this first. Problably you have a twrp lower than 3.2.0? I think below that it cannot decrypt Oreo encrypted Partitions.
Second thing is. Probably you have to format Data (not Userdata) anyway. I think you probably tried to upgrade Magisk because you lost root. But Magisk hat a bug in 17.0. That corrupted the permission Database. I had the same problem and was not able to get root again until formatted data. You will loose every app and its setting when formatting it. But everything under sdcard/ will still be there. So the download folder should be fine and everything. So when you make a titanium backup of your most valuable apps. You can restore them after renewing your phone.
TLDR:
1. Make Titanium Backup if you have it and want to have your apps back as before.
2. Try przemcio510 suggestion to get new TWRP. (most important)
3. backup your partitions and copy them to your pc
4. backup everything importantto you on your "SDCard" Volume (Where Download is and everything)
5. format DATA, Cache, Dalvik/ART Cache, System
4. Reflash Full OxygenOS 5.0.5
(optional) 5. Flash Rom of your flavor (with/without Gapps)
(optional) 6. Flash magisk
7. boot up your device
przemcio510 said:
Oh, ok, I thought that the system is broken too. That's ok then, your memory chip is fine.
Can you boot an up-to-date TWRP from fastboot and try to access data?
Try with
Code:
fastboot boot twrp-3.2.3-0-oneplus3.img
Click to expand...
Click to collapse
Did this. ADB said it was "waiting for device" so I rebooted to fastboot but then the ADB window shows some options (see quote below), nothing to show it's done anything.
I put the img file on the sim card on the phone and in the directory of the adb.
Code:
PS C:\WINDOWS\system32> fastboot twrp-3.2.3-0-oneplus3.img
usage: fastboot [ <option> ] <command>
commands:
update <filename> reflash device from update.zip
flashall flash boot, system, vendor and if found,
recovery
flash <partition> [ <filename> ] write a file to a flash partition
erase <partition> erase a flash partition
format[:[<fs type>][:[<size>]] <partition> format a flash partition.
Can override the fs type and/or
size the bootloader reports.
getvar <variable> display a bootloader variable
boot <kernel> [ <ramdisk> [ <second> ] ] download and boot kernel
flash:raw boot <kernel> [ <ramdisk> [ <second> ] ] create bootimage and
flash it
devices list all connected devices
continue continue with autoboot
reboot reboot device normally
reboot-bootloader reboot device into bootloader
help show this help message
options:
-w erase userdata and cache (and format
if supported by partition type)
-u do not first erase partition before
formatting
-s <specific device> specify device serial number
or path to device port
-l with "devices", lists device paths
-p <product> specify product name
-c <cmdline> override kernel commandline
-i <vendor id> specify a custom USB vendor id
-b <base_addr> specify a custom kernel base address.
default: 0x10000000
-n <page size> specify the nand page size.
default: 2048
-S <size>[K|M|G] automatically sparse files greater
than size. 0 to disable
PS C:\WINDOWS\system32>
RASTAVIPER said:
Which TWRP version do you have exactly?
Click to expand...
Click to collapse
3.1.1-0
S4RGE said:
TLDR:
1. Make Titanium Backup if you have it and want to have your apps back as before.
2. Try przemcio510 suggestion to get new TWRP. (most important)
3. backup your partitions and copy them to your pc
4. backup everything importantto you on your "SDCard" Volume (Where Download is and everything)
5. format DATA, Cache, Dalvik/ART Cache, System
4. Reflash Full OxygenOS 5.0.5
(optional) 5. Flash Rom of your flavor (with/without Gapps)
(optional) 6. Flash magisk
7. boot up your device
Click to expand...
Click to collapse
My Titanium Backup needs root to work :/
It might have been when I upgraded RR Rom to the Oreo release, but it's only been the past week when I mysteriously lost root access.
anotherxdauser said:
Did this. ADB said it was "waiting for device" so I rebooted to fastboot but then the ADB window shows some options
Click to expand...
Click to collapse
To be clear, I think you mean fastboot whenever "ADB" is mentioned above. adb and fastboot are related, but 2 different things, with different usages and requirements. So it's best to refer to them in correct and distinct terms.
adb: Needs debugging enabled. Will work only in OS or custom recovery. Will not work in bootloader (even in fastboot mode) - maybe this is why you have "waiting for device"?
fastboot: Does not need debugging enabled. Only works in bootloader-fastboot mode.
fastboot is what you want for booting/flashing TWRP. Not adb (at least for the commands/methods suggested here).
anotherxdauser said:
PS C:\WINDOWS\system32> fastboot twrp-3.2.3-0-oneplus3.img
Click to expand...
Click to collapse
When command prompt shows you the list of command, this almost always means your command syntax is incorrect.
In your case, you used typed "fastboot" and a file name, without telling it what to do with that file name. The suggested command was "fastboot boot filename" (no quotes) or another usage option is "fastboot flash filename".
A little confusing I know, "fastboot" in itself is not a full command/action. I has to be "fastboot boot". Think of fastboot as a "thing" instead of an action. Thus, you still need to tell fastboot to perform an action ("boot").
anotherxdauser said:
...
3.1.1-0
My Titanium Backup needs root to work :/
It might have been when I upgraded RR Rom to the Oreo release, but it's only been the past week when I mysteriously lost root access.
Click to expand...
Click to collapse
Ah right I forgot.
As redpoint73 mentioned you have to be in fastboot mode.
When you start up your phone and the unlock Warning ist triggered. Push the volume up or down button and go to fastboot.
When you are in there the fastboot command should work.
As redpoint73 pointed out it is very important that you type "fastboot boot (ImagePath)".
To make it easier for you, you should copy the image where fastboot is.
Then you have only to enter
fastboot boot twrp-3.2.3-0-oneplus3.img
This should do the trick. If you still need help. Don't hesitate to ask.
redpoint73 said:
To be clear, I think you mean fastboot whenever "ADB" is mentioned above. adb and fastboot are related, but 2 different things, with different usages and requirements. So it's best to refer to them in correct and distinct terms.
In your case, you used typed "fastboot" and a file name, without telling it what to do with that file name. The suggested command was "fastboot boot filename" (no quotes) or another usage option is "fastboot flash filename".
Click to expand...
Click to collapse
Sorry my explanation isn't that great.
Whenever I've mentioned adb it's the dos/command prompt window.
Fastboot is that small menu where it shows whether the device bootloader is locked or not isn't it?
At any rate, tried "fastboot boot twrp-3.2.3-0-oneplus3.img" and the command prompt window shows "waiting for device". My device is on, at the homescreen, doing nothing. The command prompt window stays like that until I boot into fastboot mode, where it then just shows the large list of commands quoted above.
HOWEVER, a development!
When in fastboot mode and using the "fastboot boot twrp-3.2.3-0-oneplus3.img" command, the window now says "cannot load 'twrp-3.2.3-0-oneplus3.img': No such file or directory". So I tried typing the exact file path (C:\adb\twrp... img), which has now allowed me to boot into the updated TWRP.
Does this mean it's just booted into it, but not updated to it?
I'm able to see the contents of my sdcard now. So flashed the latest 17.1 magisk zip and... success! I'm now on the latest magisk and have been able to flash the latest TWRP to recovery.
Just to say, I really appreciate the help with this.
I know I could factory reset but it's helping me learn more.
anotherxdauser said:
Whenever I've mentioned adb it's the dos/command prompt window.
Fastboot is that small menu where it shows whether the device bootloader is locked or not isn't it?
Click to expand...
Click to collapse
You confuse some terms. adb and fastboot are programs, command prompt is the interpreter of the commands you give to these programs.
And yes, the fastboot is that mode.
anotherxdauser said:
At any rate, tried "fastboot boot twrp-3.2.3-0-oneplus3.img" and the command prompt window shows "waiting for device". My device is on, at the homescreen, doing nothing. The command prompt window stays like that until I boot into fastboot mode, where it then just shows the large list of commands quoted above.
Click to expand...
Click to collapse
Fastboot mode is meant to be used while phone is booted into fastboot mode
anotherxdauser said:
When in fastboot mode and using the "fastboot boot twrp-3.2.3-0-oneplus3.img" command, the window now says "cannot load 'twrp-3.2.3-0-oneplus3.img': No such file or directory". So I tried typing the exact file path (C:\adb\twrp... img), which has now allowed me to boot into the updated TWRP.
Click to expand...
Click to collapse
"no such file" means that you could have not copied the img file to the same folder as the adb binary (this is not the case when adb and fastboot binaries are installed with %PATH% variable added, then you can use these commands all over the filesystem).
anotherxdauser said:
Does this mean it's just booted into it, but not updated to it?
Click to expand...
Click to collapse
Fastboot boot command, which I have provided earlier is used to boot temporarily, one time an image you tell it to.
anotherxdauser said:
Just to say, I really appreciate the help with this.
Click to expand...
Click to collapse
Just kindly informing that there is a button on the lower-right hand corner for this
anotherxdauser said:
Whenever I've mentioned adb it's the dos/command prompt window.
Fastboot is that small menu where it shows whether the device bootloader is locked or not isn't it?
Click to expand...
Click to collapse
Both adb and fastboot are command prompt functions. They are both "bridge" tools used to communicate from computer to the phone.
The phone menu screen you are referring to is bootloader. Fastboot is one of the choices on that (bootloader) menu. It puts the phone in fastboot mode, which is specifically intended for fastboot commands (only mode fastboot command will work). The response will always be "waiting for device" if you try fastboot commands, and not in fastboot mode.
If the command is "fastboot . . . " you are issuing fastboot commands (not adb).
If the command is "adb . . . " you are issuing adb commands.
Again, they are both related, but different. Different requirements and usages for adb versus fastboot. It is important to understand the distinction, so you don't waste more time trying command in the wrong mode (which will never work).

[GUIDE][HOW TO] Flashing with care & Surviving soft bricks with fastboot [CMD] [TIPS]

[GUIDE][HOW TO] Flashing with care & Surviving soft bricks with fastboot [CMD] [TIPS]
Hello guys, some of us are new to the A/B partitions. Flashing on wrong partition may end up in soft bricks. This is not a rooting guide, here I'm explaining how to handle flashing A/B partitions properly and survive soft bricks using fastboot . Always backup your data before flashing anything.
Those who still don't know about the A/B partitions, please take a look at this thread https://forum.xda-developers.com/oneplus-6/how-to/guide-noobs-guide-to-b-partitions-op6-t3816123
Prerequisites:
OnePlus 6T with unlocked or locked bootloader
A computer for running fastboot commands
You :laugh:
Rebooting
Rebooting your device via adb and fastboot
Code:
adb reboot //normal reboot
adb reboot recovery //reboot to recovery
adb reboot bootloader //reboot to fastboot (bootloader)
Code:
fastboot reboot //normal reboot
fastboot reboot bootloader //reboot to fastboot (bootloader)
Unlocking the Bootloader
Bootloader can be unlocked via fastboot
Code:
fastboot oem unlock
WARNING THIS WILL WIPE YOUR DATA
Working with A/B Partitions
There are two boot partitions on this device, named boot_a and boot_b respectively, they are not the “traditional” boot partitions. Both of these partitions contain a kernel and ramdisk like you are probably used to. The difference is that there is no recovery partition and the boot partition is new recovery partition. The A/B partitioning scheme can be quite confusing to users. There are actually two copies of many of the partitions. There is only one data (userdata) partition.
Slots
The concept of ‘slots’ comes into play to determine whether you are booting ‘slot A’ or ‘slot B’. We can determine which slot is ‘active’ or marked for booting via adb and fastboot:
Code:
adb shell getprop ro.boot.slot_suffix
Code:
fastboot getvar current-slot
Switching Slots
We can switch between slots via fastboot:
Code:
fastboot set_active other //switch to inactive slot
Code:
fastboot set_active (a or b) //switch to specified slot
Flashing/Booting
We can flash/boot (temporary flash) recovery/kernel via fastboot. To boot (what we call temporary flash) a kernel/recovery there is no need to switch/select any slot. Keep in mind that when we run the flash command instead of boot, it will wipe the specified partiton (you may lose your root & custom kernel)
Code:
fastboot boot boot.img or twrp_recovery.img
To flash permanently, first switch/select any slot you want or it will automatically flashed to the active slot. This may cause boot loop, always proceed with caution.
Code:
fastboot flash boot boot.img or twrp_recovery.img
Code:
fastboot flash recovery twrp_recovery.img
If your testing something, always use the inactive slot. Eg: if you want to test a custom rom, first back up your data then switch to the inactive slot and flash the custom rom, this will save your time (no need restore full backup only data).
Surviving Soft Bricks
Some possible simple solution we can try rather than using MSMTool or flashing the full rom.
When causing boot loops, try these:
Flash Magisk via recovery
Switch to the other slot via fastboot
Wipe data partiton via fastboot -w
When causing Bootloader crash, try these:
Turn off the phone by holding the power button (release after power off)
Hold both volume buttons
Now press power button
Phone will boot to fastboot
Now switch the other slot via fastboot
To be continued....
Just in case
This is my first A/B device so forgive my ignorance, I was wondering if its possible to flash two different roms on to different slots...like oxygen on one partition and lineage on other?
Also why twrp has two buttons 'slot a' and 'slot b' in reboot section?
The phone doesn't have recovery partition, so what happens on typing 'Fastboot flash recovery' command?
Thanks again for this tutorials. That's really helpful in understanding of the new Android features.
What'd be your advice on instructions to get stock kernel back? I couldn't find an appropriate command on how to do it
patelparth120595 said:
This is my first A/B device so forgive my ignorance, I was wondering if its possible to flash two different roms on to different slots...like oxygen on one partition and lineage on other?
Also why twrp has two buttons 'slot a' and 'slot b' in reboot section?
The phone doesn't have recovery partition, so what happens on typing 'Fastboot flash recovery' command?
Click to expand...
Click to collapse
You can install any rom on both slot, there is no problem. There is only one userdata partiton. The two buttons are for switching between slots, if you press slot a button, the recovery will mark slot a as bootable or active partition. On next boot or reboot rom from slot a will boot, this same thing is applied for slot b too. There is no dedicated partition for recovery , files for recovery are stored in system_root.
geminium said:
Thanks again for this tutorials. That's really helpful in understanding of the new Android features.
What'd be your advice on instructions to get stock kernel back? I couldn't find an appropriate command on how to do it
Click to expand...
Click to collapse
Get stock boot.img file and flash using fastboot
Code:
fastboot flash boot boot.img
AnoopKumar said:
You can install any rom on both slot, there is no problem. There is only one userdata partiton. The two buttons are for switching between slots, if you press slot a button, the recovery will mark slot a as bootable or active partition. On next boot or reboot rom from slot a will boot, this same thing is applied for slot b too. There is no dedicated partition for recovery , files for recovery are stored in system_root.
Click to expand...
Click to collapse
Thanks for the reply. Cleared all my doubts.
So could we have two ROMs and switch back and forth between on one device in this case?
geminium said:
So could we have two ROMs and switch back and forth between on one device in this case?
Click to expand...
Click to collapse
Because of one userdata partition, there will be some issues. If wipe data when switching roms, no issues then.
Man i could use some help patched the file moved it to harddrive tried fastboot flash boot boot.img (the patched one) and all i get is
C:\Users\seang\OneDrive\Desktop\Moto G Stylus 2021>fastboot flash boot boot.img
error: cannot open 'boot.img' Could you please make a guide with some pics or at least a step by step cause nothing i have tried has gotten root yet. Thanks!
Thanks to the OP.

Mi A2: Pie upgrade + Magisk upgrade = bricked

Steps on my Xiaomi Mi A2:
Started the OTA from Oreo to Pie, officially being offered via settings.
While the OTA was downloading / installing, I uninstalled Magisk 17 (“restore images”). Note that after uninstalling Magisk, I did not see an option to install it again. In fact, the Magisk app still reported Magisk as being installed.
In the meantime, the OTA showed the restart button. This I did not tap, since I want Magisk to work.
I went back into the Magisk app. So far I had ignored the popup window offering an upgrade to Magisk 18. Now I accepted it, and I selected to install Magisk to the other slot (A/B). As advertised, this was followed by an automatic reboot.
The device at first continuously reset itself, i.e. it was in a boot loop. Eventually, I think I disconnected it from power or I pressed the power button. Now the boot process would move on to the boot animation with the colored horizontal stripe. There is got stuck. I waited for perhaps half an hour, then accepted that something is broken.
What could’ve gone wrong? Any idea what to do now or how to diagnose the issue? (there is data on the device that I don’t want to lose, text messages and other stuff)
Modifications that I did later:
Code:
fastboot set_active a
fastboot reboot
This enters a boot loop. Another time, I think after disconnecting the USB cable, it went back into Fastboot mode. Weird.
And:
Code:
fastboot set_active b
fastboot reboot
This boots to the colored stripe animation mentioned in the last of the steps above. So I assume slot b is the one that was last active.
I also tried booting other images, but to no avail:
Code:
fastboot boot boot.img
Among the images that I tried booting was Xiaomi’s 9.6.16.0 Oreo image as well as the images from the 10.0.1 built that Ricardo linked to in another post.
Bootloop usually occurs when you uninstall Magisk without uninstalling modules first.
Try installing Magisk via adb sideload with TWRP.
Sent from my Mi A2 using Tapatalk
hank81 said:
Bootloop usually occurs when you uninstall Magisk without uninstalling modules first.
Click to expand...
Click to collapse
Had no modules installed. But there was something odd about the upgrade process, especially that at first I didn’t get an option to install Magisk again.
Try installing Magisk via adb sideload with TWRP.
Click to expand...
Click to collapse
Thanks for the suggestion! Have to look into TWRP.
Anyhow, at the moment I would be happy for the phone to boot again, even without Magisk. Can install Magisk later.
feklee said:
Had no modules installed. But there was something odd about the upgrade process, especially that at first I didn’t get an option to install Magisk again.
Thanks for the suggestion! Have to look into TWRP.
Anyhow, at the moment I would be happy for the phone to boot again, even without Magisk. Can install Magisk later.
Click to expand...
Click to collapse
If you can access TWRP, I hope that you can search for the OTA firmware zip that the System Updater downloaded & you can try manually flashing that zip using TWRP. It would restore the Pie boot image which would make the device boot up.
Sent from my #FlagshipKiller3T using Tapatalk
DarkSJ1998 said:
If you can access TWRP, I hope that you can search for the OTA firmware zip that the System Updater downloaded & you can try manually flashing that zip using TWRP.
Click to expand...
Click to collapse
OK, so I booted into TWRP 3.2.3-0:
Code:
# fastboot boot TWRP-3.2.3-jasmine-20181201.img
I played with the command line in TWRP. However, I didn’t find the zip. Cache was not mounted, and it was not possible to mount it. Then I read a little bit about A/B (Seamless) System Updates. This is a cool concept, but somehow it failed miserably here. Neither slot does boot.
Slot B:
It looks like the Android version is still Oreo:
Code:
# grep version.i /system/system/build.prop
[…]
ro.build.version.incremental=V9.6.17.0.0DIMIFE
So I obtained the image files for that version. There is a post with links to dumps. I then tried to boot the V9.6.17.0 boot image:
Code:
fastboot boot boot.img
Again, booting hangs at the animation with the horizontal colored stripe.
SLOT A:
As mentioned before, booting that doesn’t work either: The system enters a boot loop, repeatedly reseting itself before it even gets to the horizontal colored stripe animation.
This one has Pie:
Code:
# grep version.i /system/system/build.prop
[…]
ro.build.version.incremental=V10.0.2.0.PDIMIFJ
As above, I obtained the image files for that version, and I did:
Code:
$ fastboot set_active a
Setting current slot to 'a'...
OKAY [ 0.017s]
Finished. Total time: 0.020s
$ fastboot boot boot.img
Downloading 'boot.img'
OKAY [ 2.633s]
booting
Boot loop!
I repeated:
Code:
$ fastboot boot boot.img
Downloading 'boot.img'
OKAY [ 2.633s]
booting
It’s always like that: When you’re not expecting anything anymore, it works! The A2 booted into Pie.
Noteworthy:
It’s weird that explicitly selecting the slot made it not work, or maybe it required another reboot.
Magisk remained installed: After the initial boot into Pie, I rebooted the phone, and it booted into Pie again although I did not flash boot.img.
Perhaps the phone didn’t do the initial boot into Pie because Magisk was still installed.
feklee said:
OK, so I booted into TWRP 3.2.3-0:
Code:
# fastboot boot TWRP-3.2.3-jasmine-20181201.img
I played with the command line in TWRP. However, I didn’t find the zip. Cache was not mounted, and it was not possible to mount it. Then I read a little bit about A/B (Seamless) System Updates. This is a cool concept, but somehow it failed miserably here. Neither slot does boot.
Slot B:
It looks like the Android version is still Oreo:
Code:
# grep version.i /system/system/build.prop
[…]
ro.build.version.incremental=V9.6.17.0.0DIMIFE
So I obtained the image files for that version. There is a post with links to dumps. I then tried to boot the V9.6.17.0 boot image:
Code:
fastboot boot boot.img
Again, booting hangs at the animation with the horizontal colored stripe.
SLOT A:
As mentioned before, booting that doesn’t work either: The system enters a boot loop, repeatedly reseting itself before it even gets to the horizontal colored stripe animation.
This one has Pie:
Code:
# grep version.i /system/system/build.prop
[…]
ro.build.version.incremental=V10.0.2.0.PDIMIFJ
As above, I obtained the image files for that version, and I did:
Code:
$ fastboot set_active a
Setting current slot to 'a'...
OKAY [ 0.017s]
Finished. Total time: 0.020s
$ fastboot boot boot.img
Downloading 'boot.img'
OKAY [ 2.633s]
booting
Boot loop!
I repeated:
Code:
$ fastboot boot boot.img
Downloading 'boot.img'
OKAY [ 2.633s]
booting
It’s always like that: When you’re not expecting anything anymore, it works! The A2 booted into Pie.
Noteworthy:
It’s weird that explicitly selecting the slot made it not work, or maybe it required another reboot.
Magisk remained installed: After the initial boot into Pie, I rebooted the phone, and it booted into Pie again although I did not flash boot.img.
Perhaps the phone didn’t do the initial boot into Pie because Magisk was still installed.
Click to expand...
Click to collapse
Great to see you fixed your issue
Maybe your post will help somebody else
Sent from my #FlagshipKiller3T using Tapatalk

miflash error: not catch checkpoint (\$fastboot -s .*lock), flash not done -> HELP?!

miflash error: not catch checkpoint (\$fastboot -s .*lock), flash not done -> HELP?!
Hello,
I unlocked my Mi8 and successfully installed Lineage on it.
After trying to install Magisk, my phone only boots into fastboot (and mi recovery, but that's not very helpful).
fastboot boot twrp.img results in error :
FAILED (remote: Failed to load/authenticate boot image: 00000050)
I tried MIFLASH by
1) downloading, dezipping and starting newest miflash (2020.3.14.0)
2) installing drivers
3) downloading and dezipping MIUI-fastboot-ROM
4) entering path* into miflash, refresh and flash (already tried all options "clean all" to "clean all and lock")
*) path to the folder that includes among others flash_all.bat
all this results in error:
not catch checkpoint (\$fastboot -s .*lock), flash not done
Nothing changed with the phone, still the same error.
While wanting to review the logs, I clicked in miflash on log/flash log. The log did not say anything helpful, but the error code of fastboot boot twrp.img changed to command write failed (Unknown error). Nothing else changed.
UPDATE: changed back to previous error (remote: Failed to load/authenticate boot image: 00000050)
If you have any idea or need any more information, please tell me!
I need that phone and cannot afford to terminally brink it!!
I did not find much online, did no one else had this problem??
THANK YOU!
PS: Using lenovo-laptop with quite vanilla win10 (and not so vanilla kubuntu dualboot, but miflash only supports windows)
MIFLASH-log says:
Code:
[14:37:14]:lsusb path:"C:\Users\<>\Downloads\MiFlash20200314\MiFlash20200314\Source\ThirdParty\Qualcomm\fh_loader\lsusb.exe"
[14:37:14]:Specified cast is not valid.: at XiaoMiFlash.code.Utility.TreeViewUsbItem.AddPortNode(String HubPath, Int32 NumberOfPorts)
[14:37:14]:Specified cast is not valid.: at XiaoMiFlash.code.Utility.TreeViewUsbItem.AddPortNode(String HubPath, Int32 NumberOfPorts)
[14:37:14]:Specified cast is not valid.: at XiaoMiFlash.code.Utility.TreeViewUsbItem.AddPortNode(String HubPath, Int32 NumberOfPorts)
[14:37:14]:GetScriptDevices
[14:37:15]:FlashingDevice.flashDeviceList.Remove ab6ee6a0
[14:37:15]:add device ab6ee6a0 index 1
[14:37:15]:Thread start,thread id 5,thread name ab6ee6a0
[14:37:15]:start process id 2524 name cmd
[14:37:15]:Thread stopped, thread id 5, thread name ab6ee6a0
UPDATE:
what would the world be without mysteries. Though I cannot really accept them in the IT sector, I cannot really explain, why "everything" works now.
The error of miflash still exists, but fastboot works.
I tried booting and flashing the lineage boot.img instead of twrp.img as well as miflash about every five minutes. I do not think it was the latter, though.
I am still curious on that matter, but having everything working is more important.
Thank you anyway.
Never encountered that error however, if you have Lineage installed i have to wonder how or why your phone is able to boot into mi recovery ? You should have a custom recovery installed (twrp, orangefox .. something)
If you have a ryzen laptop - see the thread about ryzen cpu - they have some issues with recognising properly devices via usb - solved by using a hub.
There is no need to use miflash to flash the fastboot miui rom - you can do it from command line in both windows and linux. Once you decompress the fastboot tar.gz, you have .bat and .sh files in the folder - miflash runs those exact files. Just install adb and fastboot on kubuntu and run your choice of script (flash_all, flash_all_lock, etc.) this has the added benefit of not needing odd drivers in windows (last time i used miflash it complained about some .net stuff that i had to manually install).
Since normally you would install twrp i have to wonder if by any chance mi-recovery is not checking the boot image before flashing it ... not sure, or maybe it had something to do with the FBE of lineage since there was no recovery in place to decrypt the partitions, if i remember correctly, the boot image needs to be signed with the verity key. The log snippet you provided doesn't tell anything as it has no error messages or anything.
Either way, not sure how what you brutforced to get it working but glad it solved itself, however, if you still have mi-recovery instead of a custom one, i would suggest you backup the device, flash MIUI without locking the bootloader, installing twrp (not just booting it) and reinstalling lineage from there. (all this can be done from your kubuntu install so you avoid driver and other windows shenanigans)
to install adb and fastboot it's just a question of sudo apt install adb fastboot
either tar -xvzf the archive of the fastboot image or just extract it from the file manager
open a terminal in the extracted folder (where the bat and sh files are)
put the phone in fastboot mode, connect via usb and do a "fastboot devices" just to make sure the device shows up
./flash_all.sh (this does the exact same thing as the clean option in miflash - just open the script and take a look through it)
Once the flash is done and the phone reboots, skip through all the setup steps just so miui loads up then reboot to fastboot
get twrp from their website, open terminal where it is downloaded and "fastboot flash recovery <name_of_file>.img"
once the command finishes do a "fastboot boot <name_of_file>.img" and once you are in twrp, go yo wipe, do a factory reset, back, advanced wipe and select the caches, back, format data, type yes, back to the main menu of twrp and reboot recovery, this should boot you back into twrp but this time the one that is flashed on the device.
from here on install rom of choice and magisk as usual (use the install option in twrp tho, don't unpack the zip)
Had the phone for 2 years and i flashed different roms on it almost weekly since the wait time to unlock the bootloader expired and never had an issue with this workflow and it saves you from having to use windows. Even for unlocking the bootloader, in case you ever lock it back up, you can use https://xiaomitool.com/V2/download (worked like a charm on linux)
sorfat said:
Never encountered that error however, if you have Lineage installed i have to wonder how or why your phone is able to boot into mi recovery ? You should have a custom recovery installed (twrp, orangefox .. something)
If you have a ryzen laptop - see the thread about ryzen cpu - they have some issues with recognising properly devices via usb - solved by using a hub....
Click to expand...
Click to collapse
Thank you for your detailed reply!
Of cause, in order to install lineage, I used TWRP. But I somehow did not install it, but used fastboot boot twrp.img in order to manually temporary boot twrp every time I need it. It was not intentionally at first (did do
"fastboot flash recovery <name_of_file>.img"
Click to expand...
Click to collapse
) but I learned to like the mi recovery for it's wiping and being able to use with the keys (not touch, since I managed to disable touch once before that). Mi recovery does not allow flashing at all, so no worries there^^
I have read the ryzen thread before posting, that's why I included my hardware. Not sure, if Lenovo has ryzen, mine does not.
Why I did not think of just running the script in kubuntu instead of hassling with windows, I do not know. Guess it does have something to do with the wood in front of all the trees.
I have the phone for about one and a half week and flashed it at least once a day :laugh:
But I hope to neither lock it again (twice is sweaty enough) nor have to flash it every week.
Thank you very much, if I ever lock myself out again or get another phone to set up, I will defintely reread this post!
btw: is there no way in xda to close a thread?

Not allowed to flash recovery anymore?

I am trying to flash the LineageOS recovery for LineageOS 18. I have previously already installed LineageOS 17 on my phone with no issues like 2 or 3 weeks ago. However, I am now trying to update to LineageOS 18 and I am now not allowed to flash the new recovery to my phone. Nothing has changed since I was last able to flash a recovery to my phone except I just changed my battery out today (since the old one was faulty), but I doubt that would interfere with the software or firmware, right? I have verified my phone is unlocked, I have verified my ADB and Pixel drivers are all up to date, and I have tried flashing on two computers, Linux and Windows. An additional thing to note that may or may not give you a clue as to what is going on is that I am able to boot into a TWRP img, but it no longer prompts me for a decryption password, and when I go to mount > decrypt and enter my pin, it says the password is incorrect.
You guys got any clue how I can fix this?
EDIT:
Here is my terminal output:
Code:
[[email protected] ~]$ sudo fastboot flash recovery /home/chris/Downloads/lineage-18.1-20210409-microG-coral-recovery.img
[sudo] password for user:
Sending 'recovery' (65536 KB) OKAY [ 1.710s]
Writing 'recovery' FAILED (remote: 'Not allowed to flash (recovery)')
fastboot: error: Command failed
I have to use sudo because it doesnt detect my device when I dont use sudo for some dumbass reason...
Deleted
cray12399 said:
I am trying to flash the LineageOS recovery for LineageOS 18. I have previously already installed LineageOS 17 on my phone with no issues like 2 or 3 weeks ago. However, I am now trying to update to LineageOS 18 and I am now not allowed to flash the new recovery to my phone. Nothing has changed since I was last able to flash a recovery to my phone except I just changed my battery out today (since the old one was faulty), but I doubt that would interfere with the software or firmware, right? I have verified my phone is unlocked, I have verified my ADB and Pixel drivers are all up to date, and I have tried flashing on two computers, Linux and Windows. An additional thing to note that may or may not give you a clue as to what is going on is that I am able to boot into a TWRP img, but it no longer prompts me for a decryption password, and when I go to mount > decrypt and enter my pin, it says the password is incorrect.
You guys got any clue how I can fix this?
EDIT:
Here is my terminal output:
Code:
[[email protected] ~]$ sudo fastboot flash recovery /home/chris/Downloads/lineage-18.1-20210409-microG-coral-recovery.img
[sudo] password for user:
Sending 'recovery' (65536 KB) OKAY [ 1.710s]
Writing 'recovery' FAILED (remote: 'Not allowed to flash (recovery)')
fastboot: error: Command failed
I have to use sudo because it doesnt detect my device when I dont use sudo for some dumbass reason...
Click to expand...
Click to collapse
There is no "recovery" partition anymore, it is in the boot.img. The "recovery" is a virtual partition that doesnt exist as its own partition. Review the steps in LOS 18.1 and it points out to flash the boot.img, then reboot to recovery once you have flashed boot.img and rebooted
Reboot to bootloader
Flash the provided boot.img to both slots (fastboot flash --slot all boot boot.img)
Reboot into recovery and factory reset for initial install
Sideload the latest build of Lineage OS (adb sideload lineage.zip)
I will also note that you seem to be using the MicroG (no GAPPs) version so I dont know if the steps are different than official LOS, but I dont think so. I would follow the dev steps to the T and not try older methods (I did the same thing I am warning against), I used my old and trusty, time tested steps, that always worked in previous devices, but do not anymore on Pixels.
It sounds like whatever happened broke your decryption of /data (but its a guess without knowing more). You might be stuck and need to format /data, or you can try to sideload the update and see if it works. Without enough info, I am guessing so provide more info and we can try to help better.
Also to note, if you use the boot.img / sideload method, you do not need TWRP, nor to mount anything. Its all done from the "native recovery" provided by LOS but you might have screwed up the/data decryption, IDK.
If this were me, and in your shoes, I would restore a FULL FACTORY image (not an OTA) with the -W left intact on BOTH slots so it rewrites my partition layout and undoes whatever funkiness' happened. You would lose everything, but it would get you back into working shape.
If you do not want to start over (and I dont disagree, it sucks), then follow the TWRP forum for coral (PX4):
TWRP Coral [Official]
[RECOVERY] TWRP 3.5.0_10-0 - TeamWin Recovery Project [/B] Introduction: Team Win Recovery Project or TWRP for short, is a custom recovery built with ease of use and customization in mind. We started from the ground up by taking AOSP...
forum.xda-developers.com
GROOVYJOSHCLARK said:
There is no "recovery" partition anymore, it is in the boot.img. The "recovery" is a virtual partition that doesnt exist as its own partition. Review the steps in LOS 18.1 and it points out to flash the boot.img, then reboot to recovery once you have flashed boot.img and rebooted
Reboot to bootloader
Flash the provided boot.img to both slots (fastboot flash --slot all boot boot.img)
Reboot into recovery and factory reset for initial install
Sideload the latest build of Lineage OS (adb sideload lineage.zip)
I will also note that you seem to be using the MicroG (no GAPPs) version so I dont know if the steps are different than official LOS, but I dont think so. I would follow the dev steps to the T and not try older methods (I did the same thing I am warning against), I used my old and trusty, time tested steps, that always worked in previous devices, but do not anymore on Pixels.
It sounds like whatever happened broke your decryption of /data (but its a guess without knowing more). You might be stuck and need to format /data, or you can try to sideload the update and see if it works. Without enough info, I am guessing so provide more info and we can try to help better.
Also to note, if you use the boot.img / sideload method, you do not need TWRP, nor to mount anything. Its all done from the "native recovery" provided by LOS but you might have screwed up the/data decryption, IDK.
If this were me, and in your shoes, I would restore a FULL FACTORY image (not an OTA) with the -W left intact on BOTH slots so it rewrites my partition layout and undoes whatever funkiness' happened. You would lose everything, but it would get you back into working shape.
If you do not want to start over (and I dont disagree, it sucks), then follow the TWRP forum for coral (PX4):
TWRP Coral [Official]
[RECOVERY] TWRP 3.5.0_10-0 - TeamWin Recovery Project [/B] Introduction: Team Win Recovery Project or TWRP for short, is a custom recovery built with ease of use and customization in mind. We started from the ground up by taking AOSP...
forum.xda-developers.com
Click to expand...
Click to collapse
Where are you getting the boot.img for lineage? I don't see one anywhere. All I've seen is recovery.img as me the rom zip.
Thanks in advance Josh.
flash713 said:
Where are you getting the boot.img for lineage? I don't see one anywhere. All I've seen is recovery.img as me the rom zip.
Thanks in advance Josh.
Click to expand...
Click to collapse
If using the official, it's provided in the download section. If not, and it's unofficial, then usually the devs of that ROM provide it. If that's not being done by the devs of the version you are using, then you need to use python and dumper script. It uses python and script (dumper) to pull out the boot.img from the payload.bin (within the zip).
Just keep in mind that I do not use the MicroG version so it's possible the steps vary but I doubt it. What I stated above is usually the method for custom, LOS, even official firmware versions to pull out the boot.img.
Send me the link to download what you're using to try and reproduce it so I can advise better (ROM/recovery/ETC).

Categories

Resources