yashsingh1/xdaforums huggingface dataset:
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] TingyiChen:
No,due to some AB special thing,directly fastboot boot twrp.img will cause a reboot on splash screen and brick ur data,only wipe data can enter system again
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] TheXenons:
How can I install Magisk from the TWRP of Slot B in Slot A? When trying to install it detects Slot B and installs it in it.
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] Benjamin_L:
There should be a change slots option
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] munchy_cool:
I think you need bootctrl package to install TWRP to both slots. Also need to tell which slots are a & b. check any other device with ab slots, like Moto X4.

https://github.com/TeamWin/android_device_motorola_payton
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] MrPhilo:
Really, I'm assuming A2 A/B is different to OnePlus 6 but what we do is fastboot boot twrp and then flash the official twrp and all is working. A bit weird it's different on A2.
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] TingyiChen:
hmm maybe?Cuz I am not familiar with AB now..Still reading documentations...
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] secosan:
Anybody has any idea on how to install supersu or magisk?
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] Ivan93tm:
For magisk or supersu you can use patched boot flashable trough fastboot command, with twrp i have really no idea if there are some flashable zip or similar
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] grzpra:
This recovery done nothing as it was installed on _b rather than _a, so it's not modifying _a partition. and if we flashed it on _a, it will get bootloop/asking to reset data, even we flashed lazypatcher. And our device get bootloop to on _b partition.

You can use this to root, just flash it on boot_a. It was made by magisk manager with patch boot image method. You still need to install magisk manager to get root.

Don't install magisk xposed or you will facing bootloop/asking to reset data. If that happen and you don't want to lose your data, flash twrp from this thread to boot_a, use magisk recovery manager to uninstall xposed module, and then flash magisk boot from me again to boot_a. reboot afterwards.

Magisk boot image on 9.6.9.0.ODIMIFE : https://drive.google.com/file/d/1sMFjQVLvj_cX_tht7-woSQQ4YlCF_i4i/view?usp=sharing
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] emperor8696:
Which version of ROM do I need to have to flash the patched boot.img? Also, are the modules working?
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] grzpra:
my rom ver is 9.6.9.0.ODIMIFE, and the modules is working.
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] GreekFlash:
When should we expect official?
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] Roi Danton:
Thank you, you saved my day. My Mi A2 (Global) finally has Root. :)

I tried with the howtos from the internet and installing different Magisk zip files through TWRP, nothing worked.

Is it possible to get a Magisk 16.7 boot image? ;)
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] Roi Danton:
I got it myself. With your image (from a older stock ROM) wifi did not work anymore.

If someone is interested, I got a patched boot.img from stock ROM V9.6.10.0.ODIMIFE and Magisk 16.7.
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] grzpra:
If your rom is updated, i can't. As mine were Mi6x not A2, but it work with cross flashing with a little modification (don't know if it from A2 to Mi6x).

You can patch it yourself with magisk manager, copy the boot image from fastboot rom to your phone, in magisk manager you need to choose install and then select patch boot image. You need to be on "unroot" condition, just flash the original boot.img rom first with fastboot.
[Xiaomi Mi A2 ROMs, Kernels, Recoveries, & Other De] Roi Danton:
Thank you. As I wrote here I have a patched boot.img for stock ROM V9.6.10.0.ODIMIFE and Magisk 16.7 - which works pretty good. With your boot.img I had the problem that wifi did not work anymore.

If someone needs the patched boot.img, get in contact with me.
[Moto G5 Plus Guides, News, & Discussion] NZedPred:
Backing up your persist

One thing that cannot be emphasized enough is that you must keep backups of your persist. (Your efs is even more important to backup if you no longer have your own persist.) Once backed up, make a copy on your PC or laptop, and keep a private cloud copy somewhere as well.

Recent versions of TWRP have made it easy to back up your persist partition. Older versions may not have had native functionality to back it up, however there was also an alternative. Relevant details below.

TWRP backup of persist (recommended)

The official TWRP thread is below. You should consult this thread to check for the latest versions.

[RECOVERY][OFFICIAL][potter] TWRP 3.2.2-0 touch recovery

At the time of writing (2018-08-05), there was a special build made that fixed backing up with encryption. This is the one that I have used in my testing. Link below:

https://xdaforums.com/showpost.php?p=77207112&postcount=199

You will see persist as an available option in Backup and Restore. The backup file will be called persist.ext4.win. It is in fact a tar archive, so you can extract it with tar if you want to examine the contents on your PC.

Image backup of persist

If you don't have TWRP handy, or an older version of it, you can instead use the dd command from a root shell (either within stock or within TWRP)

The following can be used to create a backup and place it at /sdcard/persist.img:

dd if=/dev/block/bootdevice/by-name/persist of=/sdcard/persist.img

The following can be used to restore a backup placed at /sdcard/persist.img:

dd if=/sdcard/persist.img of=/dev/block/bootdevice/by-name/persist

dd backups are bit-perfect, and can also be mounted if you need to look at a filesystem from e.g. your PC.
[Moto G5 Plus Guides, News, & Discussion] NZedPred:
From post #77 - dhob.bin but no dhob.bin.bak

I'm repeating some findings from another post of mine further down the thread at post #77. It seems to be a common occurrence that unfortunately hasn't been solved.
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
[MENTION=7346927]NZedPred[/MENTION] : As I said before, really nice catch.

One question: I made a img backup of persist using the dd commands. As you recommend the way saving it through TWRP, for me it's not clear if it's possible to backup persist with the 3.2.2.0 official TWRP or the special build is needed. I'm on the official one and would like to use it if there's no need to flash the other one. As there's no special " persist" backup option in it is it included somewhere else in the nandroid backup?
[Moto G5 Plus Guides, News, & Discussion] Cupcake 1.5:
Well that's me screwed, I lost my persist before anyone knew wtf was going on.

Edit: If I fastboot stock while also using all the erase commands, will that leave me with original persist?. I am assuming so since after doing this in the past, I am left with 0 imei and 0 imei sv. If I use one of the shared persists, my imei sv changes to 8. If this is the case am I right to then assume this guide can work for anyone, even if they have no backup of original persist, since they can back up there own borked persist in twrp after a full fastboot job?.

Edit2: I think I am confusing persist with efs and how it rebuilds on erase. Is there a way to erase persist and let it rebuild much like efs folder would upon erase?
[Moto G5 Plus Guides, News, & Discussion] AhmedtSadek:
I got that error chown: bad user 'rfs' My phone is not g5 plus it's g5 and i was trying to fix it

here is the cmd window

1|cedric:/ # ls -l /persist
total 112
drwxrwx--- 2 system system 4096 1970-01-01 02:21 alarm
drwxr-xr-x 2 mot_pwric mot_pwric 4096 2018-08-05 08:29 batt_health
drwxrwx--- 2 bluetooth bluetooth 4096 1970-01-01 02:21 bluetooth
drwx------ 2 root system 4096 1970-01-01 02:21 bms
drwxr-xr-x 2 mot_tcmd bluetooth 4096 1970-01-01 02:02 bt
drwxr-xr-x 5 mot_tcmd mot_tcmd 4096 1970-01-02 01:43 camera
drwxrwx--- 2 system system 4096 1970-01-02 01:43 chargeonly
drwxr-xr-x 2 root root 4096 2017-11-22 11:25 coresight
drwx------ 4 system system 4096 2017-11-22 11:25 data
drwxrwx--- 2 system graphics 4096 1970-01-01 02:02 display
drwxrwx--- 2 system system 4096 1970-01-01 02:02 drm
drwxr-xr-x 5 mot_tcmd mot_tcmd 4096 1970-01-01 02:21 factory
drwxrwx--- 3 oem_2903 oem_2904 4096 2017-11-22 11:25 hlos_rfs
drwxrwx--- 2 root root 4096 2017-11-22 11:25 lost+found
drwxrwx--- 2 radio radio 4096 2017-11-22 11:25 mdm
drwxrwx--- 2 system system 4096 1970-01-01 02:21 misc
drwxrws--- 2 mot_tcmd mot_tcmd 4096 1970-01-02 01:43 paks
drwxrwx--- 2 system system 4096 1970-07-07 12:32 properties
drwxr-xr-x 11 mot_tcmd mot_tcmd 4096 1970-01-02 01:43 public
drwx--x--x 6 oem_2903 oem_2903 4096 2017-11-22 11:25 rfs
drwx------ 2 root root 4096 1970-01-02 01:43 sds
drwxrwx--- 2 system system 4096 1970-01-02 01:43 secnvm
drwxrws--- 2 drmrpc drmrpc 4096 1970-01-01 02:02 security
drwxrwxr-x 3 system system 4096 1970-01-02 01:43 sensors
drwxrwx--- 2 system system 4096 2018-08-05 08:30 time
drwxrwx--- 2 media media 4096 1970-01-02 01:43 vpp
drwxr-xr-x 2 mot_tcmd mot_tcmd 4096 1970-01-01 02:02 wifi
drwxrwxr-x 2 mot_drm mot_drm 4096 1970-01-01 02:02 wmdrm
[Moto G5 Plus Guides, News, & Discussion] NZedPred:
Hey, it may be that that special build is required. Perhaps my comment about 'recent versions of TWRP' wasn't quite correct, and only 'unofficial' versions have the persist option. The partition is not backed up anywhere else if it is not selected (or selectable).

Yes, efs and persist are two completely different things. However, DO NOT ERASE PERSIST EVER!!! It is unique to your device, and without it you will lose functionality. If you have erased efs and it recreates on boot then chances are your persist is fine, and you should back it up.

My advise would be that, as long as your persist is your own, back it up and keep it safe.
[Moto G5 Plus Guides, News, & Discussion] NZedPred:
Hi there, I see you're responding to my comment in the cedric forum. It appears that your are also impacted, with the folders being owned by oem_2903 and oem_2904. However, I need to get the details of the correct owner from a fully working cedric device, to know who to change the owner to. Please keep replies in the thread I posted in the cedric forum. I'll keep monitoring that thread as well.
[Moto G5 Plus Guides, News, & Discussion] Cupcake 1.5:
As I said, my device was borked before anyone knew what was happening. At that time we was using other uploaded efs and persist files. My persist is not my own, probably well and truly screwed lol.
[Moto G5 Plus Guides, News, & Discussion] NZedPred:
Also I should also clarify that I recommend TWRP only because you get a nice gui, and for novices entering dd commands with root privileges carries a high level of risk.
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
Ok, understand that. One more question, you changed the dd commands from the first time you posted them in the old thread.

The old ones were

dd if=/dev/block/mmcblk0p30 of=/sdcard/persist.img

dd if=/sdcard/persist.img of=/dev/block/mmcblk0p30

Now they look like this:

dd if=/dev/block/bootdevice/by-name/persist of=/sdcard/persist.img

dd if=/sdcard/persist.img of=/dev/block/bootdevice/by-name/persist

Is the change significant so that there's a need to make a new backup?
[Moto G5 Plus Guides, News, & Discussion] kusumarajender:
Hi bro

Maximum people's are not have persist and efs backup

You have any solutions please tell me

Me also same problem

I tried your commands

It's just rebooting

Nothing happens

And i flashed xda forums persist

Its showing dhob.bin file

But it's not creating imei's

I tried on stock (old 33 ver and 92-10 ver) and pixel experience also

Nothing worked..

Please help me

Sorry for my bad english....
[Moto G5 Plus Guides, News, & Discussion] echo92:
Hmm, I don't think so. If I understand it correctly - the first set of commands point to the partition directly (i.e. the first line is find partition mmcblk0p30, dd copy to an image, name image 'persist.img'. 2nd line is the reverse). The second set should be the same - just this time you're asking the device to look up a partition of the name 'persist' from the partition list, then copy and output that as the image.

I imagine the second set of commands are more useful generally, e.g. if you don't have a partition list handy or if you want to use it on another device with a persist partition. They should in practice give you the same partition on the G5 Plus. Still, as NZedPred has noted above, requesting the partition by name may be safer for those users unused to dd, since fat fingering the partition name may have some protection. If you fat finger the first set of commands (e.g. you overwrite partition 39 instead of 30), that's not good...

One thing I was thinking about was is it possible to make a permissions fix script for stock ROMs or perhaps patch the custom ROMs so that they don't change the permissions? Or is that permissions change a result of updating to Oreo (as in that you need that change for an Oreo ROM to work)?
[Moto G5 Plus Guides, News, & Discussion] NZedPred:
Hi - no there's no difference. The new commands differ only in that they are referring to the 'named partition', rather than a partition block number. The named partition is a symbolic link that points to the same place:

potter_n:/ $ su
potter_n:/ # ls -l /dev/block/bootdevice/by-name/persist
lrwxrwxrwx 1 root root 21 1971-01-25 16:38 /dev/block/bootdevice/by-name/persist -> /dev/block/mmcblk0p30
potter_n:/ #

I find the named partitions easier to understand and more distinct, so no one's going to accidentally backup/restore the wrong partition because they typed in the wrong number.
[Moto G5 Plus Guides, News, & Discussion] NZedPred:
This is something that I'm considering. With the help of [MENTION=4736004]rachitrawat[/MENTION] we now know exactly where the Oreo custom roms have been changing the ownership of the rfs folder. However, I don't know if the 'fix' is as simple as changing the IDs to the correct ones, as there could be implications for those who are currently happily running the Oreo custom roms. Also, it would mean that

every

rom developer would have to make the change.

If TWRP scripts have the ability to change file ownership, then I will look to build a separate TWRP flashable that does it.
[Moto G5 Plus Guides, News, & Discussion] 5P4RT0N:
bro im using motog5s plus and while im lost my imei im tried lot of methods and also flashed presist from xda pages.. now i think my presist is gone :((

but via trying your method my imei is changed from 0 to 000000876e5501 like this on 1st sim 2nd 1 remain 0 flashing a my efs backup showing a efs2 partition dosnt exist error :(

---------- Post added at 12:59 AM ---------- Previous post was at 12:59 AM ----------

bro im using motog5s plus and while im lost my imei im tried lot of methods and also flashed presist from xda pages.. now i think my presist is gone :((

but via trying your method my imei is changed from 0 to 000000876e5501 like this on 1st sim 2nd 1 remain 0 flashing a my efs backup showing a efs2 partition dosnt exist error :(

---------- Post added at 01:00 AM ---------- Previous post was at 12:59 AM ----------

bro im using motog5s plus and while im lost my imei im tried lot of methods and also flashed presist from xda pages.. now i think my presist is gone :((

but via trying your method my imei is changed from 0 to 000000876e5501 like this on 1st sim 2nd 1 remain 0 flashing a my efs backup showing a efs2 partition dosnt exist error :(
[Moto G5 Plus Guides, News, & Discussion] Jrhotrod:
Would this work if I restored my EFS via TWRP? Or should I go back to the stock EFS to run these commands?

Side note: Very grateful for the hard work of all the people involved in this: [MENTION=4736004]rachitrawat[/MENTION], [MENTION=7346927]NZedPred[/MENTION], and the people who reported their experiences!
[Moto G5 Plus Guides, News, & Discussion] NZedPred:
Is your persist your own one? If not, you need it. If you don't have a backup of it, you're out of luck. No idea about the efs2 partition error. Try this in a shell, and post back with the results:

su
ls -l /dev/block/bootdevice/by-name/modemst*

Not quite sure what you're getting at by restoring your EFS. The EFS is recreated on boot with a fully working persist.
[Moto G5 Plus Guides, News, & Discussion] Jrhotrod:
I mean that I restored the "cached" EFS in order to temporarily restore my IMEI. After flashing stock with the modemst commands, it gives you IMEI 0, so I restore my backed-up EFS to treat it.

So if I have that cached EFS, and with that my IMEI, can I still run this procedure? Because I still do get IMEI 0 after taking OTAs, flashing stock, etc.

I hope I'm making sense :silly:
[Moto G5 Plus Guides, News, & Discussion] NZedPred:
Ok you probably can run through this procedure as long as your persist is yours. If in doubt, post the info that I ask for in the OP including the output of the commands.
[Moto G5 Plus Guides, News, & Discussion] ~Unify~:
Thanks sir, i succeeded.
[Moto G5 Plus Guides, News, & Discussion] Adhil Rahman:
Can someone explain me how to backup persist and efs in moto g5 cedric
[Moto G5 Plus Guides, News, & Discussion] NZedPred:
Efs backup should be available in any recent TWRP for your device. If persist backup is not an option, use the alternative method as described in the second post of this thread (dd commands within twrp, any version).
[Moto G5 Plus Guides, News, & Discussion] William1020000:
On Nougat (stock) I have both my IMEI's, data and 4G (100% functional, no issues at all), but on an Oreo ROM i cannot get IMEI at all. I have my EFS partition backed up, but I flashed the G4 persist before everyone figured out whats going on. I followed these steps (with working IMEI /4G on stock nougat) and all the files were present, but the ownership was messed up (as shown in OP). After a reboot my IMEI was gone. Am I right in saying im stuck on Nougat as I wont be able to get IMEI on Oreo? Thanks.
[Moto G5 Plus Guides, News, & Discussion] david.gs.gm:
Staff got my volte back! I do not know how but he is back ... what I did:

1: put the rom 137.92.14

2: bootloader unlock and TWRP installation ... latest version

3: I put the pixel rom.

4: I put the EFS to have 4G.

5: I put the OReo version TWRP .... dirty installation ... got into bootloop.

6: I made total wipe and put the TWRP version of nougat 137.92.14.

7: the network signal appeared and with VoLTE active!

PS: backup of EFS nougat dont work with oreo :(

And my baseband is 01e ?
[Moto G5 Plus Guides, News, & Discussion] SiddharthHarishkumar:
I tried unlocking bootloader. It says 'PUID NOT FOUND IN YOUR IDENTIFIER'. what is this ?

My device got some problem few days back and moto care changed motherboard. Now I have new IMEI no.
[Moto G5 Plus Guides, News, & Discussion] david.gs.gm:
now that I got my VoLTE again in the nougat ... theoretically then my persist has been restored as the right original? if yes .. I made the backup of this EFS and this new persist ... if I put the official oreo and lose signal of network ... restored this efs and persist I will have network more VoLTE again?
[Moto G5 Plus Guides, News, & Discussion] echo92:
Have you obtained a new unlock key from Motorola? As you've got a new motherboard with a new IMEI, your old code may not work.

If you're still having problems, you may have to submit your device info to this Motorola page

https://forums.lenovo.com/t5/MOTOROLA-Android-Developer/Bootloader-Unlock-Problems/td-p/3222809

I'd also suggest posting any further queries in a new thread, if possible, please.

---------- Post added at 12:43 AM ---------- Previous post was at 12:33 AM ----------

I'm not sure if your persist is back to the original, especially if your baseband is ending in e rather than R. It's possible that if you formally update to stock Oreo, you may lose IMEI/VoLTE as your EFS may not match that of your new baseband, and if you generate a new EFS from persist by erasing modemst1/modemst1, you may still have no IMEI as your persist is not the original one that came with your device. You're welcome to try but make sure you have a backup.
[Moto G5 Plus Guides, News, & Discussion] david.gs.gm:
I tried... But dont work...only IMEI return...with no signal

:(....after fastboot stock nougat my baseband is 01u ... After flash twrp change to 01e ...
[Moto G5 Plus Guides, News, & Discussion] Scarecrow.:
Hi,

Just a quick question.. If we're to unlock bootloader and root the stock 8.1,install a custom rom...and for some reason want to return to stock 8.1 will that cause a loss of IMEI/Persist/EFS?

Sorry if it's a noob question..

Cheers!:laugh:
[Moto G5 Plus Guides, News, & Discussion] Andrej_SK:
I wouldn't recommend you installing CustomROM with stock 8.1 Oreo ROM at all (soak test/stable build.. doesn't matter). If you do that, some of the functions will stop working, e.g. fingerprint scanner. :)
[Moto G5 Plus Guides, News, & Discussion] NZedPred:
If you were to do that, then no you would not lose IMEI. However it is still recommended to back up your persist and efs and save them on the cloud.

Note that as another poster has commented, you will have other problems. You would have to downgrade to nougat to ensure that all functionality works (e.g. fingerprint) when using a custom rom. Use the TWRP flashable builds for this.
[Moto G5 Plus Guides, News, & Discussion] lovish644:
i have dhob.bin but no dhob.bin.bak how to fix it ??

i cant execute ur command /persist/rfs/msm/mpss # hexdump dhob.bin | head -n20

what is the command to look into dhob.bin and perform your experiment

please help me

pleasezzzzzz.......waiting for ur reply
[Moto G5 Plus Guides, News, & Discussion] NZedPred:
You have to execute that command from within TWRP. If that doesn't work, take a backup of it, save it to the cloud, and PM me the link. A word in advance, normally if you have the dhob.bin but no dhob.bin.bak, something has screwed your device and it can't be fixed.
[Moto G5 Plus Guides, News, & Discussion] dhruvanbhalara:
i have same problem how to solve??
[Moto G5 Plus Guides, News, & Discussion] irfanalinawaz:
If your Persist is intact, you never flashed others persist, and have backup of of your Persist and efs thn do what do you want, you will not loose anything.
[Moto G5 Plus Guides, News, & Discussion] dhruvanbhalara:
potter:/ # find /persist -type f

/persist/coresight/qdss.agent.sh

/persist/coresight/qdss.config.sh

/persist/coresight/qdss.functions.sh

/persist/sensors/sensors_settings

/persist/data/tz/tz_counter

/persist/data/tz/tz_counter.bak

/persist/camera/focus/offset_cal

/persist/camera/ledcal/rear

/persist/factory/audio/temp

/persist/factory/audio/cnt

/persist/factory/audio/acc

/persist/factory/audio/f0

/persist/factory/audio/ref_diff

/persist/factory/fti

/persist/public/hiddenmenu/data/mobile_data_rx

/persist/public/hiddenmenu/data/mobile_data_tx

/persist/public/hiddenmenu/data/wifi_data_rx

/persist/public/hiddenmenu/data/wifi_data_tx

/persist/public/hiddenmenu/life_calls

/persist/public/hiddenmenu/life_timer

/persist/mdm/oma_dm_update

/persist/rfs/shared/server_info.txt

/persist/rfs/msm/mpss/safe/sfs/uim/simlock/config

/persist/rfs/msm/mpss/server_check.txt

/persist/rfs/msm/mpss/dhob.bin

/persist/rfs/msm/mpss/shob.bin

/persist/rfs/msm/adsp/server_check.txt

/persist/.bt_nv.bin

/persist/bluetooth/.bt_nv.bin

/persist/time/ats_1

/persist/time/ats_15

/persist/time/ats_12

/persist/time/ats_13

/persist/time/ats_2

/persist/chargeonly/cooldown

/persist/.twrps

potter:/ # chown -R rfs:rfs /persist/vendor_rfs

chown: bad user 'rfs'

1|potter:/ # chown -R rfs:rfs /persist/rfs

chown: bad user 'rfs'

1|potter:/ #

i'm getting bad rfs user error and not getting dhob.bin.bak fie any solution??
[Moto G5 Plus Guides, News, & Discussion] irfanalinawaz:
There are not any solution for this right now.
[Moto G5 Plus Guides, News, & Discussion] dhruvanbhalara:
Also i'm not getting dhob.bin.bak fie any solution??
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
There are no solutions at the moment....