yashsingh1/xdaforums huggingface dataset:
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
Download your stock firmware from http://hwmt.ru/oth/HWFF/info/view.php?find_model=lon (make sure you get the update for your current version, full or ota doesnt matter as we only want recovery.img)

Download Huawei Update Extractor: https://xdaforums.com/showthread.php?t=2433454 (download is at the bottom of first post)

Now extract update.app from update.zip you downloaded earlier.

Extract Huawei Update Extractor.

Open up Huawei Update Extractor.

Click on the '...' button and select your update.app file.

In the list that appears, right-click on Recovery and click on Extract Selected and save recovery.img

Now plug your usb cable in and put your phone in download mode (Power + Vol down. Release power when phone vibrates but keep holding vol down til you get the Download mode screen, it should be pretty instant)

Open up a command prompt and issue the command

'fastboot devices'

You should see your phone being connected.

Next 'cd' to the folder where you put recovery.img and enter the command (You can shift + rightclick in the folder where you saved recovery.img and click on 'Open Command window here' and save a few keyboard taps)

'fastboot flash recovery recovery.img'

Now you will have stock recovery and you should be able to update.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] tampera:
Thanks a lot now I am able to enjoy the latest update after useless 2 weeks of search, really I do appreciate your help
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] CrisperNeO:
I have unlocked my phone and installed TWRP, however as I tried to backup, it can't access /data/media/0, and I can see from file manager that all folders under /data/media/0 are messy.

Does anyone has a clue?

Thanks!
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
/data is encrypted by default.

I'm not sure how you're supposed to flash stuff on the Pro as it has no sd card slot (right?).

You can Wipe -> Format Data in TWRP (This wipes /data! including /data/media/0/), but without SuperSU or a decrypted boot image to flash you won't be able to keep decryption. It will re-encrypt at boot.

Can you ADB push in TWRP?

If you can you could Format Data, reboot recovery (Reboot -> Reboot Recovery in TWRP), adb push supersu 2.79 from https://xdaforums.com/mate-9/how-to/guide-how-to-root-mate-9-decrypt-data-t3569986 then flash it.

Alternatively unpack your boot.img using Android Image Kitchen and manually edit fstab.hi3660 and replace "fileencryptioninline" with "encryptable", then flash that to "boot".

And then flash hw_data and public_data for your model/build (https://xdaforums.com/showpost.php?p=71302827&postcount=627)
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] crubbish:
Flash drive + USB OTG work fine
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] CrisperNeO:
With ADB push you mean also ADB sideload, right?

I tried to sideload SuperSU but it just stops in the middle. I think I would first wait for my OTG cable to arrive. The patching of boot.img seems risky, never tried before.

---------- Post added at 01:48 AM ---------- Previous post was at 01:47 AM ----------

Thanks, just ordered an OTG cable. I'll report back.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] CrisperNeO:
I got my OTG cable, but however the TWRP doesnt recognize it. Do I have to do some special setup to get the USB OTG to work under recovery?
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
Which TWRP do you use?

If I remember correctly OTG doesn't work in 3.0.2-2.

You could test by mounting OTG manually under mount.

In 3.0.3 you have to mount and unmount before it actually mounts. (3.0.3 doesn't work with SuperSU though, neither does 3.1.0 if you're not on B182+)

In 3.1.0 it mounts automatically.

I guess you could...

Flash 3.1.0 (Check that OTG works before formatting)

Format Data

Transfer TWRP 3.0.2, SuperSU, HW_DATA and Public_data to phone.

Flash 3.0.2.

Reboot Recovery.

Flash SuperSU, Public_data, HW_data.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] CrisperNeO:
Firstly thanks a lot for your effort!

Your instructions above apply to Mate 9 Pro as well, don't they?

I just have the Rayglobe_Recovery.img from OP, which is 3.0.3-1 i think. Where can i get 3.1.0?

I'm on build B211 and i do need finger print to work. SuperSU doesn't work with finger print, right? I still don't quite understand the reason about flashing 3.0.2 you described, is it because SuperSU can only be flashed under 3.0.2? (and where to get 3.0.2?).

What are the differences between superuser, superRoot and SuperSU?

About the steps regarding flashing Public_data, HW_data, they are in your link above: https://xdaforums.com/mate-9/how-to/guide-how-to-root-mate-9-decrypt-data-t3569986, right? I need to flash them also from OTG?

Thanks again!

---------- Post added at 11:02 PM ---------- Previous post was at 10:52 PM ----------

Another couple of questions:

1. Does the root go into system partition?

2. Flashing Public_data and HW_data will wipe all data and encrypt data partition again, right?

3. I actually don't have preference about root method, but how to choose between SuperSU, superuser or superRoot?

Thanks!
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
Right-y-o', this is the PRO thread. I thought I was in the regular Mate 9 thread... Yeah. TWRP for you is 3.0.3.

But OTG should still work though, try mounting and unmounting and see if that mounts it.

If not, see if ADB works in TWRP, then you can adb push files to your phone.

1. It does not. PHH Superuser (which both SuperSU and SuperRoot use) install to the kernel, and mounts to /su at boot. SuperSU will modify /system though, it creates the folder /system/etc/init.d

2. Those won't encrypt data again. The reason you have to flash them after formatting data is because the folder /data/hw_init/ is removed, and it contains stuff that's needed for things to work (like Themes and the Settings app). Note that you will have to download the Public and HW_data zips from hwmt.ru, instructions: https://xdaforums.com/showpost.php?p=71302827&postcount=627

3. Go with SuperSU or SuperRoot.

If you don't care about backing up /data in twrp you can use this: https://mega.nz/#!lkV0jbYJ!b1h-5uVksvpt7rw0tRHV7Qxjwk2xkKox0w-iRsCLlbU

If you use that you won't have to Format Data.

Or you can simply use Superuser in the OP. You will probably want to open that zip up and edit config.txt though as it won't remove verity. It should say "eng noverity" when you're dont. That means things you change won't stick after reboot (Like Adaway will need to be enabled after each boot etc.) If you pick this you won't have to format data either.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] CrisperNeO:
Latest report:

- Got OTG to work on 3.0.3-1, have to mount manually.

- However, flashing the superuser.zip or the modified mate_9_pro_root.zip ends up with "Updater process ended with ERROR: 1", couldn't flash...

- In addition, from the post https://xdaforums.com/showpost.php?p=71302827&postcount=627 the "update_full_hw_eu.zip" couldn't be found, only "update_data_full_public.zip" is available.

My phone is M9Pro (LON-AL00) and the build is B213. Could this build be too new?

So, still no root :(

---------- Post added at 02:41 PM ---------- Previous post was at 02:40 PM ----------

Could you let me know your phone model, TWRP version and build number? And what root method did you use?

Thanks a lot!
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
When/if you need it:

Assuming you use LON-AL00C00B213D:

http://update.hicloud.com:8180/TDS/data/files/p3/s15/G1482/g77/v86345/f2/full/filelist.xml

http://update.hicloud.com:8180/TDS/...45/f2/full/public/update_data_full_public.zip

http://update.hicloud.com:8180/TDS/...N-AL00_all_cn/update_full_LON-AL00_all_cn.zip
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] CrisperNeO:
I got the logic now! Downloading!

---------- Post added at 03:48 PM ---------- Previous post was at 03:31 PM ----------

The latest file "SuperSU-v2.79-MATE9-init.d_support_no_decrypt-signed.zip" did go through in the TWRP and get flashed (it is the only one which didn't get error).

However, the phone booted itself twice - seems that boot partition gets restored somehow, and when it comes into the system, there is no root...

I didn't want to format data, but I assume that is maybe the only way to go.

And, when does the data partition get encrypted again? I didn't quite understand what happens with this encryption / verity thing... If the root goes into boot partition, why does the encrypted status of data partition matter, if we flash via adb sideload or OTG?
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
Check if the SuperSU app is installed. 2 reboots after flashing SuperSU is normal.

If there is no SuperSU app, download it from the play store. (it will tell you that a new binary is available, 2.82, don't update as it won't work)

Data won't re-encrypt as it's already encrypted if you don't Format Data.

It's only needed if you use SuperSU or SuperRoot from eddmechas thread.

If you were to skip Format Data and flash one of the zips from eddmechas thread your phone wouldn't boot.

If /data is encrypted and your kernel doesn't try to decrypt it will boot-loop.

The removal of encryption is just so we can backup /data in TWRP.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] CrisperNeO:
The SuperSU app was installed by the procedure, but no su binary found...

You mean, if the data is formatted and we installed the right root, the data partition won't encrypt again? (Actually is seems that the phone won't allow me to install root from eddmechas thread.)

If formatting data is only for backup purpose in TWRP, root per se will have nothing to do with it, right?
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
yep, that's exactly right.

It might just be that it doesn't work with 3.0.3... But mate9_pro_root.zip should still work for you, and you don't need to decrypt (Format Data) for that one either.

(eventhough it has the "nocrypt" flag in config.txt it doesn't actually change fileencryptioninline to encryptable.)

Or, could you backup BOOT in TWRP and PM the backup to me? I want to check if it actually modified the kernel.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] CrisperNeO:
I have the boot.emmc.win file backed up from the B213 ROM. It's 32M big, can i send to you via PM?

Can you explain a little bit more about the "nocrypt" flag, the "eng", "noverity", the "fileencryptioninline" etc, whatdo they mean and how the options work together? Or is there a link?

Why would they encrypt the data partition after all? In the good old days there was no such thing...
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
Yes. Upload to Dropbox or mega and send the link.

The "noverity" option removes the "verity" flag in the fstab of your kernel. What dm-verity does is protect your partitions against male are or corruption. It does this by verifying the partition at boot, if it finds something is off it will tell you or refuse to boot at all. What I've found though is that it seems to restore files too. If you edit, for example, the hosts file (for ad blocking) and you have verity on it will restore the file at boot.

The "nocrypt" flag removes the encryption flag in the fstab of your kernel. By default it only removes "forceencrypt" and "forcefdeorfbe". For the Mate 9 Huawei chose to change that flag to "fileencryptioninline", which encrypts single files rather than the whole partition. Most of the time TWRP will handle encryption (you will need to enter pin after entering twrp), this is not the case yet. When it does handle it you won't notice that it is encrypted.

Encryption has probably been enabled but you haven't noticed as TWRP would decrypt for you.

And just removing the flag is not enough to get rid of encryption. Both flag and a format of data is required.

I hope we get kernel sources soon, then someone could implement file based encryption to TWRP :)
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] CrisperNeO:
Just sent you link to the boot image.

So I understood it as: different root methods will handle the flags differently, based on the encryption status of the partitions. Not only data partition, but also kernel etc., right? (Does kernel also have a separate partition? Or for Mate 9 Pro, is kernel in boot partition?)

Root will inject something into kernel, system etc. (SuperSU handles it differently than superRoot or superuser?)

My guess: in my case, why root fails, is probably because the kernel restores itself and the injected files get erased after reboot.

Is it right?
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
It depends. In Mate 9s case you have to modify the flashable root zips to check for "fileencryptioninline", else it won't find it and you will re-encrypt at first boot. Same with finding the partition where BOOT is mounted. In this case it's named BOOT_A.

SuperSU (the one in eddmechas decrypt thread), Superroot and phh use the same method of installing su. All install to kernel.

Kernel shouldn't restore itself...

I wonder if you somehow can get a log from twrp, normally you press the 'copy to sdcard' button but that might not be possible with encryption. try it and post it here.

Else log is kept in /tmp/ if I remember correctly.

I will check your boot when I get home in ~3 hours
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] CrisperNeO:
I managed to export the recovery through USB-OTG and attached here.

Question: you said "else it won't find it and you will re-encrypt at first boot", re-encrypt what partition?

In eddmechas methods, the config.txt includes:

eng verity crypt

And in the latest file, SuperSU-v2.79-MATE9-init.d_support_no_decrypt-signed.zip you suggested and succeeded to be flashed, includes:

eng noverity nocrypt hidesu

I'm a little bit confused here. In eddmechas thread, the data is formatted, and the latter one doesn't need data to be formatted. Will the latter config tell the kernel not to check verity and crypt, or what is exactly the behavior? Will this one also install root to kernel?
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
re-encrypt /data. It's the only partition that's encrypted by default.

In eddmechas supersu and superroot it has:

eng noverity nocrypt.

I just checked and I put them together before :P

In mine it does indeed have the same flags, but I commented out "#sed -i 's/fileencryptioninline/encryptable/g' $i" in changes.sh, for some reason. (rather than just using "crypt".)

config.txt checks what to do, if you add noverity, it will look for "verity" in fstab.hi3660 in the kernel and remove those flags.

If you add nocrypt it will look for "forceencrypt" and "forcefdeorfbe" and remove those flags if it finds them. It will also look for "fileencryptioninline" and change that to "encryptable".

If you have "eng verity crypt" it wont do anything to encryption or verity.

On another note, your boot image is patched and contains su... I dont know why it doesnt want to work.

Edit: Recovery.log tells a different story though. It can't generate new-boot.img for some reason. And therefore no root apparently.

I'll check what could be causing it.

Edit 2: Aha. It's because of a sh bug in TWRP 3.0.3. It's fixed in phh now, but this is using an old build.

See your PM.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] CrisperNeO:
Thanks firstly!

Flashed the stock boot.img for B213 and then flashed the new SuperSU zip. The procedure went through, but there is still no root after boot. Also tried with your boot image - I assume it's the same image - also no luck.

Attached the log file. Do you wanna see the patched boot?
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] CrisperNeO:
Finally I managed to get root!

I got a TWRP 3.1.0-1-0 for Mate 9 Pro, which I assume is also for Mate 9. However, in this TWRP the device is not recognized as an adb device...

Followed the steps below:

1.	(I think it’s optional) Disable fingerprint ID

2.	(I think it’s optional) Flash stock boot image for B213D

3.	Flash TWRP 3.1.0-1

4.	Flash SuperSU-v2.79-MATE9-init.d_support_no_decrypt-signed.zip via USB-OTG (in TWRP the device is not recognized as an adb device, hence no “adb sideload”)

I'm still thinking about the steps. Perhaps I'll write a thread about Mate 9 Pro.

Great thanks to [MENTION=2247733]ante0[/MENTION]!
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
Good job. I was actually trying to build a new twrp for Pro yesterday. But it keeps failing at building with 'ninja'. I assume something is missing... Omni_hi3660-eng.ninja keeps getting EOF at different places each time. Oh well.

You could probably flash back 3.0.3 now, but if 3.1.0 works it should be fine.

3.0.3 for Mate 9 is the same for Pro, only difference is kernel image it's built with. That's probably why adb doesn't work for you in 3.1.0 because it's using B182 for Mate 9.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] CrisperNeO:
Seems like Mate 9 Pro is not a hot device here on XDA. No wonder if it is only sold in certain areas and there is no kernel source available. -.-

Great device though!

Anyhow it will be great if we can get some dev support like working TWRP etc. ;)
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
Could someone test this for me on a Mate 9 Pro and tell me if adb/etc works for you?

https://mega.nz/#!x4kQAQ4J!3tK-8rXX4LI7-qL0xjbpWPOUFmULvFe_rbHqYDXUuyM

I've tested it on my regular Mate 9, and no problems at all.

It's built using LON-AL00C00B213D kernel.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] CrisperNeO:
The new file still doesn't work with ADB.

There is no ADB devices showing when in TWRP, and my computers shows that a USB device is not recognized (under 3.0.3 it's not).

"ps | grep adbd" shows:

351 root 10940 S /sbin/adbd --root_seclabel=u:

360 root 8668 S grep adbd

What does it mean?

Maybe it's because of the driver? Perhaps anybody else can try?

---------- Post added at 12:08 PM ---------- Previous post was at 12:07 PM ----------

I wrote a general guide for Mate 9 Pro:

https://xdaforums.com/android/devel...-twrp-root-t3616313/post72531591#post72531591

Hope it can help M9P users.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
Does ADB work when you're booted into system?

I just wanted to know that adbd was running, and it is. If it wasn't, that would be why adb didn't work :P
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] CrisperNeO:
Yes...
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] eddie1:
Can anyone please upload the phone manager APK please

You can save it as an APK using ES file explorer back up feature
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
Included libs and oat

https://mega.nz/#!kxFSHRqT!uoMde-p9KPPaCDyr7kgsdHATGJfNWGq222GW0pIytkM
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] Big-Blue:
Did anybody test Magisk v13,1 on this phone yet? Can it be installed, does Magisk Hide (which is now enabled by default!) work without making the phone unlockable after a reboot?
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
Yes, works out of the box.

Magisk Hide does not work. I'm trying to figure out why.

I'm guessing the hide daemon isn't running as fingerprint is working with it enabled, or that might've been fixed.

It's not unmounting folders as it's supposed to.

Edit: OK, going into service menu (ProjectMenu) by entering *#*#2846579#*#* into dialer, 1. Background Settings - 3 LOG Settings. Enable all logs (Just enabling AP doesn't seem to stick).

Also increased buffer size for log in Dev options to 4 mb.

Then flashed back stock boot image and reflashed 13.1.

Now hide works and fingerprint works :)
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] The-bimse:
Hi. If i were to flash the stock recovery in order to be able to update, would that break my root? I have searched and searched, and i haven't found a way to update my firmware when having TWRP.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
It will still break as boot partition is overwritten when you update, so you'd still have to unlock bootloader and flash twrp and root again. Regardless if you update full or Ota it's the same. :(

So you might as well just download latest firmware, backup everything and flash using the flash guide in Guides.

But yeah, to install OTA you'd have to flash back stock recovery as it's not possible with TWRP.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] The-bimse:
Thank you for the really quick reply! Now im gonna be an ass, and ask if you would be so kind as to link to the guide, so i'm sure i don't find the wrong one?
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
https://xdaforums.com/mate-9/how-to/guide-mate-9-flash-update-package-t3593108
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] The-bimse:
Do this work for the Mate 9 Pro (LON-L29)? Sorry that i keep bothering you.

EDIT: Nvm, seems like it does, since the device is mentioned in the end of the post. Ty!
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
Yeah, went through all pages to page 46 (Who wants to use search anyway?! xD) and it seems like [MENTION=4033185]Gormsen[/MENTION] is one of them :P

It does say in OP that it's not verified, but it seems at least one person managed to update/rebrand using it so it should work just fine.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] The-bimse:
I followed the guide, and it worked like a charm! Thank you so much, i have been looking for a way to update for months. Never thought of looking for it in the Mate 9 forum though, silly me :).

Sorry for going off topic.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] mcn1970:
I might be blind, but where is that guide?
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] The-bimse:
https://xdaforums.com/mate-9/how-to/guide-mate-9-flash-update-package-t3593108
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] mcn1970:
i have this TWRP and I received an OTA but after restart the prhone stays in TWRP doing nothing. Any idea why?

after normal booting it says again that i have the same OTA.

erecovery doesnt work either
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
Flash back your stock recovery.

Lmk what model/build (LON-LxxCyyyBzzz) you are on and I'll send you recovery.

Actually though, if you have modified /system, /vendor or /product OTA will refuse to install.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] mcn1970:
here is. all I did was unlock and flash unofficial TWRP.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
https://mega.nz/#!UboHnIjL!lPS4Q7hFcIVxZgTXt8VtYvcg_ce579r3eHo_QrUcUVg

Flash using fastboot in bootloader mode.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] mcn1970:
i will probably be able then to install OTA. will i lose any data? what about unofficial TWRP? need flashing again?
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
Data will be safe. But bootloader will lock again so you'll have to unlock it... Which means your data will be wiped.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] mcn1970:
so for this phone having root/TWRP and OTA also is like mouse and cat game? with every OTA do I need to do again the procedure? the bad thing however is that I couldn't find any good custom ROM.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] mcn1970:
after flashing how can i have B226 stock recovery?
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
If you're updating to B226 you will have B226 when OTA is flashed.
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] mcn1970:
i mean to extract only B226 recovery
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] ante0:
You can extract from firmware using Huawei Update Extractor. But if you want stock just don't flash twrp again :P
[Huawei Mate 9 ROMs, Kernels, Recoveries, & Other D] mcn1970:
i flashed recovery but BL still unlocked and OTA doesnt work. erecovery also dosent work. How can I revert to full stock?tried some solutions found in xda but no succes

EDIT: after a huge OTA B229 worked