Any way to encrypt /data/data and /sdcard on Xiaomi EU ROM? - Xiaomi Mi Mix 2S Questions & Answers

Hello,
Xiaomi EU ROM is running decrypted, that's a security breach...
Is there a way to use Xiaomi EU ROM, based on Miui 10, in a encrypted phone?
Thanks

I tried but no success. The only method to enable encryption is miflash official rom. For me it works perfectly in Los. Apparently xiaomi Eu removed encryption from vendor.

And there is no way to add the files to the vendor partition?

I am using the EU ROM for months encrypted (FBE).
It's a little complicated to get there (and to stay), but it can be done.
1. You need to come from an encrypted MIUI Rom
2. Enter TWRP, enter your decryption code.
Important note: NEVER format in TWRP, otherwise you'll have to start from MIUI again (which means flashing with MiFlash).
4. Dirty flash EU Rom. Do NOT reboot.
5. After flashing the ROM, go to the main menu in TWRP and mount the Vendor partition.
6. Install the attached Zip file with TWRP (copy to phone before starting the whole procedure steps)
7. Reboot
As I said I followed this procedure for the last months, running EU and still encrypted.
You have to do ALL the steps 2-7) again EVERYTIME you flash a new EU Rom.

Hello,
Thanks for the answer. I will try it, but...
1) After flash this, I can wipe device (not format) from TWRP?
2) Is also /sdcard encrypted or only /data/data?
3) I can't install Global MIUI from TWRP if I will return to Global?
4) I assume that I can install Magisk after 6 and before 7
Thanks
hoehm72 said:
I am using the EU ROM for months encrypted (FBE).
It's a little complicated to get there (and to stay), but it can be done.
1. You need to come from an encrypted MIUI Rom
2. Enter TWRP, enter your decryption code.
Important note: NEVER format in TWRP, otherwise you'll have to start from MIUI again (which means flashing with MiFlash).
4. Dirty flash EU Rom. Do NOT reboot.
5. After flashing the ROM, go to the main menu in TWRP and mount the Vendor partition.
6. Install the attached Zip file with TWRP (copy to phone before starting the whole procedure steps)
7. Reboot
As I said I followed this procedure for the last months, running EU and still encrypted.
You have to do ALL the steps 2-7) again EVERYTIME you flash a new EU Rom.
Click to expand...
Click to collapse

I reply my questions:
After flash EU ROM and the ZIP that @hoehm72 in the previous posts, the EU ROM is working fine.
You can wipe the device from TWRP and also return to Global version (you need to backup your /cust partition before flash EU for first time and restore /cust before flash Global ROM).
Also, /sdcard and /data/data remains encrypted in EU, like in Global.
Thanks mate!
EDIT: If you forgot to flash the zip file after flash EU ROM the phone will enter in a bootloop. No problem, you only need to enter TWRP then:
* mount vendor
* edit /vendor/etc/fstab.qcomm
then update "encryptable" by "fileencryption" then reboot...

Thank you, it worked for me too!

Hello how can I know if my rom is encrypted ?

If your device is rooted...
enter TWRP and, when TWRP asks for password click on cancel button.
Next, click on advanced -> file manager then navigate to /sdcard
If when you are on /sdcard (and also on /data/data) the file manager displays correctly the filenames you aren't encrypted and any can access to the files if has access to your device.
Bradco said:
Hello how can I know if my rom is encrypted ?
Click to expand...
Click to collapse

Bradco said:
Hello how can I know if my rom is encrypted ?
Click to expand...
Click to collapse
You can find it in settings-passwords&security- data privacy(or data security, I don't know in english) -encryption

The most secure mode to check it is to check over twrp, like I've explained.
Some roms, like eu, says encrypted but really aren't
Seosam said:
You can find it in settings-passwords&security- data privacy(or data security, I don't know in english) -encryption
Click to expand...
Click to collapse

This is what i posted some thime ago in xiaomi.eu forum.
I downloaded miui_MIMIX2SGlobal_V10.3.2.0.PDGMIXM_7e27e6e0d5_9.0.zip and xiaomi.eu_multi_MIMix2S_V10.3.1.0.PDGCNXM_v10-9.zip
than i extracted these folder and three files from global rom:
firmware-update
vendor.transfer.list
vendor.new.dat.br
vendor.patch.dat
than i deleted those three files and folder from xiaomi.eu rom
than i repacked xiaomi.eu rom with three vendor files from global rom (i used winrar, just drag and drop )
than i installed .zip on my phone
I managed to encrypt the latest (9.7.11) version too. You need to use vendor files from china beta (9.7.11). If you use older files your wifi wont work.

A less painful solution is to extract missing files from china rom
The file lists that should be added/replaced from china miui rom (about 3 MB, tested on Mi6 10.4.2.0, eu/cn):
Ps., some of below files are not necessary, but I am not sure which one did the trick.
/system/vendor/etc/gps.conf
/system/vendor/etc/mixer_paths_overlay_dynamic.xml
/system/vendor/etc/init/hw/init.qcom.rc
/system/vendor/etc/izat.conf
/system/vendor/etc/wifi/WCNSS_qcom_cfg.ini
/system/vendor/etc/fstab.qcom
/system/vendor/app/TrustZoneAccessService/TrustZoneAccessService.apk
/system/vendor/app/TrustZoneAccessService/oat/arm64/TrustZoneAccessService.odex
/system/vendor/app/TrustZoneAccessService/oat/arm64/TrustZoneAccessService.vdex
/system/vendor/app/ConnectionSecurityService/oat/arm64/ConnectionSecurityService.odex
/system/vendor/app/ConnectionSecurityService/oat/arm64/ConnectionSecurityService.vdex
/system/vendor/app/PowerOffAlarm/oat/arm64/PowerOffAlarm.vdex
/system/vendor/app/PowerOffAlarm/oat/arm64/PowerOffAlarm.odex
/system/vendor/app/PowerOffAlarm/PowerOffAlarm.apk
/system/vendor/app/SSGTelemetryService/oat/arm64/SSGTelemetryService.odex
/system/vendor/app/SSGTelemetryService/oat/arm64/SSGTelemetryService.vdex
/system/vendor/app/TimeService/oat/arm64/TimeService.odex
/system/vendor/app/TimeService/oat/arm64/TimeService.vdex
/system/vendor/app/TimeService/TimeService.apk
/system/vendor/lib/mediadrm/libdrmclearkeyplugin.so
/system/vendor/lib/mediadrm/libwvdrmengine.so
/system/vendor/lib/libmmcamera_imx386_semco.so
Obviously, in android 9 based miui 10, xiaomi.eu has removed encryption files from vendor, not just modified "fstab.qcomm".
On Mi6 10.4.2.0, I successfully encrypted /sdcard/ with above files.

In fact, you only need to replace fstab.qcomm at vendor/etc from the one included at eu miui from the one at stock rom.
This file as a size if 2KB
watert said:
Sorry, but I will add the file lists that should be added/replaced from china miui rom in hours later (about 3 MB).
Click to expand...
Click to collapse

Modification of "vendor/etc/fstab.qcomm" worked on android 8 based xiaomi.eu's miui, but not for android 9 based xiaomi.eu's miui -- at least for MI6.
If you only modify fstab.qcomm, but do not copy files which actually did the encryption job, encryption is fake (although it showed encrypted on "setting"). Check this by : goto twrp, click 'cancel' when it asks for gesture, then you would find you can still access files on /sdcard/ (without encryption).
bartito said:
In fact, you only need to replace fstab.qcomm at vendor/etc from the one included at eu miui from the one at stock rom.
This file as a size if 2KB
Click to expand...
Click to collapse

I have only modified fstab file and my device is encrypted (see screenshot).
The only that you need to do it not to do a format data under twrp after install EU ROM.
This is due the phone encryption will be done in global ROM. EU is not capable to do it even with the modified fstab, 9nly that can do is to manage a previously encrypted partition.
watert said:
Modification of "vendor/etc/fstab.qcomm" worked on android 8 based xiaomi.eu's miui, but not for android 9 based xiaomi.eu's miui.
If you only modify fstab.qcomm, but do not copy files which actually did the encryption job, encryption is fake (although it showed encrypted on "setting"). Check this by : goto twrp, click 'cancel' when it asks for gesture, then you would find you can still access files on /sdcard/ (without encryption).
Click to expand...
Click to collapse

Yes, that is one way. but I'd like to format/wipe everything in twrp before flashing.
If data partition was formated, I think ~3 MB files from china rom are necessary for encryption.
bartito said:
I have only modified fstab file and my device is encrypted (see screenshot).
The only that you need to do it not to do a format data under twrp after install EU ROM.
This is due the phone encryption will be done in global ROM. EU is not capable to do it even with the modified fstab, 9nly that can do is to manage a previously encrypted partition.
Click to expand...
Click to collapse

Please, post the files when possible. I will check. Thanks
watert said:
Yes, that is one way. but I'd like to format/wipe everything in twrp before flashing.
If data partition was formated, I think ~3 MB files from china rom are necessary for encryption.
Click to expand...
Click to collapse

hoehm72 said:
I am using the EU ROM for months encrypted (FBE).
It's a little complicated to get there (and to stay), but it can be done.
1. You need to come from an encrypted MIUI Rom
2. Enter TWRP, enter your decryption code.
Important note: NEVER format in TWRP, otherwise you'll have to start from MIUI again (which means flashing with MiFlash).
4. Dirty flash EU Rom. Do NOT reboot.
5. After flashing the ROM, go to the main menu in TWRP and mount the Vendor partition.
6. Install the attached Zip file with TWRP (copy to phone before starting the whole procedure steps)
7. Reboot
As I said I followed this procedure for the last months, running EU and still encrypted.
You have to do ALL the steps 2-7) again EVERYTIME you flash a new EU Rom.
Click to expand...
Click to collapse
For me this works with actual miui eu.
I checked it in TWRP too.
But maybe you need these 3MB when you do a clean start, without official miui first.

Seosam said:
For me this works with actual miui eu.
I checked it in TWRP too.
But maybe you need these 3MB when you do a clean start, without official miui first.
Click to expand...
Click to collapse
absolutely agree

Related

[GUIDE] [Q&A] [TREBLE] From Stock to Treble - everything you need to know!

Here I will share all the info you need to know about using Treble on the Mi A1. Everyone is more than welcome to ask questions and clarification here, I am happy to answer and will update this thread over time. Thanks!
Contents
0. Key Terms
1. Restoring to Stock
-- 1.1. Requirements
-- 1.2. Full-device backup
-- 1.3. Stock restore process
2. "Treblize" (repartition) the device
3. Your first Treble ROM install
4. Installing AIO's, GSI's, Vendors and More
-- 4.1. Install a Treble AIO
-- 4.2. Install a Treble GSI
-- 4.3. Install/update a Vendor Pack
-- 4.4. Install a non-Treble ROM
-- 4.5. Restore a TWRP backup
5. Mods and Extras [Gapps, Magisk, custom kernels, etc.]
6. FAQ and Troubleshooting
----------------------------------------------
0. Key Terms
Throughout your Treble adventures, you may see lots of new terms. Here I will explain them all. This is essential reading!
Treble
Treble is the broad term of a new Android architecture model of splitting the system into two partitions:
System: where the Android OS goes, i.e. Oreo or later operating system;
Vendor, where the device-specific files go, such as drivers.
Before Treble, both the Android OS and device-specific files would live together on system. See below for a more detailed description of Vendor.
"Treblizing"
May also be called Treble-enable, Treble-conversion or some variation of that. This is the process of converting a non-Treble device to a Treble-capable one, unofficially, by changing the partition map of the device. This involves shrinking an existing partition - such as userdata or system in the case of the Mi A1 - in order to create a new vendor partition - or two vendor partition in the case for our Mi A1, one for each slot. Treblizing is just the preparation stage - you still need an AIO installation (see AIO below) before you are actually able to use a Treble ROM.
Vendor
Also known as Vendor Pack or Vendor Image. In the context of Treble, this is a standalone vendor image (either as a ZIP or usually as an IMG) that can be flashed to your Treble-enabled device for it to be compatible with a Treble system/ROM. These are similar to a kernel in the way that they are flashed to their own partition on your device and are compatible with many Treble ROM's. They are also similar to a kernel in that they are made specifically for one device to provide the low-level functionality of the system. It mostly includes drivers, but can also include apps and overlays that are automatically added at runtime to the Android OS that's living on System.
Treble developers for the Mi A1 may release standalone "vendor.img" for use on other ROM's - usually GSI's (see description of GSI below) but they are also part of an AIO (see description of AIO below).
GSI
Stands for "Generic System Image". This concept, introduced and developed by @phhusson is the creation of a System image that is device-agnostic - that is, it is a ROM that is designed to work with an existing Treble device, as long as the device has a GSI-compatible Vendor and kernel installation. For devices with official Treble support, phhusson makes the effort to try and adapt his GSI system for compatibility - but for unofficial Treble device like the Mi A1, it's our (tissot developers) responsibility to make a Vendor/Kernel that is as GSI-compatible as possible.
AIO
Stands for "All In One". This is a Treble firmware that includes a Kernel, System and Vendor image in the one ROM ZIP. This provides an all-in-one Treble experience through a device-specific Treble ROM. AIO's are designed to work well with their own ROM but should also strive to be compatible with a GSI.
An explanatory chart of Key Terms
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Click here for full size image.
Ignore this spoiler (coded link to thumbnail because XDA thread edit breaks the IMG link)
Code:
https://img.xda-cdn.com/ic22y2zu5yi9EClrY11FS8FU5C0=/https%3A%2F%2Fimg.xda-cdn.com%2FU8u8IdA66PAFHOM4PsKNQbFHwSA%3D%2Fhttps%253A%252F%252Fimg.xda-cdn.com%252Fo1fMEJDyu5x7pv2B9KB323i8_IA%253D%252Fhttps%25253A%25252F%25252Fthumbs2.imgbox.com%25252Fd7%25252Fc2%25252FDxa93pOz_t.png
----------------------------------------------
1. Restoring to Stock
For the sake of consistency, I highly recommend everybody revert to a clean stock state. This ensures that as many of us are coming from the same place to eliminate inconsistency with reported bugs. If you're impatient or experienced though, feel free to skip this - but if you have issues, be sure to try again from here before asking for help.
Note that this will also restore you to the stock partition map, i.e. before "Treblizing".
1.1. Requirements
Unlocked bootloader and EDL access/drivers. See FAQ at bottom of this post for details on EDL.
Modern fastboot binary - it needs the "--set-active" option. Check with fastboot --help to see if it's listed in the usage.
Latest/recent official firmware package. Recommended "V.9.5.10.0.ODHMIFA" only because it's what I used, if you're not sure - but anything newer should be fine too.
Recent MiFlash version. I used 7.4.25 which can be downloaded from here.
1.2. Full-device backup
HIGHLY RECOMMENDED. While all this is relatively safe (as safe as device modding can be), I cannot be held responsible for any data loss or bricks. You can make a Low-Level backup with my tool here. You can use the "skip-systems-and-userdata" partition list to save time, since those can be backed up in TWRP anyway. This is here mostly as a failsafe.
Also backup your internal storage files. The Treblizing process may wipe your internal storage.
1.3. Stock restore process
Flash latest firmware (V.9.5.10.0.ODHMIFA at time of writing) in EDL mode with MiFlash. This will wipe your device (including Internal Storage) and restore stock partition map. This could take a while.
Optional: If Wifi is broken (you can check by booting ROM), flash the "tissot_images_V.9.5.10.0.ODHMIFA___persist-only" in MiFlash under EDL, attached. Just extract the ZIP and browse to the folder in MiFlash. You can replace the persist.img from official V.9.5.10.0.ODHMIFA or another ROM if you want to be sure it's genuine. Credits to @AlexAiS for discovering this.
Remember - you backed up your original persist.img in step 1 anyway, so this is not risky.
I am not sure how this works exactly. It seems MiFlash in EDL is able to re-build a MAC address while flashing the persist. I don't know where this MAC comes from though.
----------------------------------------------
2. "Treblize" (repartition) the device
If you looked at the chart, you'll know that this is just the first step. You will need to actually install an AIO ROM after this part. This is a ONE TIME PROCESS for getting Treble capability on your device.
Repartitioning is relatively painless ever since I created TWRP with Treble Manager. Read on for a walkthrough.
Fastboot boot to TWRP with mohancm's recovery img (i.e. recovery-3.2.1-1) if you don't already have TWRP installed. Do not get the installer - we're using the one with Treble Manager instead.
Install the latest TWRP with Treble Manager (v1.2 at time of writing, but of course latest version is best) then Reboot Recovery to actually load it. Be sure to read about TWRP with Treble Manager in that thread to understand how it works. If you have any questions specifically about the TWRP and Treble Manager, please ask in that thread.
Format Data in Wipe menu (to remove Stock encryption), then Reboot Recovery again (maybe not necessary but it can't hurt).
In TWRP, go to Advanced > Treble Manager and repartition the device by following the wizard. Userdata shrink is recommended, as per the in-menu description explaining this. Just try the Treble Manager and see yourself - it will ask you one last time before repartitioning so don't worry about it wiping without warning. Alternatively, you can just check the screenshots.
After finished it will reboot TWRP. You are now ready for installing a Treble AIO (and then a GSI, if desired), but be sure to still read on, especially the next section below (there is a known issue that you need to work around - otherwise a bootloop will occur).
----------------------------------------------
3. Your first Treble ROM install
THERE IS AN IMPORTANT STEP THAT MUST BE FOLLOWED HERE WHEN INSTALLING YOUR FIRST TREBLE ROM. FAILURE TO FOLLOW THESE INSTRUCTIONS WILL RESULT IN A BOOTLOOP.
Make a note of the current slot (in Reboot menu). If you followed this guide from Section 1, you should be in Slot A. If you're not, just swap any mention of Slot A and B in these steps.
Download a Treble AIO ROM (such as RR Treble Experimental) and flash in TWRP. This is required even if you want to use a GSI, since it has the required Vendor Pack and Kernel.
Immediately install TWRP with Treble Manager again, as you usually do, to re-inject TWRP into the new ROM boot image.
Reboot Recovery, NOT SYSTEM.
Confirm in Reboot menu that the device has successfully switched to Slot B. If it is still stuck in Slot A, this is a one-time bug that must be solved now - if you do not fix this then you will just bootloop.
If it is still stuck in Slot A, you must reboot to fastboot (make sure you have a current version, as explained in Section 1.1. "Requirements") and manually run the command:
Code:
fastboot --set-active=b
...after doing this once, slot switching should work fine in TWRP again. You should never have to do this again (unless you go back to stock then re-Treblize again).
In case you didn't know, all ROMs for our Seamless device actually install into the *other* slot that isn't currently active - that's why you always need to Reboot Recovery first before installing Magisk or Gapps and such.
I advise users from now on to keep an eye on their Slot switching whenever you install an AIO ROM to make sure it worked. If it happens again after these steps, please report it to me with as much details as possible (we're still trying to figure out this bug).
After following these steps, you should be able to flash Treble ROM's just as you would a normal ROM from now on. Your Treble transformation is complete. But read on for more help and walkthroughs if you need it.
----------------------------------------------
4. Installing AIO's, GSI's, Vendors and More
Assuming you followed Section 3 above, you are now ready to install anything as usual. But some users have expressed confusion about what they can and can't do from this point, so I will give you some example choices here.
4.1. Install a Treble AIO
At the time of writing this guide, currently the only Treble AIO is the RR Experimental build. If or when others come along, you can just install them like normal ROMs. We already did this in Section 3 above, but here is a simplified summary of that process:
Flash the AIO ROM in TWRP with Treble Manager 1.2+ - do NOT reboot
Immediately reflash TWRP with Treble Manager 1.2+ so you get the Treble-compatible TWRP back
Factory Reset if it's a different ROM, as you usually would in this case.
Make a note of which slot you are on right now
Reboot recovery
Make sure your device has now swapped to the other slot by checking the reboot menu. If it has not, you will need to repeat the fastboot --set=active step as explained in Section 3. (I don't know if this is necessary again - but I just want to warn users to be aware of this known bug)
Now that the slot has changed, you can install Gapps, Magisk and/or whatever other compatible additional mods you want.
4.2. Install a Treble GSI
You may remember from earlier that the Treble GSI's are just System images that use your existing Vendor and Kernel. We already have a Treble kernel and Vendor from an AIO (Section 3 or Section 4.1. above), so this is quite simple:
Download any GSI/Phh-Treble ROM's from the Treble-Enabled Device Development section and copy the IMG to device
Make sure your current slot is a Treble ROM slot (i.e. existing AIO or GSI working). Unlike AIO/ROM ZIP flashing, image flashing installs it to the CURRENT slot.
Flash the IMG to "System Image" in TWRP with Treble Manager 1.2+
Factory Reset if you're changing ROM's
Install any other mods (Gapps, GSI-compatible Magisk [i.e. 16.4 beta or later], etc.). You may need to boot the ROM once before installing any mods - this varies per GSI. Some existing mods may also be outright incompatible with the GSI.
Reboot
Note that since this is only a System image, there is no need to reinstall TWRP or Reboot Recovery.
4.3. Install/update a Vendor Pack
While you're on a current and working AIO or GSI slot, you can flash a vendor.img to update the driver/device level stuff for that ROM. This could be done to e.g. fix the Camera. This is useful if you're running a GSI.
Download a vendor.img from your AIO or Vendor Pack provider (e.g. RR AIO Experimental) and copy the IMG to device
Make sure your current slot is a Treble ROM slot (i.e. existing AIO or GSI working). Unlike AIO/ROM ZIP flashing, image flashing installs it to the CURRENT slot.
Optionally make a TWRP backup of Vendor (or more) if you want to be careful and it's your daily (I always do).
Flash the IMG to "Vendor Image" in TWRP with Treble Manager 1.2+
Reboot
Note that since this is only a System image, there is no need to reinstall TWRP, Reboot Recovery or install any Mods (Gapps, Magisk, etc) UNLESS it's a Vendor mod (as of time of writing, no Vendor mods exist yet).
4.4. Install a non-Treble ROM
This is simple, same as you're used to before Treblizing. But do note that this is only possible if you chose to resize Userdata when repartitiong with Treble Manager.
Download the ROM to your device
Optional - make sure the active slot is one with a Treble AIO/GSI ROM already - remember that ROM ZIPs install to the OTHER slot, not the currently active one; so this way you can easily switch back to the Treble ROM just by doing a Factory Reset (or TWRP restore of Data) and slot switch.
Factory reset
Install the ROM as per usual procedure (Install ZIP, reflash TWRP with Treble Manager 1.2+, reboot recovery to allow slot switch, install Gapps + Magisk + Mods, etc., reboot).
4.5. Restore a TWRP backup
There is nothing special about restoring a backup. Even if your backup was from a non-Treble ROM, you can restore that backup on a Treblized device. Obviously, though, any Treble ROM backup can only be restored on a Treblized device.
----------------------------------------------
5. Mods and Extras [Gapps, Magisk, custom kernels, etc.]
After you have confirmed that TWRP is booting in to the correct slot (see Section 3), you're ready to install other ROMs (see Section 4) followed by mods. I did briefly go over mods in Section 4, but I'll go into more detailed info about compatibility here.
Any usual Gapps should work fine, just as long as you flash after the slot is correctly set. Note that RR Camera (GCam) requires Gapps to be installed. I used Nano, they worked fine.
Also note that some GSI's will require you to boot the system first before installing Gapps.
Custom kernels must be marked Treble compatible for our device. Specifically (info for kernel developers) this means adding slotselect flag to vendor entry in DTB, and disabling dm-verity (so we can inject vendor changes to system).
It is reported that standard Magisk will work in RR Treble ROM, but it does NOT work on GSI. You need Magisk 16.4 beta or later for GSI's. Also see the FAQ section at the end for more info on the Magisk situation.
Some other ZIP's might need updating for Treble, really unsure. Experimentation is welcome. Just be sure you make TWRP backups before testing anything, of course!
--------------------------------
6. FAQ and Troubleshooting
Q) I get "cannot receive hello packet" in MiFlash
A) Just reboot EDL mode and try again. Usually only happens if you try to flash in EDL twice in a row. See the Low-level Backup/Restore/Unbrick toolkit thread for more info about EDL.
Q) How to Magisk with Treble? What is the TWRP and Magisk interaction?
A) Best to use Magisk 16.4 beta or later, it's reported as working on GSI's. Also note that Magisk is installed to the boot ramdisk (the same place as where TWRP goes) and this has the following implications:
Whenever you flash the TWRP installer, you will need to reinstall Magisk *after* you Reboot Recovery
TWRP installer will flash to BOTH slots, but Magisk will only flash to the CURRENT slot. So if you flash TWRP installer, it may erase any Magisk install on the inactive slot.
TWRP survival (in my recent TWRP builds) backs-up and restores the whole ramdisk. This will include Magisk, if it was already on the boot slot that it backs up.
Q) EDL mode? Eh?
A) EDL mode, or "Emergency DownLoad" mode, is a low-level mode for flashing devices. It is entered by the command:
Code:
fastboot oem edl
EDL mode is used to read/write to the eMMC more directly. It is used by this tool, as well as flashing with MiFlash.
Other important notes:
You will need good QDLoader drivers. These drivers gave me the best results.
You can exit EDL mode by holding Power button for ~10 seconds. Hold with VolDn to reboot into fastboot again, as one might expect.
Make sure you use a good USB-C cable.
Sometimes the flashing process can freeze. It will always report success when done. If it freezes, you need to reboot EDL mode. Try a different USB port or cable if you keep experiencing freezes.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
can i use this persist.zip inorder to solve the wifi issue in stock rom as well as some of custom rom too?
parasnarkhede said:
can i use this persist.zip inorder to solve the wifi issue in stock rom as well as some of custom rom too?
Click to expand...
Click to collapse
Yup. Just flash a stock persist.img in EDL mode. But backup your original in case, it could erase or change your BT MAC too.
@CosmicDan thank you so much for your work on this. Quite impressive if you ask me.
Tell me just something, every time you talk about "...do this or that in EDL mode..." you mean that we have to use your backup/restore tool, right?
I'm sorry for the noob question but, despite I'm quite familiar with Android, this is my first time using a device that has "slots" and that needs to boot to TWRP in order to flash it... there's some differences from all devices I had in the past and that's making doubt some stuff.
So, anyway, I'm currently using official BETA leaked by Xiaomi (Oreo 8.1 - OPM1.171019.019.8.5.11) so do I really need to reflash stock as you suggest? I mean...it's stock, beta but stock and I've never flashed any other custom ROM (since I've read that by doing it I could have issues with WiFi after returning to stock). So, what do you think? Is it really necessary to reflash stock? My partitions are all the original ones...the only thing different is system, right?
Thank you for your time and work.
Typhus_ said:
@CosmicDan thank you so much for your work on this. Quite impressive if you ask me.
Tell me just something, every time you talk about "...do this or that in EDL mode..." you mean that we have to use your backup/restore tool, right?
I'm sorry for the noob question but, despite I'm quite familiar with Android, this is my first time using a device that has "slots" and that needs to boot to TWRP in order to flash it... there's some differences from all devices I had in the past and that's making doubt some stuff.
So, anyway, I'm currently using official BETA leaked by Xiaomi (Oreo 8.1 - OPM1.171019.019.8.5.11) so do I really need to reflash stock as you suggest? I mean...it's stock, beta but stock and I've never flashed any other custom ROM (since I've read that by doing it I could have issues with WiFi after returning to stock). So, what do you think? Is it really necessary to reflash stock? My partitions are all the original ones...the only thing different is system, right?
Thank you for your time and work.
Click to expand...
Click to collapse
EDL mode is like fastboot mode, but even lower-level.
You enter into it with:
Code:
fastboot oem edl
It is needed by my backup tool yes, but it's also used to flash in MiFlash.
Will update the guide and FAQ with this info.
How to flash the persist file attached in the op in mi flash ?
You mean replace it with the one in the stock rom fastboot files and flash the whole rom again via mi flash ?
Ahmed Al-Sayed said:
How to flash the persist file attached in the op in mi flash ?
You mean replace it with the one in the stock rom fastboot files and flash the whole rom again via mi flash ?
Click to expand...
Click to collapse
Just browse to the folder with MiFlash....
CosmicDan said:
Just browse to the folder with MiFlash....
Click to expand...
Click to collapse
Oh, you mean choose only the persist.img file then mi flash will flash it automatically to the right partition ?
Ahmed Al-Sayed said:
Oh, you mean choose only the persist.img file then mi flash will flash it automatically to the right partition ?
Click to expand...
Click to collapse
No, you don't choose the persist.img. You choose the folder. You can't even choose a file in MiFlash, it's a folder browse.
It's the exact same method of flashing anything in MiFlash
CosmicDan said:
No, you don't choose the persist.img. You choose the folder. You can't even choose a file in MiFlash, it's a folder browse.
It's the exact same method of flashing anything in MiFlash
Click to expand...
Click to collapse
Which folder ?
The folder that i extracted the persist.img (attached in the op) in ? Or the srock rom folder after i replace the persist.img (attached in the op) with the one in the rom's folder and execute flash ?
Ahmed Al-Sayed said:
Which folder ?
The folder that i extracted the persist.img (attached in the op) in ? Or the srock rom folder after i replace the persist.img (attached in the op) with the one in the rom's folder and execute flash ?
Click to expand...
Click to collapse
DONT REPLACE PERSIST IN STOCK FIRNWARE. That does LITERALLY nothing, the persist is already from stock ROM!
Just extract the persist-only ZIP, and select it in MiFlash! Don't insert extra steps that I never said!
CosmicDan said:
DONT REPLACE PERSIST IN STOCK FIRNWARE. That does LITERALLY nothing, the persist is already from stock ROM!
Just extract the persist-only ZIP, and select it in MiFlash! Don't insert extra steps that I never said!
Click to expand...
Click to collapse
Thanks !
Dear sir,
I have few questions
1. Do we need any vendor image to flash with it?
2. How to revert back to stock rom (And erase vendor partition) from treble custom rom?
3. Can we revert back to stock partition map through mi flash tool in flastboot mode or edl mode?
Hopefully someone will make video soon, so that it becomes somewhat more easy to understand.
sudipta08sarkar said:
Dear sir,
I have few questions
1. Do we need any vendor image to flash with it?
2. How to revert back to stock rom (And erase vendor partition) from treble custom rom?
3. Can we revert back to stock partition map through mi flash tool in flastboot mode or edl mode?
Click to expand...
Click to collapse
1. I don't understand the question. The vendor image is part of the Treble ROM. You can get vendor from the RR Experimental thread for example.
2. By following Section 1.1.; Step 2 alone
3. By following Section 1.1.; Step 2 alone
CosmicDan said:
2. Flash latest firmware (V.9.5.10.0.ODHMIFA at time of writing) in EDL mode with MiFlash. This will wipe your device (including Internal Storage) and restore stock partition map. This could take a while.
Click to expand...
Click to collapse
Ritik99 said:
Hopefully someone will make video soon, so that it becomes somewhat more easy to understand.
Click to expand...
Click to collapse
Or you could tell us what part you're having trouble with so I can make it more easy to understand?
I don't understand how a video would make it easier. You need to be able to understand the process - not just copy what some guy is telling you to do.
CosmicDan said:
1. I don't understand the question. The vendor image is part of the Treble ROM. You can get vendor from the RR Experimental thread for example.
2. By following Section 1.1.; Step 2 alone
3. By following Section 1.1.; Step 2 alone
Click to expand...
Click to collapse
Ok I understand, but my query is, everytime I will flashing a new treble rom, will it flash vendor partition itself?
Congratulations, can't wait to test it on my a1.
One question, how about google play certified device status? Is still verified or not?
If i choose to shrink data partition, how much left for data? My a1 have 64 gb storage.
CosmicDan said:
Or you could tell us what part you're having trouble with so I can make it more easy to understand?
I don't understand how a video would make it easier. You need to be able to understand the process - not just copy what some guy is telling you to do.
Click to expand...
Click to collapse
Yup.. that what make people say "i do it the same as instruction and bricked my devices." It is because u just copy what other ppl do and dont know what exactly u do lol... Fir me, what in text is more worth.. because it explain everithing. And the video just a guidline of what u read.
sudipta08sarkar said:
Ok I understand, but my query is, everytime I will flashing a new treble rom, will it flash vendor partition itself?
Click to expand...
Click to collapse
Yes. Well, depends.
RR Treble has Vendor included, because it needs it. GSI's are just a system image that use your existing vendor.
squallbayu said:
Congratulations, can't wait to test it on my a1.
One question, how about google play certified device status? Is still verified or not?
If i choose to shrink data partition, how much left for data? My a1 have 64 gb storage.
Click to expand...
Click to collapse
If you.can tell me exactly what "Play Certified" actually is, then I might be able to answer that question.
The TWRP with Treble Manager tells you the size change.

Help Camera app not working...

Application of the camera does not work
Yesterday I installed the update of miui 10 V10.2.1.0.OEKMIXM of xiaomi EU after the installation everything correct, but the app of the camera stopped working and I can not make it come back up, install the global version and nothing , the same error, make the wipe cache, data, system all except the misc folder because it throws an error now I'm trying to download the ROM by xioamitool, I read a similar error in this forum but in mi8 and I managed to solve the problem installed a previous ROM but I do not know if miui 10 allows me to return to 9. if someone can help me to download a stable global ROM of miui 9 I would appreciate it.
icemanzor said:
Application of the camera does not work
Yesterday I installed the update of miui 10 V10.2.1.0.OEKMIXM of xiaomi EU after the installation everything correct, but the app of the camera stopped working and I can not make it come back up, install the global version and nothing , the same error, make the wipe cache, data, system all except the misc folder because it throws an error now I'm trying to download the ROM by xioamitool, I read a similar error in this forum but in mi8 and I managed to solve the problem installed a previous ROM but I do not know if miui 10 allows me to return to 9. if someone can help me to download a stable global ROM of miui 9 I would appreciate it.
Click to expand...
Click to collapse
From flash in this file in TWRP > select persist partition > restart the mobile
> https://we.tl/t-uCinDRXFgX
Thank you very much I work, I repair the camera and compass app, total thanks. :fingers-crossed::victory:
douglassillva said:
From flash in this file in TWRP > select persist partition > restart the mobile
> hxxps://we.tl/t-uCinDRXFgX
Click to expand...
Click to collapse
Hi, can you re-send the file? I have the same problem and the link expired already. Thanks!
solmich said:
Hi, can you re-send the file? I have the same problem and the link expired already. Thanks!
Click to expand...
Click to collapse
I also have the same problem.
Tried many roms and standard miui to no avail. Tired the camera2api apks and nada. Camera just not working any more after upgrading to pie...
Any ideas?
cyr1s said:
I also have the same problem.
Tried many roms and standard miui to no avail. Tired the camera2api apks and nada. Camera just not working any more after upgrading to pie...
Any ideas?
Click to expand...
Click to collapse
I've found a solution. So, I download standard miui firmware, 10.3.x in my case (Pie version), and then extract the content. In one of folders, you'll find vendor.img, copy this file to your /sdcard phone. Go to the TWRP terminal and execute this command: dd if=/sdcard/vendor.img of=/dev/block/mmcblk0pYY
YY is the vendor partition number, you can find it using mount command and carefully see which one is. Reboot and all is well. If your TWRP has an option to flash the vendor partition, it would be easier. Mine has no such option.
Read somewhere involving modifying xml file and using miflash, also emergency download mode (since vendor partition is readonly in fastboot), but I've failed to flash and the dd method above is succeeded. YMMV and good luck.
**update: it's persist not vendor, so change accordingly (vendor.img -> persist.img, also the mmcblk)
thanks
solmich said:
I've found a solution. So, I download standard miui firmware, 10.3.x in my case (Pie version), and then extract the content. In one of folders, you'll find vendor.img, copy this file to your /sdcard phone. Go to the TWRP terminal and execute this command: dd if=/sdcard/vendor.img of=/dev/block/mmcblk0pYY
YY is the vendor partition number, you can find it using mount command and carefully see which one is. Reboot and all is well. If your TWRP has an option to flash the vendor partition, it would be easier. Mine has no such option.
Read somewhere involving modifying xml file and using miflash, also emergency download mode (since vendor partition is readonly in fastboot), but I've failed to flash and the dd method above is succeeded. YMMV and good luck.
**update: it's persist not vendor, so change accordingly (vendor.img -> persist.img, also the mmcblk)
Click to expand...
Click to collapse
i had the same problem, and your solution works, i probed it on a redmi note 6 pro, but i flashed persist.img from INSTALL->persist i chose install image and then persist.img, i had probed install other firmwares but this was the only thing that works...Thanks you saved my phone :good:
solmich said:
I've found a solution. So, I download standard miui firmware, 10.3.x in my case (Pie version), and then extract the content. In one of folders, you'll find vendor.img, copy this file to your /sdcard phone. Go to the TWRP terminal and execute this command: dd if=/sdcard/vendor.img of=/dev/block/mmcblk0pYY
YY is the vendor partition number, you can find it using mount command and carefully see which one is. Reboot and all is well. If your TWRP has an option to flash the vendor partition, it would be easier. Mine has no such option.
Read somewhere involving modifying xml file and using miflash, also emergency download mode (since vendor partition is readonly in fastboot), but I've failed to flash and the dd method above is succeeded. YMMV and good luck.
**update: it's persist not vendor, so change accordingly (vendor.img -> persist.img, also the mmcblk)
Click to expand...
Click to collapse
Thx u save my camera too, i have to ask, ur compass works fine too?
solmich said:
Hi, can you re-send the file? I have the same problem and the link expired already. Thanks!
Click to expand...
Click to collapse
Can send it to me as well my camera just Dont want to connect its writing i want to try you way

Fail to permanent install and access TWRP due to encryption

Recently I just downgraded my Mi Mix 2s to MIUI V9.6.4.0.ODGMIFD via Miflash and planning to stay on this (global) rom. However, after flashing the latest twrp from the official link (v3.1.1-1) it did not ask for the lockscreen password upon entering the interface and my files just showed up with random filenames.
After some reading, I suppose my device is encrypted and twrp did not let me to decrypt it (without asking for lockscreen password). The random filenames still happens even I remove the lockscreen password before flashing twrp meaning the device is still encrypted. Before I could do anything else (flashing zip files, making backups, etc) I must format data to remove the encryption, but twrp will disappear after I booted into system and did the initial phone configuration. Tried different versions (from 3.2.3-0 to 3.3.1-1) but to no avail. The only way I can retain twrp after booting into system is to flash Magisk zip right after formatting data, but if I enter twrp again the filenames are still in random characters as before and I couldn't do anything in it.
So my question is how can I properly install twrp into my device without having the encryption issues? Could it be the rom that caused the problem or did I missed out any steps that fails to disable the encryption? Thanks for your attention.
WannaFly3721 said:
Recently I just downgraded my Mi Mix 2s to MIUI V9.6.4.0.ODGMIFD via Miflash and planning to stay on this (global) rom. However, after flashing the latest twrp from the official link (v3.1.1-1) it did not ask for the lockscreen password upon entering the interface and my files just showed up with random filenames.
After some reading, I suppose my device is encrypted and twrp did not let me to decrypt it (without asking for lockscreen password). The random filenames still happens even I remove the lockscreen password before flashing twrp meaning the device is still encrypted. Before I could do anything else (flashing zip files, making backups, etc) I must format data to remove the encryption, but twrp will disappear after I booted into system and did the initial phone configuration. Tried different versions (from 3.2.3-0 to 3.3.1-1) but to no avail. The only way I can retain twrp after booting into system is to flash Magisk zip right after formatting data, but if I enter twrp again the filenames are still in random characters as before and I couldn't do anything in it.
So my question is how can I properly install twrp into my device without having the encryption issues? Could it be the rom that caused the problem or did I missed out any steps that fails to disable the encryption? Thanks for your attention.
Click to expand...
Click to collapse
Guess I've found a workaround for this by installing the OrangeFox recovery project (ofrp). For those who stuck at the same issue as mine this is what I did:
1. Flash twrp img through adb fastboot.
2. Format data to remove encryption.
3. Paste ofrp zip file into the device and flash it via twrp, which boots the phone into ofrp interface.
4. Paste the recovery zip file into the device and flash it via ofrp. Under setting - MIUI OTA it should show 'enabled' (for android 9 and above might need to uncheck disable dm-verity first according to ofrp page, but my rom is at android 8 so I left it checked as default before flashing).
5. Reboot to system and complete the initial configuration.
6. Reboot to recovery again and ofrp should remain installed. From there I was then able to perform a backup.
Btw, under phone settings it says my device is still encrypted although I can access to ofrp without having the encryption issue as in twrp (random filenames, cannot transfer files or create backups, etc). Anyhow I now have a working custom recovery on the stock rom, cheers.

[Request] Please make a guide/ tutorial on how install GSI ROM on the latest firmware.

The phones keeps getting updates and the procedure to install GSI ROM might change. There are a bunch of guides in here but none of them worked for me.
If you managed to run GSI ROM on the latest Samsung firmware please share how you did it. Or is it even possible now?
this method was tested on my SM-A750F with lineageOS 17&18 (android 10&11).
1. download the AB VNDKLITE variant (should be called something with arm64-ab-vndklite.img or arm64_b??-vndklite.img)
2. if the image is in a .xz format, extract it using xz or 7zip/winzip
3. download the zip file i attached to this post
4. copy the zip and the extracted image into a SDCARD, then move the SDCARD into the phone.
5. install a custom recovery (for SM-A750FN, use TWRP by ashyx; for SM-A750F or SM-A750GN/DS, use PBRP)
6. boot into the custom recovery by holding the power button + volume up while restarting.
7. swipe to allow modifications
8. click install
9. on TWRP, you will need to click Install Image
10. navigate to your SDCARD folder
11. click on the .img file
12. it should ask you where do you want to install this image. click system
13. wait for it to flash.
14. click install again, then select the zip file you downloaded from your SDCARD.
15. click flash
16. after you finished flashing it, click install, navigate to /data/tmp and install Magisk.zip (you can delete this file after flashing it).
17. Click wipe > format data, then format data
18. After formatting data, click reboot>reboot system. you should now boot into your new OS!
Thank you for the guide!!!
It booted to Lineage OS 18 but after rebooting it's stuck at the lock screen: Screen Lock, Fingerprint and Camera are not working. Is this to be expected for Lineage OS 18?
did you make sure to wipe data before you installed the new OS?
what do you mean by screen lock? password?
What model do you have? (e.g. SM-A750FN, SM-A750F, etc)
can you send me the logs when the camera crashes/when setting password? (to get logs, run adb logcat -f logcat.txt, then upload logcat.txt)
What model do you have? (e.g. SM-A750FN, SM-A750F, etc)
Click to expand...
Click to collapse
Device: SM-A750GN
Tried: GSI - Lineage OS 18 [arm64-ab-vndklite]
did you make sure to wipe data before you installed the new OS?
Click to expand...
Click to collapse
Yes I made I sure I followed your instructions. Question: Is it enough if I format the data partition once? If first attempt failed and I want to flash another ROM will I have to format data partition again? I am doing this everything just to be sure for now.
what do you mean by screen lock? password?
Click to expand...
Click to collapse
During the initial setup if I try to set a PIN or Fingerprint it bootloops or the setup crashes.
Outcome of each ROM:
Lineage OS 17: Bootloop = The logo keeps moving.
Lineage OS 18:Camera, GPS not working. Error when setting PIN for lockscreen.
Please check attachments for logcats and screenshots.
Can you send me a logcat of the boot proccess? (start logcat when powering up the phone, close it after camera crashed/pin setting crashes)
itmr said:
Can you send me a logcat of the boot proccess? (start logcat when powering up the phone, close it after camera crashed/pin setting crashes)
Click to expand...
Click to collapse
I have tried for days and given up. Sorry. Maybe I will try later.
u need to downgrade to the oldest same sw bit firmware, no other options works
I did install treeui 0.95 gsi on my a750f device,how can i install other android 11 gsi on my phone?

Project Treble Device goes into bootloop after any custom rom. Doogee N20

My doogee n20 goes into a bootloop after any android custom rom, like i tried phh treble, pixel experience and my device softbricked every time, Android 10,11 doesnt matter still bootloops, i am trying to update my android version but the phone has a-only partitions which restricts me from android 12 right now, i can root and/or twrp but custom treble roms are a no-no. Any help please? NOTE: no i dont want to get softbrick fixed, i have a sp flash tool backup and it works, i need a way how to install hopefully android 11 or 12, android 10 is ok too.
Project Treble has nothing to do with Android's partion-layout, what may be a A-only one or A/B one - with the latter there are two virtual hard drives that each contain a copy of Android.
Project Treble means Android is parted: part #1 what contains the lower-level code created by silicon vendors, and part #2 what contains main Android operating system framework. So device manufacturers can update the OS code without having to rely on silicon vendors to refresh the lower-level code for every release.
Phh treble work perfectly on my Doogee N20 and by the way it is A/B not A only. And, but one thing I needed to install vendor.img the first time I installed a Gsi.
Try this
1. Download GSI for Arm64 A / B and extract then.
2. Download firmware stock here
Firmware doogee n20 by 4pda
3. After downloading the Stock firmware extract the vendor.img
4. restarted in TWRP, go to clear,select Dalvik / ART cache, system, data and cache, drag flash bar
5. Go back, go to install, find the folder where the GSI is, select install with system image, go back and find the folder where vendor.img is and select install with vendor image
6. Reboot system
Sorry for bad English.
AtS17 said:
Try this
1. Download GSI for Arm64 A / B and extract then.
2. Download firmware stock here
Firmware doogee n20 by 4pda
3. After downloading the Stock firmware extract the vendor.img
4. restarted in TWRP, go to clear,select Dalvik / ART cache, system, data and cache, drag flash bar
5. Go back, go to install, find the folder where the GSI is, select install with system image, go back and find the folder where vendor.img is and select install with vendor image
6. Reboot system
Sorry for bad English.
Click to expand...
Click to collapse
I am ready to try it! Wish me luck!
AtS17 said:
Try this
1. Download GSI for Arm64 A / B and extract then.
2. Download firmware stock here
Firmware doogee n20 by 4pda
3. After downloading the Stock firmware extract the vendor.img
4. restarted in TWRP, go to clear,select Dalvik / ART cache, system, data and cache, drag flash bar
5. Go back, go to install, find the folder where the GSI is, select install with system image, go back and find the folder where vendor.img is and select install with vendor image
6. Reboot system
Sorry for bad English.
Click to expand...
Click to collapse
THANK YOU, THANK YOU AND THANK YOU AGAIN, IT WORKED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! OMGOMG IM SO EXCITED
KajaSilber09 said:
THANK YOU, THANK YOU AND THANK YOU AGAIN, IT WORKED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! OMGOMG IM SO EXCITED
Click to expand...
Click to collapse
I'm glad I helped

Categories

Resources