Fix Mi8 encryption bug first time changing Recovery - Xiaomi Mi 8 Guides, News, & Discussion

Hey, this is a weird bug but I found no solution online so I might just upload it myself
What's the bug?
Mi8 (Global Version) is encrypted by 'default', even though you didn't encrypted it and just use fingerprint for lockscreen.
What's the problem with that?
When you Unlock its bootloader and flash TWRP, every time you try it, /sdcard folder generates random folders named with numbers and letters. Doesn't get solved formatting data, or doing any kind of wipe, even favtory reset on the Official ROM before trying TWRP out.
That is a problem because you can't flash TWRP (nor the patch for avoiding MiRecovery to overwrite TWRP) from TWRP if your internal storage isn't available for you to flash from
Solution
I didn't know what to do so I just put the Patch, the TWRP.img and .zip in the Fastboot/Bootloader folder in my computer, launched CMD from there with mi 8 in Fastboot mode. Type 'adb devices' to see if all the drivers are ok and the phone is properly connected. Then I first flashed through cmd the .img from the folder into the phone.
Code:
adb devices
fastboot flash flash recovery [twrp name].img
fastboot boot [recovery name].img
This is the part where you can't flash TWRP from your Mi8 because your internal storage has been wiped because of encryption.
Code:
adb devices
adb push [twrp name].zip /sdcard/.
adp push [patch name].zip /sdcard/.
adb push [rom name].zip /sdcard/.
Even though your internal memory was wiped, now you have the TWRP zip, the PATCH zip and your ROM zip in the storage (you need to make sure you have those files in the same folder as your Fastboot drivers etc).
Then you can just follow the normal instructions and every time you need a file your phone wiped just copy it from the folder of your pc with cmd.
The patch I talk about is "Disable_Dm-Verity_FEC_v1.1.zip"

I have the same problem. When doing these steps, all the internal information of the phone is deleted?

the "bug" is wrong twrp version. Google some more

t0mas_ said:
the "bug" is wrong twrp version. Google some more
Click to expand...
Click to collapse
no it's not

Prisanejamik said:
no it's not
Click to expand...
Click to collapse
Using the latest TWRP, it can decrypt the data partition. GLOBAL STOCK encrypts the DATA partition on first boot by default. There is no 'Bug'. The Muli .eu ROM only encrypts SYSTEM, and not DATA by default. STOCK CHINA ROM encrypts the DATA partition on first boot by default also. Why are you calling this a 'BUG'?

Agimax said:
Using the latest TWRP, it can decrypt the data partition. GLOBAL STOCK encrypts the DATA partition on first boot by default. There is no 'Bug'. The Muli .eu ROM only encrypts SYSTEM, and not DATA by default. STOCK CHINA ROM encrypts the DATA partition on first boot by default also. Why are you calling this a 'BUG'?
Click to expand...
Click to collapse
Where can we find the latest TWRP? There doesn't seem to be official yet and I saw some on chinese forums..

It's un-official, but is updated often
https://forum.xda-developers.com/mi-8/development/recovery-twrp-3-2-3-1110-t3869729

Agimax said:
Using the latest TWRP, it can decrypt the data partition. GLOBAL STOCK encrypts the DATA partition on first boot by default. There is no 'Bug'.
Click to expand...
Click to collapse
Can you advise what is the password used when Global Stock encrypts the Data partition on first boot? I note that the usual "default_password" does not work on my phone.

Related

CWM Recovery Test for MediaPad

CWM 5.8.0.9 for Huawei MediaPad
WARNING !!! DON'T FORMAT AND DON'T WIPE PARTITIONS USING THESE CWM !
I don't know how much this CWM version improves over the existing one by segler11.
However these build were more aimed at compiling and testing the new kernel sources.
I have tested compiling with both arm-eabi-4.4.0 and arm-eabi-4.4.3 with success on Ubuntu 10.04.
This is experimental, however with the new kernel sources it will just be a matter of time.
I have compiled the kernel included in this CWM recovery image but I didn't recompile the complete image.
I took as base Pyramid CWM 5.8.0.9 and I replaced the files from those found on a stock C232B005 kernel.
As the default build configuration I have used the /proc/config.gz of a C232B005 running kernel.
I have tested this CWM to be able to backup these partitions (I have not tested "restore" yet, just checked the tar archives):
boot.img - 12.582.912 (match 12Mb)
recovery.img - 16.777.216 (match 16Mb)
data.ext4.tar
cache.ext4.tar
system.ext4.tar
custom.ext4.tar
as you can see my hand tweaks to "recovery" require the name of "cust" partition to be "custom" instead but I believe this is a no issue while you backup and restore with the same CWM. Suggestions welcome.
BUGS:
data & time on archives are wrong
mount USB storage does not work
adb not enabled in recovery mode
Formats and Wipes do not work don't use them
The "busybox hwclock" applet doesn't work to set the hardware clock of our device.
The "adb shell" is not active while in CWM recovery, I don't know why and this was my objective so if you have suggestion please help.
As usual flash both "recovery" and "recovery2" partitions using "fastboot" and one of the attached CWM recovery:
Code:
fastboot flash recovery recovery-5.8.0.9-HWMOD-eabi-4.4.3.img
fastboot flash recovery2 recovery-5.8.0.9-HWMOD-eabi-4.4.3.img
fastboot reboot
WARNING !!! DON'T FORMAT AND DON'T WIPE PARTITIONS USING THESE CWM !
.:HWMOD:.
.
Reserved CWM HWMOD
This version seemed to work better for me.Tnx dude!
john9 said:
This version seemed to work better for me.Tnx dude!
Click to expand...
Click to collapse
Thank you for trying it.
Remember to absolutely avoid formatting or wiping partitions.
If you need to format/wipe do it ONLY after reinstalling the original "recovery.img" in both "recovery" and "recovery2" partitions and then reset the device from:
"Settings -> Backup and reset -> Factory reset"
ATTENTION !!! You can safely do a wipe or factory reset only after reinstalling the original recovery image.
Sorry for insisting but I don't want to create problems on users devices and I know those operations will create problems.
.:HWMOD:.
Just a note: I used your 4.4.3 version to try making a nandroid backup last night. Good news and bad news.
This morning I inspected the result using the app Nandroid Browser.
Good: Your CWM does successfully backup /data/data. The other CWM that had been posted here did not do so properly.
Bad: Your CWM also backs up the entire internal SD storage contents inside the folder /data/share. It is customary *not* to include this in a nandroid backup because a) you don't want to inflate the file size unnecessarily, and b) you don't want to overwrite the internal SD on a restore.
Idea: After you fix it, and until you manage to get ADB over USB working, maybe you could add a menu option to make a separate backup archive of internal SD to external SD. This would allow a route to save the internal storage if the device becomes unbootable and requires a data wipe.
cmstlist said:
Just a note: I used your 4.4.3 version to try making a nandroid backup last night. Good news and bad news.
This morning I inspected the result using the app Nandroid Browser.
Good: Your CWM does successfully backup /data/data. The other CWM that had been posted here did not do so properly.
Bad: Your CWM also backs up the entire internal SD storage contents inside the folder /data/share. It is customary *not* to include this in a nandroid backup because a) you don't want to inflate the file size unnecessarily, and b) you don't want to overwrite the internal SD on a restore.
Idea: After you fix it, and until you manage to get ADB over USB working, maybe you could add a menu option to make a separate backup archive of internal SD to external SD. This would allow a route to save the internal storage if the device becomes unbootable and requires a data wipe.
Click to expand...
Click to collapse
Thank you for trying it. I wanted to compile/test a kernel with new sources in a CWM.
Yes, in our device the internal memory "/mnt/sdcard" is also mapped under "/data/share".
Unfortunately I don't have the skills (yet) to build a complete recovery image from scratch,
so what I did was just compiling the kernel part of the recovery image, using the new sources.
Then I simply hex tweaked the "recovery" executable of a 5.8.0.9 Pyramid CWM (HTC Sensation).
So, in conclusion, I have no control over what is copied during the backup process of those partitions.
Though I could control which partition is processed by removing them from "fstab", but there is no gain into it.
We will have to wait somebody with the specific knowledge, or maybe I will have some time to learn once I return from holidays.
.:HWMOD:.
Today i have builded bootable CWM 5.5.0.4 from sources, so now we can adjust all what we need
after_silence said:
Today i have builded bootable CWM 5.5.0.4 from sources, so now we can adjust all what we need
Click to expand...
Click to collapse
well done
HI, can anyone share buckup from working device created by CWM.?
Thanks to all.
Hi,
Is it possible to flash update zips from this CWM recovery (like Beats Audio which is in flashable zip format)?
I don't want to use it for backup-recovery.
...and how about doing wipe cache and wipe dalvik cache?
.dredd. said:
Hi,
Is it possible to flash update zips from this CWM recovery (like Beats Audio which is in flashable zip format)?
I don't want to use it for backup-recovery.
...and how about doing wipe cache and wipe dalvik cache?
Click to expand...
Click to collapse
Haven't tried installing a ".zip" archive from CWM but it should work.
Avoid "wiping" and/or "formatting" partitions, they will be messed up.
hwmod said:
Haven't tried installing a ".zip" archive from CWM but it should work.
Avoid "wiping" and/or "formatting" partitions, they will be messed up.
Click to expand...
Click to collapse
The main reason for use of CWM would be to have the possibility of flashing update zips from CWM... but I am afraid of messing up my device... to understand: no problem if I have to reflash the rom but I would not want to cause mistake which could be repaired only by service.
fastboot is always available if something goes wrong and if you flash cwm you wont be able to install official roms because cwm will overwrite stock recovery
so i was stupid and wiped data and cache - then remembered that it said not to - how do i fix this paperweight? i tried fastbooting all the usual partitions (system, boot, userdata, cache, etc) but still nothing - i can get to fastboot but i cant flash any dload updates. any suggestions are greatly appreciated.
flash stock recovery (2 files) from zipped rom via fastboot and then you should be able to flash stock rom
flashed three different stock recoveries to recovery and recovery2 - still only get the media pad logo twice (flashed androidani intl rom before bricking) cant boot to recovery - think the partition table is screwed. is there a way to create partitions from fastboot, and if so, still would be nice to know the names of the partitions to flash as referenced in tmo stock thread.
byt3b0mb said:
flashed three different stock recoveries to recovery and recovery2 - still only get the media pad logo twice (flashed androidani intl rom before bricking) cant boot to recovery - think the partition table is screwed. is there a way to create partitions from fastboot, and if so, still would be nice to know the names of the partitions to flash as referenced in tmo stock thread.
Click to expand...
Click to collapse
The time needed to reformat and rewrite all the firmware partitions (the first time) will be between 10-15 minutes.
Be patient and give enough time to the device to execute all the needed processes.
When the device finally boot it need to completely regenerate dalvik-cache (the first time).
So try again as instructed above, rewrite "BOTH" partitions named "recovery" and "recovery2", both using the same "recovery.img" file found in the latest stock Huawei firmware.
Now extract the stock Huawei firmware archive on your PC and copy the "dload" folder on an empty formatted SDCard, then insert the SDCard in the MediaPad reboot it and wait until success or failure message.
If you wiped partitions you will have to wait more time (20-30m). It may be that after waiting a while a message about "Encryption not possible" could appear, just say no to encryption and let it reset the device.
It already happened to some of us so hope you are also able to recover your tablet.
thanks i will give it a shot - while it is rewriting partitions, should it be on the huawei logo? or should i see the android / gears turning?
byt3b0mb said:
thanks i will give it a shot - while it is rewriting partitions, should it be on the huawei logo? or should i see the android / gears turning?
Click to expand...
Click to collapse
First time restoration takes time on both moments during the 1st Huawei log and even during animation.
Trying to recover a partition that was wiped takes much longer for the OS to show the error.
When I tried wiping "data" and rebooted the device I recall I went for a long walk and when I returned the device was showing the "Encryption failure / Reset" message (about half an hour later).
So I can only suggest that when you retry you wait at least that amount of time (30 min.) with charger connected, whatever happens leave it alone until it display or ask you do something. Let me know if it works when you have tried.
Download links do not work for me. Can you upload in mediafire please?

Need system.img, boot.img and recovery.img

Hello there,
can someone please provide a system.img, recovery.img and boot.img from a WI501Q? I've derped something up quite hard by backing up the system partition while the bootloader was still locked, now I tried to flash it and the filesystem seems to be corrupted...
I tried reflashing a TWRP backup made from someone else but even transfering the backup to the watch fails at some point with "protocol error"... The watch reboots then and no files were saved to the watch.
Thanks already!
See Post #4 on how I resolved this (kinda).
[del]
ranf said:
[del]
Click to expand...
Click to collapse
What did you mean by using ext2simg?
Okay, after some derping around, trying, failing and more I managed to restore it...
I had a TWRP backup from my still OEM locked bootloader (I booted TWRP via fastboot boot twrp3.img), via fastboot I formated the system, userdata, cache and so on partitions and something along those lines seemed to work.
Before that the /data partition seemed to be corrupt for whatever reason, not even TWRP was able to display the free space. After doing the above it suddenly was able to display it again but the /data/media folder was missing, I created it manually, pushed the TWRP folder onto it, Restored and it worked!
So yeah, not sure what exactly went wrong here or how to fix it... Sorry...
EpicLPer said:
What did you mean by using ext2simg?
Click to expand...
Click to collapse
In Ubuntu it is in this package:
http://packages.ubuntu.com/xenial/amd64/android-tools-fsutils/filelist
Works better than img2simg.

Android Pay (Safety Net) on Rooted/Unlocked phone

This guide is to help anyone who wants to use Android Pay but his XC phone is unlocked and rooted. It begins with an unlocked phone with a valid backup of the TA partition as well as an unrooted /system partition.
Prerequisites:
1. A backup of TA partition (https://forum.xda-developers.com/crossdevice-dev/sony/universal-dirtycow-based-ta-backup-t3514236)
2. Unlocked bootloader
3. Working fastboot driver and command
4. Clean /system partition without any trace of su. Systemless root is fine because it will be overwritten by the new kernel. If needed, flash the stock system partition again.
5. TWRP image for XC (https://drive.google.com/open?id=0B0j3VJ1Xp5N8M1ZGbzBBMTdyRnM)
6. Stock kernel image (Extract kernel.sin from official FTF)
7. Trim Area Proof Of Concept (https://forum.xda-developers.com/crossdevice-dev/sony/poc-real-trim-instead-drm-fix-t3552893)
8. Tobias kernel repack tool (https://forum.xda-developers.com/xp...oot-automatic-repack-stock-kernel-dm-t3301605)
9. Magisk v12.0 flashable zip, not Manager app (https://forum.xda-developers.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445)
Procedures:
1. Run TA PoC (DOUBLECLICKME.bat). You'll be asked to select your kernel image (kernel.sin) and TA backup (your TA backup file). Choose also to disable DM-Verity, Sony RIC but keep Force-encrypt (my data partition is encrypted, your choice). At the end a new file new_boot.img will be created.
2. Copy the new_boot.img in step 1 to Tobias tool folder. In the same folder, execute the following command. Again, disable Sony RIC, don't install TWRP, don't install DRM fix and don't install Busybox. At the end, another file boot.img will be created.
Code:
rootkernel.cmd new_boot.img boot.img
3. Power off your phone. Power on again while holding volume up rocker to enter fast boot mode. Execute the following command to flash the new boot image. Replace boot.img with your new image in step 2 with full path.
Code:
fastboot.exe flash boot [I]boot.img[/I]
4. Reboot your phone. No root or SuperSU app should be found.
5. Copy Magisk zip file into phone internal storage.
6. Dial *#*#7378423#*#*, followed by Service Test > Security to check if DRM is detected properly. At this point of time, your phone should be su free and DRM working properly.
7. Power off your phone. Power on again while holding volume up rocker to enter fast boot mode. Execute the following command to boot TWRP. Replace twrp.img with your TWRP image with full path.
Code:
fastboot.exe boot [I]TWRP.img[/I]
8. In TWRP, flash Magisk zip
9. Reboot your phone. Install Magisk Manager app (no long available in Play Store) (http://tiny.cc/latestmanager)
10. Run Magisk Manager and turn on Magisk Hide. You should see Magisk installed successfully and properly rooted with MagiskSU. Tap SafetyNet button to check if it can be passed.
11. (optional) Install Xposed using Magisk app, not official method. Xposed will break Safety Net again. But you can always disable it in Magisk Manager easily.
Remarks:
1. Trim Area Proof Of Concept is required to restore full DRM functionality so that Safety Net thinks the phone is still locked.
2. /system partition must be clean and free of any trace of previous su installation.
3. Magisk Manager app cannot be used to install Magisk because it requires root in the first place. Even with systemless root, after Magisk is installed this way, trace of su can be found in /vendor partition.
4. Tobias tool has to be used to repack the boot image because I found that if PoC image is used directly, phone will reboot unexpectedly after Magisk is installed.
This is the clearest guide I found so far for rooting x compact :good: (Your old guide also help me understand some of the concept)
I get most of the steps but want to confirm whether I understand it correctly
itandy said:
1. Run TA PoC (DOUBLECLICKME.bat). You'll be asked to select your kernel image (kernel.sin) and TA backup (your TA backup file). Choose also to disable DM-Verity, Sony RIC but keep Force-encrypt (my data partition is encrypted, your choice). At the end a new file new_boot.img will be created.
Click to expand...
Click to collapse
TA PoC modify the boot image and the modified boot image will mount the TA backup image during boot and "trick" the system/kernel into thinking that is the original TA Partition, and it is untouched.
itandy said:
2. Copy the new_boot.img in step 1 to Tobias tool folder. In the same folder, execute the following command. Again, disable Sony RIC, don't install TWRP, don't install DRM fix and don't install Busybox. At the end, another file boot.img will be created.
Click to expand...
Click to collapse
- Drm fix is not needed because of the trick in step 1. This step is only needed because of incompatibility of boot image generated from step 1 with magisk (mentioned in the remarks section.).
- TWRP is not needed because in this guide TWRP will be booted by fastboot through PC without actually installing it on the phone (Step 7)
- Busybox is now included in magisk I think?
itandy said:
6. Dial *#*#7378423#*#*, followed by Service Test > Security to check if DRM is detected properly. At this point of time, your phone should be su free and DRM working properly.
Click to expand...
Click to collapse
- This is to prove the TA PoC mount trick above is working. No kernel fix is done.
The advantage of this method instead of kernel drm fix is that you can have completely stock kernel/system and only have modified boot image (and some extra data in data partition). Can you theoretically update the system and exclude the boot and data partition and still have the root intact? Or is that not recommended as new update might have some change in the boot partition as well?
I still need to do more reading about magisk and why the manager need to be installed manually (and what does it do)
trewelu said:
This is the clearest guide I found so far for rooting x compact :good: (Your old guide also help me understand some of the concept)
I get most of the steps but want to confirm whether I understand it correctly
TA PoC modify the boot image and the modified boot image will mount the TA backup image during boot and "trick" the system/kernel into thinking that is the original TA Partition, and it is untouched.
- Drm fix is not needed because of the trick in step 1. This step is only needed because of incompatibility of boot image generated from step 1 with magisk (mentioned in the remarks section.).
- TWRP is not needed because in this guide TWRP will be booted by fastboot through PC without actually installing it on the phone (Step 7)
- Busybox is now included in magisk I think?
- This is to prove the TA PoC mount trick above is working. No kernel fix is done.
The advantage of this method instead of kernel drm fix is that you can have completely stock kernel/system and only have modified boot image (and some extra data in data partition). Can you theoretically update the system and exclude the boot and data partition and still have the root intact? Or is that not recommended as new update might have some change in the boot partition as well?
I still need to do more reading about magisk and why the manager need to be installed manually (and what does it do)
Click to expand...
Click to collapse
Your understanding is correct. As for busybox, I didn't install it because I don't use it. You can try and see if it affects Safety Net detection.
Yes, system partition can be updated without losing root.
trewelu said:
This is the clearest guide I found so far for rooting x compact :good: (Your old guide also help me understand some of the concept)
I get most of the steps but want to confirm whether I understand it correctly
TA PoC modify the boot image and the modified boot image will mount the TA backup image during boot and "trick" the system/kernel into thinking that is the original TA Partition, and it is untouched.
- Drm fix is not needed because of the trick in step 1. This step is only needed because of incompatibility of boot image generated from step 1 with magisk (mentioned in the remarks section.).
- TWRP is not needed because in this guide TWRP will be booted by fastboot through PC without actually installing it on the phone (Step 7)
- Busybox is now included in magisk I think?
- This is to prove the TA PoC mount trick above is working. No kernel fix is done.
The advantage of this method instead of kernel drm fix is that you can have completely stock kernel/system and only have modified boot image (and some extra data in data partition). Can you theoretically update the system and exclude the boot and data partition and still have the root intact? Or is that not recommended as new update might have some change in the boot partition as well?
I still need to do more reading about magisk and why the manager need to be installed manually (and what does it do)
Click to expand...
Click to collapse
Just found that you can actually enable busybox in Magisk Manager so you don't have to pack it into the boot image.
Sent from my F5321 using Tapatalk
Done the step above and gained root and pass safety check in magisk.
Is there a way to disable the bootloader unlocked message during boot? I don't mind the message but it delay booting process I
trewelu said:
Done the step above and gained root and pass safety check in magisk.
Is there a way to disable the bootloader unlocked message during boot? I don't mind the message but it delay booting process I
Click to expand...
Click to collapse
I'm not aware anyone is able to do that so far.
itandy said:
I'm not aware anyone is able to do that so far.
Click to expand...
Click to collapse
You would need to alter bootloader....
Remark for Android 7.0 Users
If you will use this guide on Nougat, you will need to DISABLE force-encrypt, because data partition is encrypted by default on Nougat. On top of that, you will need to first boot to TWRP, wipe DATA partition without decrypting / mounting it and then reboot system to re-create unencrypted data partition. Only then you can flash Magisk..
ondrejvaroscak said:
If you will use this guide on Nougat, you will need to DISABLE force-encrypt, because data partition is encrypted by default on Nougat. On top of that, you will need to first boot to TWRP, wipe DATA partition without decrypting / mounting it and then reboot system to re-create unencrypted data partition. Only then you can flash Magisk..
Click to expand...
Click to collapse
Just curious, I'm on MM and my data partition is encrypted. But I didn't have to decrypt it first before installing Magisk. Is there anything on Nougat that makes it different?
itandy said:
Just curious, I'm on MM and my data partition is encrypted. But I didn't have to decrypt it first before installing Magisk. Is there anything on Nougat that makes it different?
Click to expand...
Click to collapse
Yes, quite substantially .... the TWRP does NOT support /data decryption on Nougat. On MM it works, on Nougat there is no way, until someone compiles TWRP with support for Nougat encrypted /data. The workaround is to DISABLE force-encrypt, wipe /data to force re-create unencrypted /data, install anything you need and then encrypt in Settings/Security. Once you do it, there is no way to get into /data in recovery...
ondrejvaroscak said:
Yes, quite substantially .... the TWRP does NOT support /data decryption on Nougat. On MM it works, on Nougat there is no way, until someone compiles TWRP with support for Nougat encrypted /data. The workaround is to DISABLE force-encrypt, wipe /data to force re-create unencrypted /data, install anything you need and then encrypt in Settings/Security. Once you do it, there is no way to get into /data in recovery...
Click to expand...
Click to collapse
And why is data partition decryption support needed in TWRP in this case? Flashing Magisk requires modification on data partition?
itandy said:
And why is data partition decryption support needed in TWRP in this case? Flashing Magisk requires modification on data partition?
Click to expand...
Click to collapse
I don't think so. I just re-did the step (accidentally locked back my bootloader when trying to remove the unlocked message). On twrp, it ask for password which I don't even know as after BL unlock wipe, I haven't set my screen lock yet. I skip that part, mount the sd card and flash magisk. Magisk modify the boot image and I can have root and safety net working.
Ps: You might need to update the step, the magisk manager stub will force you to download the app from play store, but it is already pulled. I need to download the app directly from magisk thread and side load it.
Edit: I was wrong. Magisk do use /data for magisk.img, but it have workaround instalation in case it is inaccessible during flashing install script. See #15
trewelu said:
Ps: You might need to update the step, the magisk manager stub will force you to download the app from play store, but it is already pulled. I need to download the app directly from magisk thread and side load it.
Click to expand...
Click to collapse
Updated. Thanks!
itandy said:
And why is data partition decryption support needed in TWRP in this case? Flashing Magisk requires modification on data partition?
Click to expand...
Click to collapse
Magisk installs file magisk.img into /data. This file is than mounted as /magisk. I am not sure, how Magisk handles installation if /data is not accesible/mountable during flashing, did not try it.
ondrejvaroscak said:
Magisk installs file magisk.img into /data. This file is than mounted as /magisk. I am not sure, how Magisk handles installation if /data is not accesible/mountable during flashing, did not try it.
Click to expand...
Click to collapse
I'm not good with script, but here is my understanding,
In case of inaccessible data during flash, magisk will flash magisk.img temporarily in cache partition. During booting (after data is unencrypted), magisk check if the workaround image in cache exist and move it to data
scripts/flash_script.sh
Code:
if (is_mounted /data); then
IMG=/data/magisk.img
else
IMG=/cache/magisk.img
ui_print "- Data unavailable, use cache workaround"
fi
jni/daemon/bootstages.c
Code:
// Merge images
if (merge_img("/cache/magisk.img", MAINIMG))
goto unblock;
if (merge_img("/data/magisk_merge.img", MAINIMG))
goto unblock;
jni/magisk.h
Code:
#define MAINIMG "/data/magisk.img"
trewelu said:
I'm not good with script, but here is my understanding,
In case of inaccessible data during flash, magisk will flash magisk.img temporarily in cache partition. During booting (after data is unencrypted), magisk check if the workaround image in cache exist and move it to data
Click to expand...
Click to collapse
Cool, very clever. I did not make the effort to study in in depth, but expected some sort of solution to exist when users succesfully installed Magisk even when they can not mount /data in TWRP. This temporary /cache mount is just nice example of clever programming
Hey, I think I pseudo-bricked my device while following these steps. I used fastboot to boot into TWRP, without disabling encryption, on Nougat 7.1. I didn't notice the requirement to disable encryption in Post #8 until afterwards.
Now the device appears to be on (my computer detects an unknown device when I plug it in), but it doesn't show any LEDs or react to any buttons. Is my only recourse to wait till the battery dies in a few days and try again, or is there another way?
HAHA, I found if I hold EVERY button (power, vol up, vol dn, and camera), the phone restarts and I have access again. w00t!
Just wondering if somebody tried this with Nougat 7.1? I can't get TA_POC to work, security test displays error and sim card is not detected.
baz1 said:
Just wondering if somebody tried this with Nougat 7.1? I can't get TA_POC to work, security test displays error and sim card is not detected.
Click to expand...
Click to collapse
Yes this works with 7.1 the same as with 7.0. How did you perform the update to 7.1?
I followed the guide to perfection, and everything works perfectly...but...If I want to turn a user app into system apps, link2sd gives me this error: mount: '/dev/block/bootdevice/by-name/system'->'/system': Device or resource busy" and system app mover gives me this error : "could not remount /system".
is system read only? why? I've already tried to enable "rw" "ro" through the command line without success...
Can anyone help me?
p.s. I have granted root permissions to the applications mentioned above at their opening

Flash recovery without fastboot or android?

So I was trying to port TWRP to the Vodafone Smart 4 Turbo. I unpacked the stock recovery, and TWRP for the Xiomi Redmi 2 (same chipset). I then copied recovery.bin-dtb and -zImage. However, I didn't modify recovery.fstab, causing the ported TWRP not to work.
Fastboot boot and fastboot flash didn't work (remote: unknown command), so I had to use Flashify. Which worked, kind of; TWRP got flashed, but now android doesn't boot: it always boots into TWRP, and the reboot menu tells me "No OS Installed! Are you sure you want to reboot?" and reboots into TWRP. I can get into fastboot, but it didn't work, and since fastboot commands are stored in boot.img, I don't think anything would be different. /system is inacessable, same with /cache, /sdcard, /boot, /misc, and /recovery. Any ideas?
Can confirm that fastboot doesn't work. Additionally, there is a "system" folder in the ramdisk, containing an empty "bin" folder, mirroring what I can see on the device.
Sounds like the system isn't mounted... In TWRP go to mount and check system, them use the file manager to look in that folder. If there really is only bin folder, you have wiped your OS.
Sent from my XT1609 using Tapatalk
RealWelder said:
Sounds like the system isn't mounted... In TWRP go to mount and check system, them use the file manager to look in that folder. If there really is only bin folder, you have wiped your OS.
Sent from my XT1609 using Tapatalk
Click to expand...
Click to collapse
Nothing appears in the mount screen. If it helps, its TWRP 2.8.
In the etc folder, I can see a recovery.fstab, but I can't edit it.

Rooting and Restoring the Huawei Elate H1711z

OK to start off this thread is meant to continue the work done in the thread here huawei-ascend-xt2-h1711 their were some good people working on stuff their but most seem to have moved on.
I decided to pick up the Elate this week from Best Buy and thought it might be time to start a new thread on rooting and restoring the Cricket version of this phone.
Rooting the H1711z Huawei Elate​
First step is to unlock your bootloader at Huawei here > https://emui.huawei.com/en/unlock_detail
Well it seems Huawei is no longer unlocking the bootloader so you need to pay DC Unlocker to unlock your bootloader
follow the instructions posted here >> https://forum.xda-developers.com/honor-7x/how-to/how-to-unlock-huawei-bootloader-removal-t3780903
Also please make a backup of your own boot.img as soon as you flash TWRP before flashing the patched _boot.img provided
~Huge thanks to @aslezak for these instructions~
Root instructions: (I used Magisk Manager v5.5.3 boot.img patching to create the boot.img)
here is the stock boot.img for the Elate H1711z
I am not responsible if you brick your device. I didn't brick mine, but if you don't type the correct commands you could be in trouble
Copy this patched_boot.zip to your sdcard. You can download it from the device directly if that's easier. Insert the sdcard into the phone if it wasn't there already (e.g. if you downloaded from a computer).
Reboot phone into fastboot. The easiest way is, if phone is on, unplug phone from USB, hold power button / select "Power Off". Hold VolDown+Power. Phone will boot into fastboot mode.
(skip this step if you've already flashed TWRP) Flash TWRP into your recovery partition. The link was provided in an earlier post by yuweng twrp-xt2-v3.img
plug usb cable in (from phone to computer). From your computer / cmd.exe window, cd \adb:
fastboot devices #make sure computer adb/fastboot sees your device
fastboot flash recovery twrp_xt2_v3.img
Boot into TWRP. From the above step, you should "fastboot reboot", immediately unplug phone from USB, then
With the phone unplugged from the computer, hold VolUp+Power. Release power after the device reboots. It might take a couple tries .. select reboot from eRecovery if that starts instead. Alternatively you can boot into recovery through adb via "adb reboot recovery".
Tap "Keep Read Only" when TWRP starts.
Tap "Install", then tap "Install Image" at the bottom. Browse (Up a Level) then "external_sd"
If you unzipped the patched_boot.zip you will see patched_boot.img here. Select it.
Select "boot" (uncheck "recovery") partition to flash.
Swipe to confirm Flash
Tap "Reboot" once it's completed.
You should be rooted!
Note: if Magisk Manager does not appear in your list of installed applications, download & install it from here latest Magisk Manager. Without this, you won't be prompted to allow root!
Click to expand...
Click to collapse
Note: Magisk Manager will update you to version 16 on first run, it's OK to update in fact feel free to flash it in recovery before you reboot if you want it.
A couple notes about twrp_xt2_v3.img
when you start TWRP choose keep system read only - Unless your planing to restore a backup then choose to make system writable
You cannot backup or restore /data (it's encrypted so don't even try)
Do not use Wipe / factory reset or format data unless you have a good working backup of your userdata partition that you dd to your external_sd yourself see below
From TWRP / adb shell
paste these commands
dd if=/dev/block/bootdevice/by-name/userdata | bzip2 -9f > /external_sd/userdata.img.bz2
to restore--> bzip2 -dc /external_sd/userdata.img.bz2 | dd of=/dev/block/bootdevice/by-name/userdata
dd if=/dev/block/bootdevice/by-name/system | bzip2 -9f > /external_sd/system.img.bz2
to restore--> bzip2 -dc /external_sd/system.img.bz2 | dd of=/dev/block/bootdevice/by-name/system
again thanks go to aslezak
When choosing a backup always prefer the image instead of the stock files (system image - custom image - vendor image are best )(Never choose both system and system image at the same time it's too big and a waste of time and space)
when you exit TWRP do not choose to install the twrp app
Also be sure and thank aslezak for his post here > https://forum.xda-developers.com/showpost.php?p=75115521&postcount=286
Notes on booting up the phone (from power off)
Bootloader (fastboot) = power + volume down + USB hooked to pc
eRecovery = power + volume up + USB hooked to PC
TWRP = power + volume up
Restoring your phone to Stock​
We now have the B120 Stock dload update See here >> https://forum.xda-developers.com/showthread.php?p=76902495&highlight=dload#post76902495
I've created a Stock Rom to easily return your phone to Stock Factory Settings (b120)
Warning this will completely Wipe your phone​​To Install
1) Download and copy the H1711z_stock_ROM_v2.zip to your external_sd
2) Boot to TWRP recovery
3) Go to Settings check Use rm -fr instead of formatting / Wipe / Format Data / Type "yes" to confirm
4) Choose Home / Install /Select storage Micro sd / H1711z_stock_ROM_v2.zip / swipe to install
5) when it finishes choose the wipe cache button and then reboot and choose Do not Install
Your phone is now back to stock
Extra's By Request​
Here's the XT2_Stock_Rom and XT2_Magisk_ Rom here > https://androidfilehost.com/?w=files&flid=266256
If you like to try my CleanRom for the Elate I uploaded it here >> Elate.CleanRom.v2.zip
flashing instructions are the same as the stock file above
here's whats added/removed
Apps deleted from /Data/hwinit/:
Google Editor Slides
Google Editor Sheets
Google Editor Docs
Apps deleted from Cust:
the entire h1711 folder
AT&T Remote Support
myAT&T
AT&T Visual Voicemail
AT&T Hot Spots
Google Talkback
OMACP
Apps deleted from System:
Amazon shopping
App select
Call Protect
CricketWiFiManager
Device Help
Deezer
Facebook
Facebook App Installer
Facebook app manager
Gmail
Google Duo
Google Chrome
Google Drive
Google Maps
Google Play Photos
Google Play Video
Google Play Music
Google Text to Speech Engine
Ignite
Lookout
myCricket
Protect Plus
Setup & Transfer
Added
FX Root File Manager (as a system App)
Magisk V16 (as a system App)
QuickBoot Reboot (as a system App)
I didn't include Xposed because it's useless without a decrypted Data partition
Note: To remove the Cricket bootanimation, use the FX File Manager with root permission and rename
..\system\version\special_cust\H1711z\cricket\us\media\bootanimation.zip" to bootanimation.zi_ and reboot
I got tired of seeing the error in twrp_v3 about not mounting patch_hw and fixed it ->> Here
you can unzip it and flash it to recovery with TWRP or fastboot
NOTE: added by scrungydoolittle I had a problem with the bz2 image. I prefer to not run it through bz2
dd if=/dev/block/bootdevice/by-name/userdata /external_sd/userdata.img
to restore--> dd if=/external_sd/userdata.img of=/dev/block/bootdevice/by-name/userdata
dd if=/dev/block/bootdevice/by-name/system /external_sd/system.im
to restore--> dd if= /external_sd/system.img of=/dev/block/bootdevice/by-name/system
Of course, the downside is you need a fairly large external sd card.
@scrungydoolittle Please edit you post and remove the Quote of the first post
also the file you posted is not for this phone please remove the link
as to you having problems with the bz2 image they work fine if you follow the instructions
I instructed the user to create their OWN backup of userdata before they format / wipe their data partition
this file most likely contains the users IMEI and should not be shared.
clsA said:
@scrungydoolittle Please edit you post and remove the Quote of the first post
also the file you posted is not for this phone please remove the link
as to you having problems with the bz2 image they work fine if you follow the instructions
I instructed the user to create their OWN backup of userdata before they format / wipe their data partition
this file most likely contains the users IMEI and should not be shared.
Click to expand...
Click to collapse
O.k. I removed the link. It was for the H1711 AT&T phone as it turns out.
And I don't think that image has the IMEI in it, because it is clearly the /system image, and I don't think that data is stored in that partition.
Otherwise all of the posted system images would have the same issue...
scrungydoolittle said:
O.k. I removed the link. It was for the H1711 AT&T phone as it turns out.
And I don't think that image has the IMEI in it, because it is clearly the /system image, and I don't think that data is stored in that partition.
Otherwise all of the posted system images would have the same issue...
Click to expand...
Click to collapse
Thanks ...yeah the userdata contains the IMEI not the system.img
Sent from my LG-H910 using Tapatalk
I would not share a userdata backup unless it was after a factory reset and before I entered any personal account information or data. Agree with you on that
I'd love to see a reliable reference that says userdata contains the IMEI or if you know specifically where it's stored, because l thought IMEI is stored in a totally different partition.
clsA said:
Thanks ...yeah the userdata contains the IMEI not the system.img
Sent from my LG-H910 using Tapatalk
Click to expand...
Click to collapse
divineBliss said:
I would not share a userdata backup unless it was after a factory reset and before I entered any personal account information or data. Agree with you on that
I'd love to see a reliable reference that says userdata contains the IMEI or if you know specifically where it's stored, because l thought IMEI is stored in a totally different partition.
Click to expand...
Click to collapse
IMEI is stored in data/data/com.android.phone
Thank you
Found the IMEI in
/data/data/com.android.phone/shared_prefs/
com.android.phone_preferences.xml on my H1611 after your post.
I'm guessing the IMEI is copied from another partition, but the fact that it's in /data is news to me.
I wonder if the IMEI is in the above file after a factory reset , but I'm not planning to find out anytime soon .
People, be careful sharing your userdata partition backups and other sensitive data containing partition backups out there - unless of course you don't give a crap about security - which you should preface up front so as to not mislead uninformed people of the risks involved in sharing those sensitive data partitions.
clsA said:
IMEI is stored in data/data/com.android.phone
Click to expand...
Click to collapse
It sure would be nice to get one of these stock flash zip's for the H1711 XT2. Would this zip work on it?
clsA said:
Restoring your phone to Stock​
I've created a Stock Rom to easily return your phone to Stock Factory Settings (b120)
Warning this completely Wipe your phone​​To Install
1) Download and copy the H1711z_stock_ROM_v2.zip to your external_sd
2) Boot to TWRP recovery
3) Go to Settings check Use rm -fr instead of formatting / Wipe / Format Data / Type "yes" to confirm
4) Choose Home / Install /Select storage Micro sd / H1711z_stock_ROM_v2.zip / swipe to install
5) when it finishes choose the wipe cache button and then reboot and choose Do not Install
Your phone is now back to stock
Click to expand...
Click to collapse
freedomwarrior said:
It sure would be nice to get one of these stock flash zip's for the H1711 XT2. Would this zip work on it?
Click to expand...
Click to collapse
Nice.
What partitions does this install?
And can you make this for the H1711 At&T phone?
freedomwarrior said:
It sure would be nice to get one of these stock flash zip's for the H1711 XT2. Would this zip work on it?
Click to expand...
Click to collapse
No don't use this on the XT2
I / you need system/boot/recovery/ and cust.img files from a XT2 to build it.
Sent from my LG-H910 using Tapatalk
clsA said:
No don't use this on the XT2
I / you need system/boot/recovery/ and cust.img files from a XT2 to build it.
Sent from my LG-H910 using Tapatalk
Click to expand...
Click to collapse
If I send you (or point you to )
system
boot
recover
and cust images could you create one?
The image for system is available, a patched bootloader that installs magisk, an unpatched boot loader, the recovery and e recovery are the same.
I'd like to see 2 flashable zips.
1. that does stock
2. that installs twrp and magisk.
I have all those, but I'm not sure how to make the zip. Is it simply a matter of opening it in a zip prgram and replacing the mentioned image files
with appropriate ones?
scrungydoolittle said:
If I send you (or point you to )
system
boot
recover
and cust images could you create one?
The image for system is available, a patched bootloader that installs magisk, an unpatched boot loader, the recovery and e recovery are the same.
I'd like to see 2 flashable zips.
1. that does stock
2. that installs twrp and magisk.
I have all those, but I'm not sure how to make the zip. Is it simply a matter of opening it in a zip prgram and replacing the mentioned image files
with appropriate ones?
Click to expand...
Click to collapse
I have the Stock system.img and erecovery.img
put the others in a google drive and I'll build them
clsA said:
I have the Stock system.img and erecovery.img
put the others in a google drive and I'll build them
Click to expand...
Click to collapse
Here is the cust.img I just pulled from my XT2 using the dd command.
https://drive.google.com/open?id=1euUHZiJrzfyUVNqgOT76rTk45clPwv9F
Here is a copy of the stock boot I have had sitting on my hard drive.
https://drive.google.com/open?id=1-dAJuwgYdM9F3fBn4dU3x9s74SucocBP
And here is a copy of patched boot (with magisk) if you need it.
https://drive.google.com/open?id=1Tfb7zkcX6auoYEVnMLKDN6tibfzHSPEW
And thank you in advance for doing this! :good:
freedomwarrior said:
Here is the cust.img I just pulled from my XT2 using the dd command.
https://drive.google.com/open?id=1euUHZiJrzfyUVNqgOT76rTk45clPwv9F
Here is a copy of the stock boot I have had sitting on my hard drive.
https://drive.google.com/open?id=1-dAJuwgYdM9F3fBn4dU3x9s74SucocBP
And here is a copy of patched boot (with magisk) if you need it.
https://drive.google.com/open?id=1Tfb7zkcX6auoYEVnMLKDN6tibfzHSPEW
And thank you in advance for doing this! :good:
Click to expand...
Click to collapse
Files are uploading now > https://www.androidfilehost.com/?w=files&flid=257749
Instructions are the same
Backup anything on internal storage it will be wiped
To Install
1) Download and copy the Rom to your external_sd
2) Boot to TWRP recovery
3) Go to Settings check Use rm -fr instead of formatting / Wipe / Format Data / Type "yes" to confirm
4) Choose Home / Install /Select storage Micro sd / your_rom.zip / swipe to install
5) when it finishes choose the wipe cache button and then reboot and choose Do not Install
Your phone is now back to stock
Click to expand...
Click to collapse
after flashing the Magisk rom install the magisk manager and update to v16 (or whatever the newest is)
Awesome! Thank you so much for these. They will definitely come in handy! Much Appreciated!! :good::
clsA said:
OK to start off this thread is meant to continue the work done in the thread here huawei-ascend-xt2-h1711 their were some good people working on stuff their but most seem to have moved on.
Does this wipe out the recovery, and relock the bootloader, or will the bootloader remain unlocked, and twrp remain in place?
Thanks for the XT2 versions.
I decided to pick up the Elate this week from Best Buy and thought it might be time to start a new thread on rooting and restoring the Cricket version of this phone.
Rooting the H1711z Huawei Elate​
First step is to unlock your bootloader at Huawei here > https://hwid5.vmall.com/CAS/portal/...ndex&loginChannel=22000000&reqClientType=2023
Also please make a backup of your own boot.img as soon as you flash TWRP before flashing the patched _boot.img provided
~Huge thanks to @aslezak for these instructions~
Note: Magisk Manager will update you to version 16 on first run, it's OK to update in fact feel free to flash it in recovery before you reboot if you want it.
A couple notes about twrp_xt2_v3.img
when you start TWRP choose keep system read only - Unless your planing to restore a backup then choose to make system writable
You cannot backup or restore /data (it's encrypted so don't even try)
Do not use Wipe / factory reset or format data unless you have a good working backup of your userdata partition that you dd to your external_sd yourself see below
From TWRP / adb shell
paste these commands
dd if=/dev/block/bootdevice/by-name/userdata | bzip2 -9f > /external_sd/userdata.img.bz2
to restore--> bzip2 -dc /external_sd/userdata.img.bz2 | dd of=/dev/block/bootdevice/by-name/userdata
dd if=/dev/block/bootdevice/by-name/system | bzip2 -9f > /external_sd/system.img.bz2
to restore--> bzip2 -dc /external_sd/system.img.bz2 | dd of=/dev/block/bootdevice/by-name/system
again thanks go to aslezak
When choosing a backup always prefer the image instead of the stock files (system image - custom image - vendor image are best )(Never choose both system and system image at the same time it's too big and a waste of time and space)
when you exit TWRP do not choose to install the twrp app
Also be sure and thank aslezak for his post here > https://forum.xda-developers.com/showpost.php?p=75115521&postcount=286
Notes on booting up the phone (from power off)
Bootloader (fastboot) = power + volume down + USB hooked to pc
eRecovery = power + volume up + USB hooked to PC
TWRP = power + volume up
Restoring your phone to Stock​
I've created a Stock Rom to easily return your phone to Stock Factory Settings (b120)
Warning this will completely Wipe your phone​​To Install
1) Download and copy the H1711z_stock_ROM_v2.zip to your external_sd
2) Boot to TWRP recovery
3) Go to Settings check Use rm -fr instead of formatting / Wipe / Format Data / Type "yes" to confirm
4) Choose Home / Install /Select storage Micro sd / H1711z_stock_ROM_v2.zip / swipe to install
5) when it finishes choose the wipe cache button and then reboot and choose Do not Install
Your phone is now back to stock
By request I have also added the XT2_Stock_Rom and XT2_Magisk_ Rom here > https://www.androidfilehost.com/?w=files&flid=257749
Click to expand...
Click to collapse
Does this wipe out the recovery, and relock the bootloader, or will the bootloader remain unlocked, and twrp remain in place?
Thanks for the XT2 versions.
scrungydoolittle said:
Does this wipe out the recovery, and relock the bootloader, or will the bootloader remain unlocked, and twrp remain in place?
Thanks for the XT2 versions.
Click to expand...
Click to collapse
Really ?? You quoted the first post again
Flashing a Rom will never relock your bootloader
All 3 roms wipe TWRP
Sent from my LG-H910 using Tapatalk
@scrungydoolittle,
I was going to say the same.. .. The reason for clsAs comment is.. .
It's considered bad practice to post the OP or any other long posts unnecessarily. It makes it extremely difficult and annoying for others to wade past the huge quoted post to see what you said.
You can just quote the relevant part of a post (as I did below), refer to post 1 as the OP, or put a link to the post you are referring to.
Hopefully this explanation will get you to edit your last post and reconsider quoting long posts in the future.
Thanks
PS: Consider the fact that some of us read forums via email, XDA forum app, and browsers on mobile devices which have limited screen real estate and require more scrolling than a large desktop monitor.
clsA said:
Really ?? You quoted the first post again
...
Click to expand...
Click to collapse
I'm hoping for some help in rooting my Elate. I was able to get the unlock code from Huawei. I downloaded the ADB and Fastboot drivers from the Android Tutorials page.
ADB recognizes my device when in normal mode. But when I reboot into Bootloader mode, the device is not recognized. It does not show up in Windows device manager and the command "adb devices" is null. I can't get past this point which is clearly a driver problem.
I also have installed and uninstalled Hi-suite a number of times.
Does anyone have any advice? Thanks.

Categories

Resources