[CLOSED] What is "vbmeta.img" ? - Xiaomi Redmi Note 7 Questions & Answers

What is "vbmeta.img" and why it is needed? How it works? Does anybody knows?

Có ***g câu hỏi
---------- Post added at 02:48 PM ---------- Previous post was at 02:44 PM ----------
I have the same question in

Google it

I have a question regarding vbmeta: I flashed it when I was installing a rom (let's say unofficial los). If I install another rom that doesn't ask me to flash vbmeta (let's say xiaomi.eu), will it flash another vbmeta? Is vbmeta included in xiaomi.eu's .zip?

As far as i understood it, correct me if i'm wrong, it disables verified boot for e.g. installing a gsi rom.

kennyk09 said:
Google it
Click to expand...
Click to collapse
Funny... I just did that and here I am.
I would like to know what is vbmeta as well...
Sent from my MI 9 using Tapatalk

After Android 8 they implemented Verified Boot. That's why you need vbmeta.img for some tasks (mostly to disable verified boot). In some cases, TWRP will not install if Verified Boot is on. Read more Here

kennyk09 said:
Google it
Click to expand...
Click to collapse
This is the 2nd reply on google rofl, got any better ideas genius

Yahoo it

kennyk09 said:
Google it
Click to expand...
Click to collapse
What if I bing it, sir?

Google sent me here — it's the first result when searching "vbmeta.img". Looks like we've entered a recursive function here! Let's add an exit condition.
Further digging led me to the Android Verified Boot 2.0 Readme which by skimming through it answered most of my questions.
So to get this clear, my current understanding is that vbmeta is akin to SecureBoot on PC — it uses hashes for each stage of the boot process to ensure that the final operating environment hasn't been tampered with at any stage of the startup process. Now since vbmeta actually contains the hashes/keys for the boot, system, and vendor partitions, that does mean that every ROM build will need a unique vbmeta.img if we wanted AVB to verify successfully, right? Also, I still don't understand how a vbmeta.img can disable AVB... does it simply set the hashes to zeros? And if we wanted to disable AVB, then where would THAT vbmeta.img come from? I presume we would need an image that is specific for our device, or would a generic vbmeta.img work across multiple devices (maybe with the limitation of being for A-only or A/B devices)?
I've been away from the custom ROM scene for a long time, so I'm trying to catch up with all these new features (AVB, A/B partitions, SafetyNet, etc.).

AFAIK, you need to flash vbmeta.img if you are going from an Miui ROM to a custom ROM.
And there is only one version of it.

rossarnie said:
AFAIK, you need to flash vbmeta.img if you are going from an Miui ROM to a custom ROM.
And there is only one version of it.
Click to expand...
Click to collapse
your right, vbmeta is responsible for checking initial boot to enter into boot or in recovery mode. thats why make sure you flash or restore system with its own vbmeta or you will end up bootloop or stock on fastboot mode.

kennyk09 said:
Google it
Click to expand...
Click to collapse
TOP answer! Do you know what happens if I search for "vbmeta.img" in Google? I end up in this thread!
A forum would be pretty much useless if every question in every thread would be answered in this way. A kind of "master solution": Google it!
Thank you!!

So is the vbmeta.img the same file for all phones?
Or is it vendor specific?
Or is it phone specific?
Thank you!

Elmarigo said:
So is the vbmeta.img the same file for all phones?
Or is it vendor specific?
Or is it phone specific?
Thank you!
Click to expand...
Click to collapse
As a part of a custom ROM or your firmware images it must be unique for your device model. It's like a boot.img for example.
A vbmeta.img contains checksums of the most important partitions to verify them.
A checksum is a small-sized datum derived from a block of digital data for the purpose of detecting errors that may have been introduced during its transmission or storage. By themselves, checksums are often used to verify data integrity but are not relied upon to verify data authenticity. (Wikipedia)
vbmeta=
verified boot metadata

Thank you!
I know what a checksum is, but didn't know that the vbmeta image contained checksums - which arised more questions:
When every partition is checksummed against vbmeta, wouldn't the phone need a different vbmeta everytime, depeding on Magisk being installed, or TWRP, or both combined?

Elmarigo said:
Thank you!
I know what a checksum is, but didn't know that the vbmeta image contained checksums - which arised more questions:
When every partition is checksummed against vbmeta, wouldn't the phone need a different vbmeta everytime, depeding on Magisk being installed, or TWRP, or both combined?
Click to expand...
Click to collapse
1. Not every partition, only /system, /vendor and /boot in most cases. But this could vary depending on your manufacturer.
2. Magisk is a systemless root solution. Have a look at /sbin/.magisk and you will see, that /system and /vendor were mounted as mirrors with all modifications that are needed, e.g. Magisk modules.
Only TWRP does some changes on /system.

Wow
Kudos to the guy who said google it. You'd better duckduckgo it to break this cycle, because I also ended up here as the first result!

Elmarigo said:
So is the vbmeta.img the same file for all phones?
Or is it vendor specific?
Or is it phone specific?
Thank you!
Click to expand...
Click to collapse
that was already answered. only 1 version of vbmeta exists.

Related

[Tut][Jan-update]Fix DTBO message "There's an internal problem with your device"

[Tut][Jan-update]Fix DTBO message "There's an internal problem with your device"
Warning: I'm not responsible for any bricks or abnormalities, this tutorial is based on my personal trial, I DONT OWN MAGISK It's developed by @topjohnwu and this tutorial is only for the full 8.1 (api27) December 05
Disclaimer: on recent updates topjohnwu released magisk boot scripts that clears avb-verity to allow modifications on the vendor partitions and all of that was possible by patching dtbo automatically using magisk manager and google developers assigned any unclear vendor modifications will indicate a message "There's an internal problem with your device. Contact your manufacturer for details"
make sure you have the latest magisk 14.5 installed using topjohnwu's tutorial
- uninstall magisk manager from your phone
- extract original dtbo.img from google's factory image 8.1 - 05 december's release
-reboot to bootloader using key combination vol- power or using adb command
Code:
adb reboot bootloader
-install dtbo using fastboot commands
Code:
fastboot flash dtbo dtbo.img
-reboot the system
-the message is gone
- install magisk-manager 5.4.0
- open the magisk manager and go to settings and turn-off update notification option
Reminder: If you are going to update magisk manager to 5.4.2 or later then dtbo will be automatically patched and you will see the message again the next reboot, please be aware that this is a temporairly fix until topjohnwu makes dtbo patch optional, so far modules , su and scripts are working like charm
-------------------------------------------------------------------------------------------------------------------------------------------------------
Jan Update
Hello Pixel Team, There have been some changes done recently
"there seems to be some sort of confusion about a/b slots, but Google made this method in order to avoid a catastrophic failure during an OTA update.
so for example: partitions like "radio, vendor, boot, bootloader and system" are occupied twice, so if boot.img is 50MB then it will be 50*2 = 100 which is installed on both slots (A/B).
DTBO slots dilemma solution:
Simply if your system is running on slot A which it is by default, then flash the DTBO to slot A.
Now let's wrap this up by saying we're glad that topjohnwu added new preserve option but since he updated magisk to 15.2 there seems to be a problem with that ,The flashable magisk triggers a script noticed in patchDTBO() script to automatically patch the DTBO.
Therefore I advise you to install Magisk 15.1 for the moment with the latest magisk manager if you want, that's also temporarily until the OP fix the issue ,definitely make sure you tick Preserve AVB option.
Make sure you also follow the same instructions in flashing the stock DTBO from Jan+ factory images
Bonus tip : to avoid notifications about updating, change the channel to custom and leave it blank in the magisk manager settings : download link
Cheers
My OCD thanks you
Finally got rid of the annoying message. Thanks a ton.
Quiet happy that there aren't any problems so far
Thanks brother worked like a charm!
Nice fix!!
This worked, thanks.
galaxys said:
Nice fix!!
Click to expand...
Click to collapse
It sure is but when I try I get this:
<FAILED. remote: no such partition>!
Any suggestions?
Thank you.
samteeee said:
It sure is but when I try I get this:
<FAILED. remote: no such partition>!
Any suggestions?
Thank you.
Click to expand...
Click to collapse
Well I completely understand the error, this means that either you are running the command in a location where the img isn't available in your pc or you typed the name of it wrong, probably a mistyping in the name dtbo i would suggest that you don't rename the file and that you run the command from where the directory of the file is located cheers
Shadow/Walker said:
Well I completely understand the error, this means that either you are running the command in a location where the img isn't available in your pc or you typed the name of it wrong, probably a mistyping in the name dtbo i would suggest that you don't rename the file and that you run the command from where the directory of the file is located cheers
Click to expand...
Click to collapse
I'll give it another go again.
Thank you.
Try this with factory boot/dtbo.imgs ... Working great!
https://forum.xda-developers.com/pixel-2-xl/development/unofficial-build-thread-magisk-twrp-t3708555
Worked flawlessly! Thank you kind sir
thedude420 said:
Try this with factory boot/dtbo.imgs ... Working great!
https://forum.xda-developers.com/pixel-2-xl/development/unofficial-build-thread-magisk-twrp-t3708555
Click to expand...
Click to collapse
I wouldn't because I've seen users reported that the message is back after reboot and my method is also working so support development by way other than satellite posts to your thread.
Magisk manager 5.4.2 update didn't seem different for pixel 2 phones.
Shadow/Walker said:
I wouldn't because I've seen users reported that the message is back after reboot and my method is also working so support development by way other than satellite posts to your thread.
Magisk manager updates didn't matter for pixel 2 phones.
Click to expand...
Click to collapse
Users would indicate multiple people. There is 1 person that I am aware of that has reported that issue. So, don't then. Satellite posts to my thread? Just trying to help people out with the issue and provide a solution to the problem. Sorry if I stepped on your toes big guy.
thedude420 said:
Users would indicate multiple people. There is 1 person that I am aware of that has reported that issue. So, don't then. Satellite posts to my thread? Just trying to help people out with the issue and provide a solution to the problem. Sorry if I stepped on your toes big guy.
Click to expand...
Click to collapse
My explanation was clear and it solved the problem already now the thing you need to worry about is the developer might report you for editing his scripts without seeking permission and that's breaking the law my tutorial was using strategic prepared app and scripts already by topjohnwu this is why I call it tutorial I hope you had his permission and I hope no one reports, your contribution is appreciated from my side but the thread already fixes the problem flashing additional scripts proves nothing but redundancy.
Shadow/Walker said:
My explanation was clear and it solved the problem already now the thing you need to worry about is the developer might report you for editing his scripts without seeking permission and that's breaking the law my tutorial was using strategic prepared app and scripts already by topjohnwu this is why I call it tutorial I hope you had his permission and I hope no one reports, your contribution is appreciated from my side but the thread already fixes the problem flashing additional scripts proves nothing but redundancy.
Click to expand...
Click to collapse
Man, you obviously didn't read the op as I take no credit for his great work. It's open source and he doesn't care who compiles the code. Everything is his and it's clearly stated. All I did was remove the problem and recompile. Regardless, there are no "scripts" and nothing is redundant whatever that means. So report away or whatever. I am now bowing out of this... Whatever it is. Sorry to "satellite post" in your thread. I'm leaving it forever now.
thank you much sir! this has fixed my problem, dang was that very annoying!! solution sticks thru reboot!
I had to uninstall current Magisk Manager before rebooting and performing the steps, otherwise Magisk Manager would patch dtbo and ask to reboot
Works perfectly ... thanks
Deuces said:
I had to uninstall current Magisk Manager before rebooting and performing the steps, otherwise Magisk Manager would patch dtbo and ask to reboot
Click to expand...
Click to collapse
Yes as mentioned in the thread

[How-To] Applying Monthly Security Patches if you're Rooted (Magisk)

So, since once a month I find myself having to click a bunch of links and read how to do a bunch of commands, I wanted to create a thread that (rather generically) explains how to manually flash the OTA monthly updates if you're rooted with Magisk. So, minimally, here's a thread for me to review every month... if it helps you all out, all the better!
Pre-requisites:
Download Latest OTA zip file from Google.
Obtain the STOCK boot.img (required) and dtbo.img (optional) of the System ROM you are currently running. This can be done if you already have the full System Image file downloaded, downloading it currently, or just obtaining the stock boot and dtbo image files elsewhere. (NOTE: This can be skipped if you successfully uninstall Magisk BEFORE you start the process and choose to restore the Stock images in the uninstall process.)
Download Latest Magisk Zip file
Download latest TWRP recovery image
If applicable, have latest USB drivers, adb/fastboot/ files etc.
Preparation:
1) Extract or open the Full Image file and locate the boot.img and dtbo.img files. You will want these on your PC in the platform-tools folder (I usually put the Month name at the beginning, ex. - Jan_boot.img). Again, you can skip if you successfully uninstall Magisk prior to all of this.
2) Copy your OTA zip file to the platform-tools folder, again naming it after the month helps (ex. - Feb_Pixel2XL_OTA.zip)
3) Put your TWRP recovery in platform-tools folder.
4) Place the latest Magisk zip on your Pixel's internal storage (what used to be the SDCard on phones so equipped).
Commands:
1) From PC, open command prompt and change directory to your platform-tools folder.
2) If your phone is on, "adb reboot bootloader" If powered off, press power and Vol Down button to get to Bootloader. Plug your phone into your PC.
3) [If Magisk is not uninstalled first] Command: fastboot flash boot {Name_of_boot.img File}
4) [If Magisk is not uninstalled first] Command: fastboot flash dtbo {Name_of_dtbo.img File}
5) On your phone, hit Vol Down until you see Recovery, then press power button.
6) Once in recovery mode, press power and Vol Up to bring up menu
7) Scroll to item: "Apply update from ADB" and press power
8) Command: adb sideload {Name_of_OTA.zip file}
9) After the OTA finishes flashing, exit recovery back into the Bootloader
10) Command: fastboot boot {twrp_filename.img}
11) Install Magisk Zip file (and any other Zip files you want installed... Kernels, etc.) within TWRP
Then after flashing your zip files, reboot to system and you should be all set.
I believe everything above is correct, but if I've made a glaring mistake, please let me know. I also realize there may be other methods to this madness, but this is what works for me.
With this method do you have to worry about removing your password from your phone before you try to go into twrp?
uofirob said:
With this method do you have to worry about removing your password from your phone before you try to go into twrp?
Click to expand...
Click to collapse
Yes. Mine is set to pin, which I had to put in and it let me finish.
Sweet. I'll give this method a try tonight!
WorldOfJohnboy said:
Yes. Mine is set to pin, which I had to put in and it let me finish.
Click to expand...
Click to collapse
Thank you for this. Just to be clear in step 2 under prerequisites you say more on this later. Then in step 1 for preparation you prefix your boot and dtbo with Jan xx.img. I get what your saying, but for the newer noobs they may get confused. Maybe reword to say, extract or open the factory image your currently using or the previous months image. Obviously you do this first so that you can sideload the ota. I don't mean any disrespect.
I believe you also need remove the -w from the end of the .bat file after you extract the OTA; otherwise, all of your data will be wiped.
But great job of getting all this info in one place!
So I did this, and now I'm bootlooping. I guess I'll re-flash the Jan factory image and wait a little longer... **UPDATE** I fixed the bootloop by re-trying the process again (after re-verifying the MD5 hash on the update.zip. I rebooted after installing the update,
but before the TWRP flash to install MAGISK. Maybe this allowed the "update"
to finish processing. I also had to remove the pin from my lock screen in order to allow me to get into twrp. After rebooting into the system and removing the pin, I adb reboot bootloader and then flashed twrp. Thanks for the guide!
---------- Post added at 07:58 AM ---------- Previous post was at 07:50 AM ----------
PuffDaddy_d said:
I believe you also need remove the -w from the end of the .bat file after you extract the OTA; otherwise, all of your data will be wiped.
But great job of getting all this info in one place!
Click to expand...
Click to collapse
You don't need to remove the -w from the .bat file since you aren't using it at all to do the update. That is only if you're flashing your factory image.
Fe Mike said:
Thank you for this. Just to be clear in step 2 under prerequisites you say more on this later. Then in step 1 for preparation you prefix your boot and dtbo with Jan xx.img. I get what your saying, but for the newer noobs they may get confused. Maybe reword to say, extract or open the factory image your currently using or the previous months image. Obviously you do this first so that you can sideload the ota. I don't mean any disrespect.
Click to expand...
Click to collapse
I changed some wording under prerequisite...
I agree with everything on this guide...
just teasing...
I'm actually glad you created this thread...I wanted to create one also and try and help out as much as I could, but I don't have the cahones and didn' t think I had experience enough to start a "guide" thread :silly:
I mean no disrespect, but this seems awful complicated compared to just flashing the full image with the removed (-w). Especially since your downloading it anyway. I do that then boot the TWRP image and flash the TWRP zip. Reboot into recovery and flash kernel and magisk and reboot system. Again I'm asking for clarity, not dumping on you. Great write up btw!
CyberpodS2 said:
I mean no disrespect, but this seems awful complicated compared to just flashing the full image with the removed (-w). Especially since your downloading it anyway. I do that then boot the TWRP image and flash the TWRP zip. Reboot into recovery and flash kernel and magisk and reboot system. Again I'm asking for clarity, not dumping on you. Great write up btw!
Click to expand...
Click to collapse
Well...I can't speak for the OP, but I wrote my extremely similar identical one because, for whatever reason, many users would choose OTAs over flashing full factory images. I/me & you understand the benefits of the factory images over the OTAs; especially understanding the process you must go through to install the OTAs as-of-current is almost the same as flashing the factory images anyways...
But if I were to give a possible explanation to their reasoning is that, like many of them, I come from a non-Google phone (S5 for me), and OTA's were simpler, takes less bandwidth (which still remains true today), they were significantly simpler to install vs. factory images, and with a lot of popular phones you only flash factory images to recover your phone; i.e. muniz_ri's OTA's for the S5 and FlashFire were loads simpler than flashing a whole factory image. But, again, understanding the difference for Pixel 2 and Oreo's OTA & factory images (or the small difference thereof), it's probably better to do a few extra steps and/or downloads to do the whole image than sideloading an OTA.
In the end, this is for people who insist for OTA updates most likely because that's how they are familiar (and therefore more comfortable) with; whether it being explained to them or not...
Cheers!:good:
Fair enough, thanks for the input!
CyberpodS2 said:
I mean no disrespect, but this seems awful complicated compared to just flashing the full image with the removed (-w). Especially since your downloading it anyway. I do that then boot the TWRP image and flash the TWRP zip. Reboot into recovery and flash kernel and magisk and reboot system. Again I'm asking for clarity, not dumping on you. Great write up btw!
Click to expand...
Click to collapse
It may seem awful complicated, but to be honest, to me is less complicated than having to edit a script file (which if you forget to do, will lose all of your data). Also, though the steps I wrote out seem like a lot more if you were to write out a process using the full image, it actually works out to be almost the same number of steps.
Lastly, as someone else hinted at, the OTA file size is smaller. The only full image you need is what you are currently running (which in most cases I have on my phone in case the sh__ hits the fan with my phone), not the new full image. (To be even more precise, you only need the boot.img and dtbo.img from the full image file--there may be places to get just those two files out there.)
As I put in the last sentence, I realize there are other methods to this madness, this is basically what works for me. I wanted to get it in writing so I wouldn't forget this down the road, and if it helps anyone here, just icing on the cake. Clearly I'm no Dev and not forcing anyone to perform the updates this way!
WorldOfJohnboy said:
It may seem awful complicated, but to be honest, to me is less complicated than having to edit a script file (which if you forget to do, will lose all of your data). Also, though the steps I wrote out seem like a lot more if you were to write out a process using the full image, it actually works out to be almost the same number of steps.
Lastly, as someone else hinted at, the OTA file size is smaller. The only full image you need is what you are currently running (which in most cases I have on my phone in case the sh__ hits the fan with my phone), not the new full image. (To be even more precise, you only need the boot.img and dtbo.img from the full image file--there may be places to get just those two files out there.)
As I put in the last sentence, I realize there are other methods to this madness, this is basically what works for me. I wanted to get it in writing so I wouldn't forget this down the road, and if it helps anyone here, just icing on the cake. Clearly I'm no Dev and not forcing anyone to perform the updates this way!
Click to expand...
Click to collapse
Hey bud, wonder I I could pick your brain just a little. When doing monthly Google updates, are most of their proprietary files located in the boot, dtbo, and vendor images?? Your posts have intrigued me a little, and are very well written BTW. My reasoning is this. On my old 6p, about all we needed to do was flash the new vendor, and of course the bootloader and radio if there were any worthwhile improvements. Would the same possibly apply to the P2XL?? I'm just wondering because, now that we're starting to see custom roms, if this would be a viable option, and simplify the updating process. Thank again for your great write up ??
Badger50 said:
Hey bud, wonder I I could pick your brain just a little. When doing monthly Google updates, are most of their proprietary files located in the boot, dtbo, and vendor images?? Your posts have intrigued me a little, and are very well written BTW. My reasoning is this. On my old 6p, about all we needed to do was flash the new vendor, and of course the bootloader and radio if there were any worthwhile improvements. Would the same possibly apply to the P2XL?? I'm just wondering because, now that we're starting to see custom roms, if this would be a viable option, and simplify the updating process. Thank again for your great write up
Click to expand...
Click to collapse
I'll be perfectly honest with you, I haven't taken a dive to see what is in the OTA files and would imagine that it varies depending on the monthly updates.... that said, the only reason why I have stated to re-flash the stock boot.img is because if you are rooted with Magisk, it takes the stock boot.img and modifies it. In order to take an OTA sideload, you need to be on stock boot.img and stock recovery. dtbo is only in my process because there was one time when I tried to sideload and my dtbo wasn't stock (or corrupt). You may not need to flash the stock dtbo.img, but it doesn't hurt to do so.
WorldOfJohnboy said:
I'll be perfectly honest with you, I haven't taken a dive to see what is in the OTA files and would imagine that it varies depending on the monthly updates.... that said, the only reason why I have stated to re-flash the stock boot.img is because if you are rooted with Magisk, it takes the stock boot.img and modifies it. In order to take an OTA sideload, you need to be on stock boot.img and stock recovery. dtbo is only in my process because there was one time when I tried to sideload and my dtbo wasn't stock (or corrupt). You may not need to flash the stock dtbo.img, but it doesn't hurt to do so.
Click to expand...
Click to collapse
I'm really happy to see our device has graduated to this level of discussion, instead of the random guessing and 14 different "possible" routes to a solution. Lol
Custom roms abound, once TWRP gets squared away and someone master's the art of turning monthly updates into zip installs we'll pretty much be there!
Btw OP, great write up... Clear and precise!
I do not understand the purpose for downloading the full system image and then flashing only the OTA zip - what am I missing? There is a widely distributed method for performing monthly OTA updates by uninstalling Magisk, updating OTA normally, then flashing Magisk again - seems much simpler, any reason why it would not work?
Brenneke said:
I do not understand the purpose for downloading the full system image and then flashing only the OTA zip - what am I missing? There is a widely distributed method for performing monthly OTA updates by uninstalling Magisk, updating OTA normally, then flashing Magisk again - seems much simpler, any reason why it would not work?
Click to expand...
Click to collapse
Downloading the full system image is not required. You only need the Stock versions of boot.img (required) and dtbo.img (optional) of the ROM version your phone is currently running. I actually keep a full system image on my phone in case something goes awry.
I'm going to update the OP to more clearly state that you only need the stock boot.img file--how you obtain it is up to you. Uninstalling Magisk will do the same exact thing, however I tried to do that a couple of months ago and it created more issues for me than if I had just flashed the stock boot.img in the first place.
WorldOfJohnboy said:
Downloading the full system image is not required. You only need the Stock versions of boot.img (required) and dtbo.img (optional) of the ROM version your phone is currently running. I actually keep a full system image on my phone in case something goes awry.
I'm going to update the OP to more clearly state that you only need the stock boot.img file--how you obtain it is up to you. Uninstalling Magisk will do the same exact thing, however I tried to do that a couple of months ago and it created more issues for me than if I had just flashed the stock boot.img in the first place.
Click to expand...
Click to collapse
I have not tried the uninstall Magisk method but plan to do so at next update. What kind of issues did it create for you?
Thanks.
Brenneke said:
I have not tried the uninstall Magisk method but plan to do so at next update. What kind of issues did it create for you?
Thanks.
Click to expand...
Click to collapse
For some reason, I don't think it restored the correct (or not corrupted) boot.img version. Then, there were remnants of the Magisk APK and other files so I ended up having to do a full TiBu of my apps and flashed (with wipe) a full System image. It may have been something I did or just my bad luck, but I prefer not to chance it and instead manually flash the Stock image as my "guide" here states.

[Deprecated] Universal DM-Verity, ForceEncrypt, Disk Quota Disabler [11/2/2020]

Hi all!
For the past couple of months, I've been looking into making a more universal solution to disable dm-verity and forceencrypt. Needing to take different zips, modify them for different devices, and then cross your fingers when you switch between custom and stock roms simply wasn't good enough for me. After lots of searching around, failed attempts, and some guidance by @Xennet, @osm0sis, and @nathanchance (thank you all for your help), I finally got a working solution. Ironically, it was under my nose the whole time.
@topjohnwu figured much of this out a while ago with his magiskboot binary - just modify the fstabs. Magiskboot only works for fstabs in the ramdisk though and dm-verity and forceencrypt are only disabled under certain conditions (when you create a .magisk file with the variables set to false and place it in the proper location). So I made an installker with AK3 by @osm0sis and used a combination of sed patches by @jcadduono in addition to others I found for fstabs not in the ramdisk, modified magiskboot with some extra entries I found need to be removed on some devices, and added some stuff of my own like the creation of .magisk and .supersu files in the right location with the proper contents.
The end result: a zip that will remove dm-verity and/or forceencrypt from all fstabs on your device
It can also remove disk quota if you choose. This may be needed if you have an older twrp and/or want to downgrade to Nougat. More info here: https://source.android.com/devices/storage/faster-stats
Instructions:
The zipname tells the installer what to do. Here are the current options:
Add 'enfec' or en'forceencrypt' to zipname to keep forceencrypt enabled if present
Add 'fec' or 'forceencrypt' to zipname to disable forceencrypt (zipname already has this so remove these if you want to keep it enabled)
Add 'quota' to zipname to disable disc quota
Note that verity is always disabled - it has to be for any modifications with this mod
If you're currently encrypted:
BACKUP YOUR INTERNAL STORAGE TO YOUR PC
Format data (this is NOT the same as Wipe data) (In TWRP: Wipe -> Format Data)
Reboot back into recovery
Follow the directions below for when you're not encrypted
If you're not encrypted: flash all of your stuff, then FLASH THIS ZIP LAST
Some extra details for Slot devices:
Flash ROM
Flash TWRP Installer Zip
Reboot into TWRP
Flash everything else
Flash this zip
Only difference here is the twrp zip and the recovery reboot, main principle is the same - FLASH THIS ZIP LAST
Troubleshooting:
Take a recovery log after flashing this zip (thanks to @aIecxs for the imgs):
{
"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"
}
If the zip isn't patching any fstabs that it should be, then it's possible that the previous zip(s) didn't unmount system and/or vendor properly. Either unmount them in twrp, or just reboot back into recovery and flash this zip again
Compatibility: Any android device
Source: https://github.com/Zackptg5/Disable_Dm-Verity_ForceEncrypt
Download
Zackptg5 said:
Hi all!
For the past couple of months, I've been looking into making a more universal solution to disable dm-verity and forceencrypt. Needing to take different zips, modify them for different devices, and then cross your fingers when you switch between custom and stock roms simply wasn't good enough for me. After lots of searching around, failed attempts, and some guidance by @Xennet, @osm0sis, and @nathanchance (thank you all for your help), I finally got a working solution. Ironically, it was under my nose the whole time.
@topjohnwu figured much of this out a while ago with his magisk installer. However, dm-verity and forceencrypt (fec) are only disabled under certain conditions (when you create a .magisk file with the variables set to false and place it in the proper location). This would be fine for magisk users, but not for everyone else. So I took Magisk 16.6 beta zip, modified it to add fstab patches by @jcadduono, added some stuff of my own, and then gutted all of the magisk stuff unrelated to this.
The end result: a zip that will remove dm-verity and fec from your boot img and fstab files (without installing magisk, I took all of that out).
Instructions:
If you're currently encrypted: BACKUP YOUR INTERNAL STORAGE TO YOUR PC. Then format data. Reboot back into recovery
After doing that or if you're not encrypted: Flash your rom, custom kernel and/or root (like magisk or supersu), then this zip.
This zip should probably be flashed after anything that modifies your boot img (magisk, supersu, other root solutions, custom kernel, etc.).
Compatibility: Any device magisk is compatible with
Source:https://github.com/Zackptg5/Disable_Dm-Verity_FEC
Click to expand...
Click to collapse
Hi!
Just to be sure, does this remove the need to flash patched boot.img files when updating stock ROMs with root?
Thanks!
Sent from my OnePlus 3T using XDA Labs
@Zackptg5 Thanks for the zip! I trust this will work for both -- Treble and non-Treble ROMs, yes?
rippledrums said:
Hi!
Just to be sure, does this remove the need to flash patched boot.img files when updating stock ROMs with root?
Thanks!
Click to expand...
Click to collapse
Not sure what you mean. This does patch the boot img to remove verity/fec though if that's what you're getting at
shadowstep said:
@Zackptg5 Thanks for the zip! I trust this will work for both -- Treble and non-Treble ROMs, yes?
Click to expand...
Click to collapse
Yup
Zackptg5 said:
Not sure what you mean. This does patch the boot img to remove verity/fec though if that's what you're getting at
Click to expand...
Click to collapse
I found this because I saw your post in @Xennet's thread for OP3/3T Oxygen OS patched boot.img files.
Currently every time I update OOS I flash a boot.img patched by him and also a zip by him as well. What I'm asking is if your zip would be enough?
Sent from my OnePlus 3T using XDA Labs
rippledrums said:
I found this because I saw your post in @Xennet's thread for OP3/3T Oxygen OS patched boot.img files.
Currently every time I update OOS I flash a boot.img patched by him and also a zip by him as well. What I'm asking is if your zip would be enough?
Click to expand...
Click to collapse
Oh, gotcha. Ya, this zip handles that so you don't need to flash the boot img anymore
Zackptg5 said:
Oh, gotcha. Ya, this zip handles that so you don't need to flash the boot img anymore
Click to expand...
Click to collapse
Awesome, thanks! :laugh:
Sent from my OnePlus 3T using XDA Labs
@Zackptg5 First of all, great job. This looks very impressive and I appreciate the work you've done. I know this will be very useful for people trying things like the P GSI image then going back to no treble ROMs back on Oreo. I was just wondering though, as I have no intention on trying any treble ROMs, is there any benefit to using this over the old no verity V2 zip for someone that will only use non-treble Oreo ROMs. Thank you
DEVILOPS 007 said:
@Zackptg5 First of all, great job. This looks very impressive and I appreciate the work you've done. I know this will be very useful for people trying things like the P GSI image then going back to no treble ROMs back on Oreo. I was just wondering though, as I have no intention on trying any treble ROMs, is there any benefit to using this over the old no verity V2 zip for someone that will only use non-treble Oreo ROMs. Thank you
Click to expand...
Click to collapse
It really depends on the rom. If you're on a custom rom the old zip is probably fine (but not always, lots of variation there). If you're on a stock or stock based rom however, this is needed (unless you flash a patched boot.img - but why flash 2 things when you can flash 1?). This zip works with treble and nontreble roms by the way and the old zip can be easily modified the same way (I have one floating around xda somewhere).
Assuming you're on a custom rom which already has dm-verity disabled, the benefit to this zip is that not only does it disable force encryption in the vendor fstabs (like the old zip), but it also disables it in the boot img which some roms have
Zackptg5 said:
It really depends on the rom. If you're on a custom rom the old zip is probably fine (but not always, lots of variation there). If you're on a stock or stock based rom however, this is needed (unless you flash a patched boot.img - but why flash 2 things when you can flash 1?). This zip works with treble and nontreble roms by the way and the old zip can be easily modified the same way (I have one floating around xda somewhere).
Assuming you're on a custom rom which already has dm-verity disabled, the benefit to this zip is that not only does it disable force encryption in the vendor fstabs (like the old zip), but it also disables it in the boot img which some roms have
Click to expand...
Click to collapse
So basically it is a more well-done version if you want to put it that way. Works on stock and custom ROMs including treble no matter what it is or if there is dm-verity enabled or not is what I'm understanding from this. I'm using treskmod currently which is basically OmniRom. I'll give it a go when I get back off holiday so I can clean flash. Thanks again?
DEVILOPS 007 said:
So basically it is a more well-done version if you want to put it that way. Works on stock and custom ROMs including treble no matter what it is or if there is dm-verity enabled or not is what I'm understanding from this. I'm using treskmod currently which is basically OmniRom. I'll give it a go when I get back off holiday so I can clean flash. Thanks again?
Click to expand...
Click to collapse
I wouldn't call it more well done but rather more complete
And yup, should work on any rom/device magiskboot is able to work with (which is most of them). Dm-verity will be removed too by this mod by the way
@Zackptg5 hi. Tell me please how need me right do. I am on LOS 15.1 on my Samsung Tab A SM-T585.now. And with dm-verity and fec are all right. But when i go on custom rom based on stock 8.0(port) i got dm-verity and fec issue. After installation this rom and start i can see all files of internal memory in file explorer. But only i reboot to recovery internal memory have size 0mb. So my question: i need do fomat data before installtion rom and your zip or only install zip?
Zackptg5 said:
I wouldn't call it more well done but rather more complete
And yup, should work on any rom/device magiskboot is able to work with (which is most of them). Dm-verity will be removed too by this mod by the way
Click to expand...
Click to collapse
@DEVILOPS 007 I just flashed latest 20180719 tresk and tried this zip and got sent back to TWRP. Immedietly flashed v2 and it booted. It worked on AOSiP earlier though so not sure what could cause it to fail here.
Sent from my OnePlus5T using XDA Labs
repey6 said:
@Zackptg5 hi. Tell me please how need me right do. I am on LOS 15.1 on my Samsung Tab A SM-T585.now. And with dm-verity and fec are all right. But when i go on custom rom based on stock 8.0(port) i got dm-verity and fec issue. After installation this rom and start i can see all files of internal memory in file explorer. But only i reboot to recovery internal memory have size 0mb. So my question: i need do fomat data before installtion rom and your zip or only install zip?
Click to expand...
Click to collapse
You'll need to format data. Then flash rom and kernel, then this after
bdwilk said:
@DEVILOPS 007 I just flashed latest 20180719 tresk and tried this zip and got sent back to TWRP. Immedietly flashed v2 and it booted. It worked on AOSiP earlier though so not sure what could cause it to fail here.
Click to expand...
Click to collapse
Can you send a recovery log? What all did you flash when that happened and in what order? Thanks
Zackptg5 said:
You'll need to format data. Then flash rom and kernel, then this after
Can you send a recovery log? What all did you flash when that happened and in what order? Thanks
Click to expand...
Click to collapse
Format data everytime or just once for this to work or format because of treble or what? I'm curious as to when formatting is required and why exactly.
Zackptg5 said:
You'll need to format data. Then flash rom and kernel, then this after
Can you send a recovery log? What all did you flash when that happened and in what order? Thanks
Click to expand...
Click to collapse
I'll do it again and get a log for you another time.
ROM, magisk 16.6, vanced installer (YouTube), universal dm-verity (ROM has built-in gapps)
Got sent back to TWRP and hit reboot to system one more time for science, and got sent back to TWRP again.
Flashed dm-verity v2 and it booted fine.
OnePlus 5t
DEVILOPS 007 said:
Format data everytime or just once for this to work or format because of treble or what? I'm curious as to when formatting is required and why exactly.
Click to expand...
Click to collapse
I believe he's just telling dude how to decrypt for the first time.
Sent from my OnePlus5T using XDA Labs
bdwilk said:
I'll do it again and get a log for you another time.
ROM, magisk 16.6, vanced installer (YouTube), universal dm-verity (ROM has built-in gapps)
Got sent back to TWRP and hit reboot to system one more time for science, and got sent back to TWRP again.
Flashed dm-verity v2 and it booted fine.
OnePlus 5t
I believe he's just telling dude how to decrypt for the first time.
Click to expand...
Click to collapse
Oh I thought he was responding to you. My bad lol
DEVILOPS 007 said:
Oh I thought he was responding to you. My bad lol
Click to expand...
Click to collapse
Ya, you just need to format data to decrypt
Zackptg5 said:
You'll need to format data. Then flash rom and kernel, then this after
Click to expand...
Click to collapse
This is a copypaste from Samsuyng Tab A thread:
repey6 said:
Hi. You can to try Universal DM-Verity and ForceEncrypt Disabler by Zackptg5 from this thred https://forum.xda-developers.com/android/software/universal-dm-verity-forceencrypt-t3817389
Click to expand...
Click to collapse
blaz3gamingHD said:
Does this work?
---------- Post added at 09:52 PM ---------- Previous post was at 09:20 PM ----------
I've tested it and it doesn't work, still encrypted.
Click to expand...
Click to collapse
repey6 said:
This is a copypaste from Samsuyng Tab A thread:
Click to expand...
Click to collapse
Of course he's still encrypted this zip isn't going to decrypt your phone. It's for once your decrypted and flashing a rom it will not allow the rom zip to encrypt your device and will allow it to boot decrypted and without the insecure verity check blocking boot.
Sent from my ONEPLUS A5010 using Tapatalk

Is vbmeta.img device specific or generic?

Hi, I want to install TWRP on my phone, but it requires flashing vbmeta. I can find all kinds of links on xda, as well as one from Google's official GSI image.
I'm a little paranoid about the security issue on flashing random vbmeta on the machine, so my question is: is the vbmeta from google generic and can be flash to any arm device, or I have to use the one from 9t forum? Thanks!
ccaappton said:
Hi, I want to install TWRP on my phone, but it requires flashing vbmeta. I can find all kinds of links on xda, as well as one from Google's official GSI image.
I'm a little paranoid about the security issue on flashing random vbmeta on the machine, so my question is: is the vbmeta from google generic and can be flash to any arm device, or I have to use the one from 9t forum? Thanks!
Click to expand...
Click to collapse
Install the official TWRP, no wiping, flashing VBMeta or anything needed (QFJEUXM 11.0.4):
https://twrp.me/davinci/twrp-3.3.1-0-davinci.img
Every time you boot to TWRP, enter the same pin you are using when you boot to Android or you use there for unlocking the screen

How to flash GSIs on the Red Magic 5G/How to build super.img from other imgs

I made a better way to flash GSIs
https://forum.xda-developers.com/nubia-red-magic-5g/development/swapper-generate-flashable-zips-img-t4133591
Go here and use that.
Nubia's bootloader and fastbootd is **** and both can't flash images to the logical partitions like the system partition and vendor partition.
So we need to build an image for the super partition to be flashed.
If you just wanted to flash a custom rom skip part 1 and download the super.img from the link (los or havoc, havoc recommended as los's brightness control is half broken)
Requirements: An unlocked RM5G booted into the bootloader (not fastbootd, if you don't know what that is, you probably are in bootloader), An A/B GSI image (yes we need a A/B image not an A-only image, from android 9 released devices all phones are systeam as root), A linux environment (I did it in WSL), the download file
BACKUP YOU'RE SUPER PARTITION BEFORE FLASHING AND SAVE IT SOMEWHERE SAFE BEFORE FLASHING
(Seriously, tho I figured this out while trying to unbrick my phone after ****ing up my super partition. Trust me, it will be a life saver. Doing this will also break flashing stock ota rom via recovery until you flash your backup)
Part 1: Building the super image
Download tools.7z and extract it
Place the GSI image in the same folder and rename it to system.img
Execute the lpmake.sh script in a linux environment (It will say invalid headers at magic, it's not an error so just ignore it)
When it is complete there will be a super.img file in the folder (takes about 1 min)
Part 2: Flashing the super image
Before we flash the super.img we have to disable verity.
flash vbmeta and vbmeta_system with
fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
fastboot --disable-verity --disable-verification flash vbmeta_system vbmeta_system.img
(You don't have to flash these every time. Just once)
Now we can flash the super.img with
fastboot flash super super.img
You also have to wipe dalvik, cache, data
If you have twrp do it in twrp.
If you don't, you shouldn't be doing this, I told you to backup your super partition.
That's it.
Tested GSIs:
LOS 17.X : Boots, Wifi/Data/BT works, Brightness control is half broken (always at full brightness)
Android 11 DP3 : Doesn't boot
Havoc 3.4 : Boots, 3.5 doesn't work
Phh-Quack : Doesn't boot
Descendant X : Boots, same as LOS
Oh, and for people wondering about the fingerprint sensor. It doesn't work. The phone doesn't even know it has it under the display(Maybe a problem with all under display fingerprint sensor phones).
After more testing, found out slot count can be 1 instead of 2.
Link to files
https://drive.google.com/open?id=1DuQp2_uebwRr9mD5MQxibQGdPBQyPkHN
Wow amazing, so we can use any other gsi except the one forced by these guys
Sent from my NX659J using Tapatalk
---------- Post added at 09:55 AM ---------- Previous post was at 09:53 AM ----------
apersomany said:
https://drive.google.com/open?id=1DuQp2_uebwRr9mD5MQxibQGdPBQyPkHN
Click to expand...
Click to collapse
Also does everything work like the air triggers and the fan ect
Sent from my NX659J using Tapatalk
keep it up. the fingerprint sensor is a goodix sensor it was the problem on other devices too. we will need to ask nubia for the goodix sources to fix it.
is the fan, gaming triggers and 144hz working? also what about the slider any functionality?
gokhujee said:
Wow amazing, so we can use any other gsi except the one forced by these guys
Sent from my NX659J using Tapatalk
---------- Post added at 09:55 AM ---------- Previous post was at 09:53 AM ----------
Also does everything work like the air triggers and the fan ect
Sent from my NX659J using Tapatalk
Click to expand...
Click to collapse
Sadly air triggers, fans, 144hz, slider doesn't work (Maybe it'll work if we port the app to the rom)
For the fingerprint sensor I'm gonna try some things.
apersomany said:
Nubia's bootloader and fastbootd is **** and both can't flash images to the logical partitions like the system partition and vendor partition.
So we need to build an image for the super partition to be flashed.
If you just wanted to flash a custom rom skip part 1 and download the super.img from the link (los or havoc, havoc recommended as los's brightness control is half broken)
Requirements: An unlocked RM5G booted into the bootloader (not fastbootd, if you don't know what that is, you probably are in bootloader), An A/B GSI image (yes we need a A/B image not an A-only image, though the treble info app says that our device is A-only, it's not), A linux environment (I did it in WSL), the download file
BACKUP YOU'RE SUPER PARTITION BEFORE FLASHING AND SAVE IT SOMEWHERE SAFE BEFORE FLASHING
(Seriously, tho I figured this out while trying to unbrick my phone after ****ing up my super partition. Trust me, it will be a life saver. Doing this will also break flashing stock ota rom via recovery until you flash your backup)
Part 1: Building the super image
Download tools.7z and extract it
Place the GSI image in the same folder and rename it to system.img
Execute the lpmake.sh script in a linux environment (It will say invalid headers at magic, it's not an error so just ignore it)
When it is complete there will be a super.img file in the folder (takes about 1 min)
Part 2: Flashing the super image
Before we flash the super.img we have to disable verity.
flash vbmeta and vbmeta_system with
fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
fastboot --disable-verity --disable-verification flash vbmeta_system vbmeta_system.img
(You don't have to flash these every time. Just once)
Now we can flash the super.img with
fastboot flash super super.img
You also have to wipe dalvik, cache, data
If you have twrp do it in twrp.
If you don't, you shouldn't be doing this, I told you to backup your super partition.
That's it.
Tested GSIs:
LOS 17.X : Boots, Wifi/Data/BT all works, Brightness control is half broken (always at full brightness)
Android 11 DP3 : Doesn't boot
Havoc 3.4 : Boots, So far everything works, Probably will stay on this
Oh, and for people wondering about the fingerprint sensor. It doesn't work. The phone doesn't even know it has it under the display(Maybe a problem with all under display fingerprint sensor phones).
Click to expand...
Click to collapse
So you got your phone working again! Nice Is volte calls working on havoc?
And it looks like you uploaded the converted gsi images? Thanks
NO WIFI for me on havoc
VZTech said:
So you got your phone working again! Nice Is volte calls working on havoc?
And it looks like you uploaded the converted gsi images? Thanks
NO WIFI for me on havoc
Click to expand...
Click to collapse
That's probably because you're boot.img is not from the same version as mine (2.46) try flashing the one I uploaded to google drive
apersomany said:
That's probably because you're boot.img is not from the same version as mine (2.46) try flashing the one I uploaded to google drive
Click to expand...
Click to collapse
Your not having issues? Mine is laggy, calls not working
VZTech said:
Your not having issues? Mine is laggy, calls not working
Click to expand...
Click to collapse
The lag goes away if you turn the screen on and off.
apersomany said:
The lag goes away if you turn the screen on and off.
Click to expand...
Click to collapse
Ouch, this isn't good
Thanks for the super img tools/instructions - this will actually come in handy on another device I'm working on.
MishaalRahman said:
Thanks for the super img tools/instructions - this will actually come in handy on another device I'm working on.
Click to expand...
Click to collapse
The script has a fixed partition size specified for the rm5g so you might wan't to change the partition size.
there seems to be a workaround to keep Fingerprint functionality while rooting and even with twrp installed. it seems it's even possible to lock the bootloader at the same time. will wait for xda guides to explain as i don't understand it yet. i saw video evidence and it's pretty easy. the guy even forgot oem unlock in dev options and it still worked for him.
only cn rom supported it seems. and it's a similar guide to the redmagic 3.
apersomany said:
The script has a fixed partition size specified for the rm5g so you might wan't to change the partition size.
Click to expand...
Click to collapse
Wondering if we could add the ims.apk to the image??? Its needed for volte. If its done on the os, the phone doesnt boot.
VZTech said:
Wondering if we could add the ims.apk to the image??? Its needed for volte. If its done on the os, the phone doesnt boot.
Click to expand...
Click to collapse
It's possible, but I would rather make a magisk module for it, it takes way less time.
apersomany said:
It's possible, but I would rather make a magisk module for it, it takes way less time.
Click to expand...
Click to collapse
I tried adding it. Didnt boot. Just a black screen. exactly which havoc did you use?
VZTech said:
I tried adding it. Didnt boot. Just a black screen. exactly which havoc did you use?
Click to expand...
Click to collapse
I used https://forum.xda-developers.com/pr...e-development/havoc-os-3-3-gsi-archs-t4076903 this one, specifically the Gapps Included ARM64 A/B version.
apersomany said:
I used https://forum.xda-developers.com/pr...e-development/havoc-os-3-3-gsi-archs-t4076903 this one, specifically the Gapps Included ARM64 A/B version.
Click to expand...
Click to collapse
Thanks. I used that ones too. I extracted the system image, added the file, repacked, then used the tool to convert to super, but it wouldnt boot.
VZTech said:
Wondering if we could add the ims.apk to the image??? Its needed for volte. If its done on the os, the phone doesnt boot.
Click to expand...
Click to collapse
VZTech said:
Thanks. I used that ones too. I extracted the system image, added the file, repacked, then used the tool to convert to super, but it wouldnt boot.
Click to expand...
Click to collapse
Hmm... That's weird.
Have you increased the size of the partition that you've added the file to in the script? (If it was added to the system img probably won't matter as I've set the value to something like 3gigs if I remember correctly)
So doing it without adding the file works, but if you add it it won't boot right?
nadejo said:
there seems to be a workaround to keep Fingerprint functionality while rooting and even with twrp installed. it seems it's even possible to lock the bootloader at the same time. will wait for xda guides to explain as i don't understand it yet. i saw video evidence and it's pretty easy. the guy even forgot oem unlock in dev options and it still worked for him.
only cn rom supported it seems. and it's a similar guide to the redmagic 3.
Click to expand...
Click to collapse
Yes in our forum in Telegram: ZTE Nubia Redmagic 5G Channel people are using the Chinese ROM and bypassing the bootloader unlock. I have not yet tried. We are perfecting the process ATM. We even got a guy to restore a TWRP backup of Global ROM. It isn't an easy process. You have to be very, very careful. There are a lot of wipes that go on in between. Will post once we have a 100% working solution. Under the Bootloader Unlock tutorial in XDA for this device.

Resources