yashsingh1/xdaforums huggingface dataset:
[Android Q&A, Help & Troubleshooting] alecxs:
recovery.fstab is attached inside zip file. Open with Wordpad or Notepad++
[Android Q&A, Help & Troubleshooting] Zdendav:
Ah, OK going to compare .
[Android Q&A, Help & Troubleshooting] Zdendav:
This is what is left after deleting matches:

ls -l /dev/block/platform/*/by-name

flashinfo ->/dev/block/mmcblk0p24

keystore -> /dev/block/mmcblk0p19

oemkeystore -> /dev/block/mmcblk0p17

teeinfo -> /dev/block/mmcblk0p20

recovery.fstab

/system_image	emmc /dev/block/mmcblk0p21

/flashinfo	emmc

/external_sd	auto	/dev/block/mmcblk1p1	/dev/block/mmcblk1	flags=display="MicroSD";storage;wipeingui;removable;backup=0

/usbotg	auto /sys/devices/platform/mt_usb*	flags=display="USB-OTG";storage;removable;backup=0

Is it safe to proceed?
[Android Q&A, Help & Troubleshooting] alecxs:
Yes. just make sure i don't made mistake with the replacements (mmcblk0p16 = metadata) and so on... you can now proceed
[Android Q&A, Help & Troubleshooting] Zdendav:
Successfully flashed, after booting the new twrp I'm asked for a decryption password (which don't know), I skipped it.

I can mount cache, system, the SD card but data isn't there in the mount options. Did an advanced wipe, wiping data and cache and now I'm able to mount them.

What do you mean by: "restore renamed stock boot.emmc.win from TWRP advanced backup restore"? I did find only restore in the twrp menu, no advanced restore and where do I get the boot.emmc.win file?
[Android Q&A, Help & Troubleshooting] alecxs:
use the stock boot.img, rename it to boot.emmc.win, create some folder /external_sd/TWRP/BACKUPS/<serialno>/<folder> and copy file, then restore backup (see Post #3). This step is just to restore stock boot.img, before you patch it.

Then install Disable_Dm-Verity_ForceEncrypt.zip from TWRP. After the boot.img is patched, the system will boot regardless the modified recovery partition. If the phone boots and IMEI is fine, create a TWRP backup before you root. You can root with SuperSU or Magisk
[Android Q&A, Help & Troubleshooting] Zdendav:
Done but there is still something wrong.

I'm not able to boot the system, it boots to twrp, holding any of the volume keys during power on does nothing boots to twrp too.

Selecting bootloader in the twrp reboot menu brings me to fastboot, the rest (system, recovery) again back to twrp :(
[Android Q&A, Help & Troubleshooting] alecxs:
something seems wrong with boot.img? please upload, and from your friends device too, i will have a look tomorrow

*************************************************
* DmVerity,ForceEncrypt, and DiscQuota Disabler *
* By: Zackptg5 *
* Heavily based on the work of: *
* TopJohnWu and Jcadduono *
*************************************************
- Mounting /system, /vendor
- Target image: /dev/block/mmcblk0p7
Invalid image: not signed
[Android Q&A, Help & Troubleshooting] Zdendav:
That's strange, I compared them and they are identical.

Meaning the boot.img backed up from my phone (with the downloaded scatter) and the boot.img backed up from the relatives phone ...

Tomorrow then.

Thank you very much.
[Android Q&A, Help & Troubleshooting] alecxs:
In your stock recovery it clearly is named /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name but in TWRP it has changed to /dev/block/platform/mtk-msdc.0/by-name after flashing Magisk or Disable_Dm-Verity_ForceEncrypt.zip in combination with a faulty fstab. Unfortunately i have less knowledge and i don't know what is the origin of this symlinks, i thought it must part of the kernel but kernel is stored inside boot.img, this makes no sense to me. Of course we can try to change the fstab inside boot.img and see if it is booting, but that's not a solution we still don't know what has changed. please try to boot into stock recovery with "fastboot boot recovery.img" and select "Root integrity check", then boot into twrp and create a backup of cache partition and upload cache.ext4.win (it contains all logs)

edit: the following partitions are safe to flash from SP Flash Tool (the scatter files ROM / WwR_MTK are equal for this area), so if you have a backup feel free to restore (from your own phone only)

pgpt

proinfo

nvram

protect1

protect2

seccfg

lk

boot

recovery

para

logo

expdb

frp

the following partitions you can copy from your friends phone only with WwR_MTK scatter

system

cache

for other partitions better not flash anything, except you have a full ROM dump of your own phone in working condition.

but first thing is ask [MENTION=9139800]Matty1993[/MENTION] for patching boot.img (against dm-verity) and try to boot with "fastboot boot boot.img"
[Android Q&A, Help & Troubleshooting] Zdendav:
Strange things happen ...

I did "fastboot boot recovery.img", the phone rebooted, showed the orange message, then a big circle in upper half of the screen with something written under it, unfortunately I didn't catch it, it was too fast, then suddenly rebooted again, the Aligator bootlogo showed and after a couple of minutes it booted to the system!

Now it is on the welcome screen and I'm afraid to do anything, that I don't break it again :)

What should I do next?

A full backup?

Check something?
[Android Q&A, Help & Troubleshooting] alecxs:
sounds like the stock recovery has fixed something, since cache is available it was able to boot. Now go to developer options, enable oem unlock and usb-debugging, connect once with adb shell (permanent accept), then boot into twrp and make a full backup
[Android Q&A, Help & Troubleshooting] Matty1993:
Why are you mounting partitions as /dev/block/platform/mtk-msdc.0/ ?

They need to be set as they are set in the fstabs under

/dev/block/platform/mtk-msdc/****/msdc/by-name/****

Mounting errors will occur otherwise,

In regards to data for the decryption feature to work /metadata must be mounted within the TWRP recovery fstab as a flag attached to /data ill upload my TWRP fstab, i can confirm that my TWRP works without issue as i actually compiled it for an MT6737M processor using the same encryption process,

But i slimmed mine down to 10mb as your stock recovery was that size so i assumed that was the maximum size it would allow to not cause flash fail due to potential partition overlap so i removed busybox and the mk ext2 fs libs,

So what ill do is add them back and upload a new one, when you were using other twrp also and it prompted for you to add the decryption password this means your storage is still encrypted and is not being wiped, what you should have done straight after is tap wipe tap format data type yes wait for the you may need to reboot twrp to use data again. Once you receive this message this means your data is now unencrypted

Attach me your boot.img also ill patch the dm-verity out of it manually and you shouldnt have the problen again once patched if you want to use TWRP again whenever you as dm-verity is still present in your boot.img it may be re-encrypting on reboot and flagging it as tampered and once you flashed stock recovery.img it matched the verity keys and allowed factory reset thats what the circle logo would have been it would have stated wiping.

Sorry i havent replied in a while been finishing up my Cyanogenmod 11 project for ubifs chinaphone

Before messing with it again though a good reliable tool to use is miracle box to take both .dat backup and .file backup which also has the option to generate a genuine 100% working scatter file with true partitions and sizes
[Android Q&A, Help & Troubleshooting] alecxs:
please see the output of post #26 (that is from twrp with your fstab except the change of metadata post #17)

ls -d /dev/block/platform/*/*
/dev/block/platform/mtk-msdc.0/by-name

I know that, but unfortunately no partitions will be mounted (see recovery.log post #20)

in stock recovery it is clearly mtk-msdc.0/11120000.msdc0 so i agree. I guess magisk has changed something (but i don't know how) but 11120000.msdc0 doesn't exist anymore. thats why we decided to use /dev/block/mmcblk0p? in fstab. now twrp is able to mount and Disable_Dm-Verity_ForceEncrypt.zip was able to patch boot.img. now after cache is restored, phone seems to boot.

Meanwhile we figured out that recovery size is 16 MiB, so feel free to use the twrp from post #29. Some small fixes still have to be done see post #33 many thanks for your help!
[Android Q&A, Help & Troubleshooting] Zdendav:
Guys, thank you so much for all your help :)

I would be lost without your help.

I should clarify the recovery.img size, the 10MB one was repacked with carliv image kitchen.

I downloaded some generic TWRP recovery.img for MT6580 and I was comparing it with my extracted recovery.img trying to figure out, if I can use it and probably uploaded the repacked version of my recovery.img (10MB) instead of my originally extracted one (16MB) and I didn't notice ... sorry.

I did a full backup (all partitions) in TWRP, now I'm running a full backup in SP Flash Tool.

I have a couple of questions:

1) I did a backup of my userdata in factory mode, I have files userdata_20190429_130536.backup and userdata_20190429_130536.backup1 - is it safe to restore them?

2) TWRP offers me installing as an app with a tick choice of system app, should I install it? as system or not system?

3) Can I now install magisk safely, to root my phone?

4) or is there a better way to root my phone?
[Android Q&A, Help & Troubleshooting] alecxs:
1) yes it is safe to restore from stock recovery, but you will lose systemless root and have to root again. restoring may fail due the (meanwhile) changed metadata. You should consider this only if you care about the containing data, pictures, etc. If restore fails, you can try to restore encrypted backup from twrp with bckp2raw, then flash old metadata from SP Flash Tool. If backup is not encrypted, you can convert it to twrp backup with bckp2win, then restore with twrp

2) you must not install TWRP app, it is useless for unsupported devices

3) just install the magisk app and patch your current boot.emmc.win from magisk app options, then flash patched_boot.img

4) if you don't care about Magisk Hide Root or Xposed Framework Modules, you can flash SuperSU.zip it will install systemless, too. Do not update to 2.82 use 2.79 pro version (see post #37)

Please upload your current boot.emmc.win and recovery.log for Matty1993, so he can have a look into it and fix twrp anyway!

IMEIs and Barcode are fine?
[Android Q&A, Help & Troubleshooting] Zdendav:
IMEIs are swapped, what was IMEI1 is now IMEI2 and vice versa and the Bar code slightly changed:

from

Bar code : 010901MT000000000000003891_155648

to

Bar code : 010901MT000000000000003894_155648

Revovery log is attached and the boot.emmc.win from the latest TWRP backup is uploaded here: https://webshare.cz/file/2sz7Nv4401/boot-emmc-win

I thought magisk is better, I have Magisk-v18.1.zip and SR5-SuperSU-v2.82-SR5-20171001224502.zip ready to install, have to choose which one to install :)

Nothing that important is in the backup, I'll look into it and if it's too complicated to restore, I'll setup the phone from the beginning again.

Edit: Downloaded SR3-SuperSU-v2.79-SR3-20170114223742.zip as recommended
[Android Q&A, Help & Troubleshooting] Zdendav:
It seems I'm out of luck with the backup: "WARNING: No ext4 magic number detected", probably encrypted, but it's no big deal ...
[Android Q&A, Help & Troubleshooting] alecxs:
your boot.emmc.win is already patched. strange it has /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name inside fstab. can you post the output from twrp again?

adb shell
mount /system -r
/system/bin/sh
ls -d /dev/block/platform/*/*
ls -l /dev/block/platform/mtk-msdc.0/by-name
ls -l /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name

for encrypted userdata_*.backup try out bckp2raw.zip from twrp together with METADATA partition from SP Flash Tool
[Android Q&A, Help & Troubleshooting] Zdendav:
I would like to try but can you please be more specific (regarding the metadata partiton)?

Thank you.
[Android Q&A, Help & Troubleshooting] alecxs:
for decrypting USERDATA partition always a crypto key is required. It is stored at the end of USERDATA partition, or at EFS, or METADATA partition. Each time you wipe data the crypto key is wiped too.

If you have a backup of /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/metadata (/dev/block/mmcblk0p16) from the time of creating backup, it should be possible to restore. But i guess you don't have it, because you used the wrong scatter file, so nevermind...
[Android Q&A, Help & Troubleshooting] Zdendav:
Some progress - I did try to restore the backup, just out of curiosity.

Rebooted to fastboot, booted the stock revovery and started restore.

Restore finished successfully, rebooted the phone, phone booted successfully and it asks for a password (I never did set a password).

So I think it restored the backup as an image of the (data?) partition.

I rebooted to twrp the data partition is not mountable, all other are mountable, I pulled the recovery log and there is:

get_crypt_ftr_info crypto key location: '/dev/block/mmcblk0p16' (metadata partition)

Unfortunately I don't have a proper backup of this partition, so that's it.

There is nothing that important in the backup.

It would save me some time, but no big deal.

I just wanted to try :)

Rhetorical question: "What is the point of an encrypted backup when I don't have the encryption key?"

Say my phone breaks, I have a recent backup on the sd card, I RMA my phone, they send me a new one, or change the board in my old one or something like that and I live in the idea I can restore my backup on the new phone and yes I can but then: "Enter password", which I didn't set and obviously don't know ...

What a bad joke :(
[Android Q&A, Help & Troubleshooting] Zdendav:
By merging and cuting I assembled the metadata file from my original backup.

How do I flash it safely - rename to metadata.emmc.win and flash from TWRP or better use SP Flash Tool?
[Android Q&A, Help & Troubleshooting] Zdendav:
Success, after flashing assembled metadata using TWRP, the phone successfully booted into my restored system.

Now if I reboot into TWRP it asks for a password (which I still don't know) , when I cancel it and go to mount, there is a new option "decrypt data" (but it asks for the password), which is what I want (decrypting).

How do I decrypt the data partition without loosing data.

How do I proceed in rooting my device, which is still the main goal?

I have the idea - decrypt data, then install magisk - but how?
[Android Q&A, Help & Troubleshooting] alecxs:
Oh nice idea, you can safely write with dd. block size and block count will limit the output to partition max size

busybox dd if=/external_sd/metadata.bin of=/dev/block/mmcblk0p16 bs=1024 count=38272

the backup user data option is deprecated, i guess they forgot to implement the encryption. backup is useless. partition is encrypted with default_password, but this is just one part of the key. other parts are metadata and some device unique crypto key - you can just decrypt on the device itself. If they send you another device, you can not restore from stock recovery even if it was decrypted because the checksum prevents it. But thats another topic.

Anyway, if you get managed to restore your encrypted userdata backup (you still have the option to restore full ROM dump with SP Flash Tool), all you have to do is install the Magisk app. You don't need TWRP for rooting, just patched_boot.img.

Once you have root access, you can create a tar archive of /data, then fix TWRP and restore.

If you wanna know more about encryption, here is a interesting link

http://bits-please.blogspot.com/2016/06/extracting-qualcomms-keymaster-keys.html
[Android Q&A, Help & Troubleshooting] Zdendav:
That explains it :)

1) Is there an app, which is able to backup the whole data partition (only the content, without encryption) and after formating restore it back (without root privileges)?

2) Is there a way to extract the whole encryption key?

3 Is there any other way to get rid of the encryption without loosing data?
[Android Q&A, Help & Troubleshooting] Zdendav:
Yes, I did :)

Can I safely install magisk even if the data partition is encrypted?

Thanks for the link about encryption, I hope it'll answer at least a part of my questions.
[Android Q&A, Help & Troubleshooting] Zdendav:
If I understand it correctly magisk does the boot.img patching?

Can I archive /data even, when system is running, no locked files or so?

fix=format?

Sorry for so many questions, but I want to be sure, that I know, what I'm doing.
[Android Q&A, Help & Troubleshooting] alecxs:
Yes, Magisk work with encrypted /data and yes Magisk will patch the boot.img (your current boot.emmc.win) you just have to flash it from fastboot.

the files can be archived while locked, android is fine with it. (imagine you remove battery while android is writing files - it is secured against errors)

you can try bckp2arm it is another script from me. restoring won't work, but before it starts trying to restore, a new backup is created. this backup can restored from script too after the restoring fails, this is a side effect you may profit

---------- Post added at 18:37 ---------- Previous post was at 18:20 ----------

1) there are Apps but i never tried. Helium or Titanium i believe.

2) Nope. only for Qualcomm devices

3) TWRP is able to mount encrypted /data, it worked for me without any password on the very first try. I wonder why it does not work for you...
[Android Q&A, Help & Troubleshooting] Zdendav:
Thank you very much for the patience, you have with me :)
[Android Q&A, Help & Troubleshooting] alecxs:
maybe your data partition is not encrypted with default_password, but your pattern is used instead. You must convert the screenlock pattern to password

https://blog.alxu.ca/unlocking-large-pattern-encryption-in-twrp.html
[Android Q&A, Help & Troubleshooting] Zdendav:
A have no pin, password, pattern etc ...

Simply put - no protection.

To "unlock" my phone, you simply press power - the screen comes on, then simply swipe and that's it :)

Maybe if I set up a lockscreen password, then it'll work ...
[Android Q&A, Help & Troubleshooting] Matty1993:
Some twrp will ask you for a decryption key for the data even if you didnt set one as its encrypted the verity key sets a magic number for decryption sometimes twrp flags it as a user set password,

Ill download the boot.img and patch it out for you today sometime, and hopefully get TWRP working properly aswell

I can see that your partition layout has dramatically changed to dev/block/platform/mtk-msdc.0/by-name

Did you flash anything other than recovery with the scatter file that stated pmt changed for the rom,

As the pmt is the Partition Management Table if so i will need to mirror these in boot and recovery as these will now be your true block devices, all partitions are managed by the PMT on power on then handed over to the vold for verity checking then run by the init.rc process for device decryption on boot.

Sorry for late reply also forgot to save the thread to receive comments notifications lol
[Android Q&A, Help & Troubleshooting] Zdendav:
I'm pretty sure I din't flash anything using SP Flash tool using the "wrong" scatter, there were attempts, but all ended with the "pmt changed" error message.
[Android Q&A, Help & Troubleshooting] Rortiz2:
Try holding volume + button while you connect it.
[Android Q&A, Help & Troubleshooting] alecxs:
/dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name is fine for boot.img and stock recovery

/dev/block/platform/mtk-msdc.0/by-name is only for twrp recovery
[Android Q&A, Help & Troubleshooting] Zdendav:
Some progress:

I was able to successfully patch the boot.img with magisk, then flashed the patched image from TWRP.

Reboot and all is fine, the phone is rooted, mission accomplished :)

Here is a part of a new recovery log, where it tries to decrypt the data partition :

crypt_ftr->fs_size = 8256512

Using scrypt with keymaster for cryptfs KDF

Invalid hex string

Failed to convert passwd from hex, using passwd instead

could not find any keystore module

Failed to init keymaster

Signing failed

kdf failed

failure decrypting master key

Failed to decrypt master key

crypt_ftr->fs_size = 8256512

Using scrypt with keymaster for cryptfs KDF

could not find any keystore module

Failed to init keymaster

Signing failed

kdf failed

failure decrypting master key

Failed to decrypt master key

Failed to decrypt data.

Unable to decrypt with default password.
[Android Q&A, Help & Troubleshooting] alecxs:
To backup your /data partition from adb shell:

- install SELinuxModeChanger and set selinux permissive

- go to Magisk settings and set Mount Namespace Mode to Global one for all

- download GNU tar and copy tar binary to MicroSD Card

- enable Airplane Mode ON

- reboot the phone once (to disable namespace separation)

- to backup (from system mode):

adb shell
su
ls -1 /storage
cp /storage/0815-4711/tar /cache
chmod a+x /cache/tar
/cache/tar --selinux --xattrs --numeric-owner -vcpP /data | gzip | split -a 1 -b 1024m - /storage/0815-4711/data.ext4.tar.gz.
[strike]/cache/tar --selinux --xattrs --numeric-owner -vcpPf /storage/0815-4711/data.ext4.tar /data[/strike]

- now reboot to twrp recovery and format data

- if you want to (re-)encrypt data partition (otherwise just skip the following steps),

boot once the stock boot.img (with forceencrypt in fstab) from fastboot

fastboot boot C:\adb\boot.img

- wait for the phone is booted (and has encrypted), then reboot to twrp

- check if TWRP successful decrypted /data

- do not wipe /data again, just mount it

- to restore (from recovery mode):

adb shell
mount /system -r
/system/bin/sh
cat /external_sd/data.ext4.tar.gz.* | gzip -d | /cache/tar --selinux --xattrs -vxpPC /
[strike]/cache/tar --selinux --xattrs -vxpPf /external_sd/data.ext4.tar -C /[/strike]

- after restored your data don't forget to set back selinux enforceing and re-enable namespace separation

edit: forgot about the fat32 file size limit. i have updated the tar command lines. in twrp you can use tar (without path) because GNU tar is included in /sbin/tar in this special twrp port
[Android Q&A, Help & Troubleshooting] Zdendav:
Done, following your original instructions.

Success.

Perfect :)

Doing a full backup including data in TWRP now ...

The data.tar was 1.9 GB big, so it was close but OK for FAT32.

Thank you so so much for all your help :)

Should I revert the setting in magisk and SELinuxModeChanger?

Can I uninstall SELinuxModeChanger ?
[Android Q&A, Help & Troubleshooting] alecxs:
:good: you're welcome.. SELinuxModeChanger can be uninstalled after you set selinux enforceing, and namespace separation enabled from Magisk
[Android Q&A, Help & Troubleshooting] Zdendav:
Thank you.

One last (I hope) question: Magisk - should I set Namespace to inherit or isolated?

I think it was inherit, but I'm not sure ...
[Android Q&A, Help & Troubleshooting] alecxs:
That is what i have found in Magisk Announcement Thread, i don't use Magisk but i guess you are fine with inherit namespace separation
[Android Q&A, Help & Troubleshooting] Zdendav:
OK.

Thank you.

Inherit it is.
[Google Pixel 2 Questions & Answers] DiesFrae:
I've been experiencing excessive battery drain when idle for no reason. I tried every troubleshoot method but still no luck.

Anyone experiencing that?
[Honor 9  Questions & Answers] marcocastignoli:
I don't own the phone, but I really love that whistle sound!
[Honor 9  Questions & Answers] bontabela73:
Hi,

There is an app in Google Play Store called "Firmware Finder". Unfortunately, since May 2018, the app can be used to update firmware only on devices with Google's security patch of April 2018 or earlier. However, you can download FullOTA firmware files and by using a file manager that can read zip archive files, you can find these files.

Here is how to do it:

1) Install Firmware Finder on your device

2) Download STF-L09 8.0.0 379 (C432) or 385 (earlier, when I was looking for a sound file, only 379 was available). You should choose the FullOTA and from here download the update_data_full_public.zip file.

3. Open your file manager app, (I used Solid Explorer) and browse the downloaded zip file. The file you are looking for should be in (data>hw_init>product>media>audio.