yashsingh1/xdaforums huggingface dataset:
[Moto X4 Questions & Answers] KrisM22:
I don't know if you can. I just now googled and found this:

https://www.quora.com/How-do-I-flash-my-stock-firmware-a-zip-file-as-I-am-running-a-custom-ROM

but of course don't know if it would work. But all this is getting me very close to feeling safe to trash my phone and aim toward setting up a Guide for folks on custom ROMs wanting to go back to stock. Again, you are the first that I know about, and I am thinking the key is that you wiped the partitions before flashing stock. You did format data - don't know if that is necessary. Also you were coming from a 8.x based custom ROM - don't know how the supposed 10 ones would work.

THANKS!!!

---------- Post added at 07:35 PM ---------- Previous post was at 07:04 PM ----------

I googled for "android can you flash a stock zip file with twrp" and got lots so apparently my thinking has been very slow. it would appear to be a very easy way to do it - no bat file. I saw one example which flashed the stock recovery first - I don't know if that is necessary. Most important thing is to advanced wipe all 4: data, system, cache, dalvik.
[Moto X4 Questions & Answers] akillenb:
Actually, Lineage 16 is 9.x based, and it was the official build. And I also deleted the Android directory from my external sd card. I think the leftovers in that directory can cause force closes or other odd behaviors from apps if not cleaned out.
[Moto X4 Questions & Answers] KrisM22:
I think OP said oreo, but def even better if it is 9 based! Thanks!
[Moto X4 Questions & Answers] redwoodie:
More woes...lost Wifi/Phone again

My "good" X4 just lost phone and wifi again after 2 days working since my wiping modems t1/t2 (my post on 2/24). It started with the system UI restarting, then went to no connection like before. This is the one that took the OTA successfully. Had to move my SIM to the other X4 (one that's working but failing on 39-6-5 OTA) as I was expecting an important call. When I flashed 39-6-4 on the one now failing OTA I had wiped everything TWRP offered to wipe in advanced first. I think there were some additional partitions besides system, data, cache, dalvik. I'll boot TWRP later and look again. Bottom line, other than refusing the OTA the phone I re-flashed stock on is doing better than the one that I got to take the OTA simply by unrooting (that's the first one mentioned with the radio problems).
[Moto X4 Questions & Answers] KrisM22:
interesting. wipe t1 and t2 again? I would only wipe data, system, cache, and dalvik. nothing else. I also noted that [MENTION=7258623]akillenb[/MENTION] also formatted data. I know there are 2 ways of doing that and don't know which one they did. Wonder if that's necessary?
[Moto X4 Questions & Answers] redwoodie:
Wiped t1/t2 and radios working. Probably not a permanent fix though. As of now this phone is badged "untrustworthy". For now I'll keep using the other one. Keeping wifi off stops the OTA loop.

And, unless I was hallucinating, I didn't see any other partitions in advanced wipe besides Dalvik/ART Cache, System, Data, Internal Storage, SD card. No separate options for Dalvik and Cache.
[Moto X4 Questions & Answers] KrisM22:
yes, the partitions I call dalvik = dalvik/art , and cache = cache. even though they are both caches of a sort. Of course don't wipe internal storage or SDcard unless you really really mean to (I think a stock flash will wipe internal storage.)

You might take the "untrustworthy" one and temp twrp wipe advanced all 4 and then use twrp to flash -4, just to see what would happen. Try formatting data as part of that all.
[Moto X4 Questions & Answers] redwoodie:
Has someone set forth a procedure for flashing a FFW with TWRP? The zip contains both flashfile.xml and servicefile.xml, the difference being servicefile.xml does not wipe userdata. How would TWRP know which one to run?
[Moto X4 Questions & Answers] KrisM22:
what's a FFW? I assumed factory stock:

"I googled for "android can you flash a stock zip file with twrp" and got lots "

As to which it uses, no one mentions it. But I believe they all manually wipe the 4. The only unknown to me is do you need to format data.

If you read my posts up 10 or 20 or so you can see I was just beginning to think about doing that. We always had RSDlite so no need. But apparently we always could have used twrp. Just preface that with a wipe 4.
[Moto X4 Questions & Answers] redwoodie:
FFW=Factory firmware.

Here's an interesting post on Lenovo's X4 forum.

https://forums.lenovo.com/t5/Moto-X4/Moto-X4-Firmware/td-p/3878482

Great company! Great support!

And who needs factory images anyway.
[Moto X4 Questions & Answers] KrisM22:
I took the leap and am now waiting for PE 10 to finish loading my google backup of some 54 apps. My intent is to spend a few minutes testing it out an then try to go back to stock -4 and see if it works. learned bunches in the process - current twrp will back up efs (they didn't used to), and flashing it is different - do temp and then flash zip which gets both -a and -b. I am sure you all know that but... :) Then I will do lineage 16 and then superior OS. any others I should test? I don't want a custom ROM - I just want to establish a get-back-to-stock process. So after that I'll post a guide.

Nope, can't twrp flash that zip.
[Moto X4 Questions & Answers] KrisM22:
okay, got -4 back and updated to -05 but no mobile. erased t1,t2 but no change. restored EFS and vendor, but no change. What else did you restore/do?

edit if I restore efs and then erase t1,t2 - efs is back to 0

getting frustrated so tried to restore everything I had backed up previously but this time it gave me a "mounted read only" for Vendor, so I restored the rest:

EFS

Persist

fsg

Dsp

Boot logo

and voila - mobile.

Later note, I believe the only ones I should have restored were EFS and fsg(file system golden copy)
[Moto X4 Questions & Answers] KrisM22:
yes, there are only 3 in twrp 3.3.1: advanced wiping: data, system, dalvik-ART-cache

---------- Post added at 11:39 PM ---------- Previous post was at 11:00 PM ----------

fi -5 is on lolinet

edit but it's nice to flash -4 and see it update to know that it can!

---------- Post added 29th February 2020 at 12:02 AM ---------- Previous post was 28th February 2020 at 11:39 PM ----------

ref that link you gave me about Lenovo support... Even 2 1/2 years ago the stock zips were probably up on lolinet. There was a time long ago when Moto had those things on it's own site but I think that goes back to early atrix or before. It is very true that no company is at all interested in helping folks who have unlocked and modified their phones. That's why XDA exists. As many times that we put warnings about modifying a phone, people just ignore it. No, Lenovo is unwilling to help, and I don't blame them - like a swimming pool or a yacht, it is a money-hole - endless, and for many, no satisfactory solution. Only modify a phone you are willing to throw away....... :)
[Moto X4 Questions & Answers] KrisM22:
My purpose with this set is not to test custom ROMs but to do a bunch of things to my phone and assure I can get back to working stock.

So I flashed Lineage 16, booted, flashed gapps 9, booted, tested a little, had probs with gapps getting my backup but could have been my fault or wrong gapps.

On way back to stock I format data, advanced wipe: Dalvik/ART-cache, data, system, boot to fastboot and run my bat file.

BUT this time I removed the 2 erase t1,t2 lines!!!!!

It booted with both wifi and mobile working!!!!! No problems. This is more like it!!! (took the -5 update fine)

I did have a thought for those folks who didn't take backup of all those little files, but are able to have wifi and mobile working on the custom ROM, to take a backup -there-, and if necessary, restore it when you've flashed back to stock. Don't know if that would work but it would seem that if you have the correct info in place for those things to work, a backup should be viable no matter which ORM you're on. Dunno, though.

But it does seem clear that if things are working don't run the erase t1 and t2.
[Moto X4 Questions & Answers] redwoodie:
KrisM22, I just skimmed the rest of your posts, that's a lot of work! For some reason XDA's subscription notifications weren't coming to me last day or so and I missed the progression. I'll read all this later on, but sounds like great progress.
[Moto X4 Questions & Answers] KrisM22:
yeah, AND some mistakes, like thinking that TWRP could flash a stock zip. Maybe it can but I haven't figured out how yet, and after the "remove erase t1 t2" thing, I don't know if that would be good.

Thanks for the encouragement!!!
[Moto X4 Questions & Answers] redwoodie:
What's PE10? couldn't find it with a search.

Going from dysfunctional stock to stock, should I leave the erase modems t1/t2 in?

and....I have no backup of EFS for the non-updating phone. What to do?
[Moto X4 Questions & Answers] KrisM22:
Sorry - Pixel Experience 10 - just one of the custom ROMs on the first page.

I don't know. I would say if you had a working custom ROM, take it there, but you don't.

You could try using the fsg from the other phone but I have no idea what that would do - 2 phones with the same IMEI? or maybe imei is only in EFS? - Just restoring EFS did nothing for me when PE 10 had no mobile - only restoring all of them fixed it. Darn good that you suggested that!!!!!!!!!!!!!!!!!!!!

I think you were looking at -2 or an earlier pie, and I think I saw that mentioned somewhere. You might try that, but w/o the erase commands. You can always do them separately if needed.
[Moto X4 Questions & Answers] redwoodie:
I don't quite understand that last part..."do temp"?
[Moto X4 Questions & Answers] KrisM22:
"do temp" meant do the temporary install of twrp via fastboot boot twrp.img

However, in the guide, I go on to say then flash the zip. Cool - that's the permanent version

BUT then I say reboot to recovery to lock it in... Rebooting to recovery will boot you back into twrp, but it doesn't seem to lock it in - ie make it be permanent, because later, when I am done playing with a custom rom, I try to boot into twrp, it isn't there. Stock recovery is there. I don't know what to do to make it "permanent" while a custom rom is in use.

So when I'm done with the custom rom, I boot to bootloader and temporarily boot to twrp and use that to format data, wipe Dalvik/ART-cache, data, and system, and then boot to bootloader and start my bat file fo flash stock.

I had to make changes to that guide because I discovered that coming back to stock from Pixel Experience 10, I always lost mobile, no matter whether I used the erase t1,t2, or not. To a certain extent that makes my new guide rather pointless. I was hoping for one way to keep mobile, but, nope. Darn!
[Moto X4 Questions & Answers] redwoodie:
I guess most of that doesn't apply in my case since I'm not playing with custom. And you found TWRP can't flash stock?

On a slight tangent, I was backing up EFS, fsg, persist etc. and then tried to make a regular backup (in TWRP) and it keeps failing. Was trying to find out if phone has to be rooted to do a full regular TWRP backup. I saw that backing up System Image (larger file size vs. System) is preferred as it is bit for bit copy to pass verity. Both my devices are unrooted now, could that be why the backup fails? Or does /System have to be mounted (read only) to do a successful backup?
[Moto X4 Questions & Answers] KrisM22:
Why is it failing? No, you don't need root to do backups. I never root. I've never done a system image - always system,data,cache, or whatever it is (I don't remember what the check boxes are).

And, yeah, when I tried to flash stock it said "wrong kind of zip" or something like that, and I haven't had a chance to pursue that. It may be that some OEMs have stocks in the form that twrp can flash, but Moto does not. But using a bat file is easy and fast.
[Moto X4 Questions & Answers] redwoodie:
Here is the TWRP thing on System Image.

https://twrp.me/faq/whattobackup.html

My backups fail on System Image with a "no such file or directory" error. This 3.3.1.0. Here's what the recovery log showed:

'/dev/block/bootdevice/by-name/system_a', writing '/usb-otg/TWRP/BACKUPS/Z*********/2020-03-01--21-04-10/system_image.emmc.win'
I:TWFunc::Set_Brightness: Setting brightness control to 0
I:TWFunc::Set_Brightness: Setting brightness control to 80
I:Set overlay: ''
Truncating string cache entries.
Truncating string cache entries.
Truncating string cache entries.
Truncating string cache entries.
I:TWFunc::Set_Brightness: Setting brightness control to 5
I:Error writing destination fd (No such file or directory)
Backup Failed. Cleaning Backup Folder.
I:Copying file /tmp/recovery.log to /usb-otg/TWRP/BACKUPS/Z*********/2020-03-01--21-04-10/recovery.log

After booting to recovery and TWRP, then back to system, the "untrustworthy" phone is again without mobile, and wifi/NFC connecting and disconnecting every 20 seconds or so. So the erase "modems t1/t2" fix is not durable.
[Moto X4 Questions & Answers] KrisM22:
Don't know. This is on your "untrustworthy" phone? This on a Backup? - going TO your SDcard? Assuming there is enough room on your sdcard and it's not bad. You could always try another sdcard.

So suppose those partitions are bad on your phone? - so format data, wipe all 3 and re-flash it? with -2 this time? I'm just throwing out ideas here - don't know.

Note - tomorrow I will be tied up until late in evening so won't reply till then.
[Moto X4 Questions & Answers] redwoodie:
Yep, Ol' Untrustworthy. This was to USB OTG w/plenty of space on it. I could try it to SD or Internal Storage. Thing is, the backup with plain ol' "System" (not System Image) completed. System's about a gig smaller, but there was 27gb free on the drive.
[Moto X4 Questions & Answers] KrisM22:
Yeah, I repeat, I've never done system image. Never had a prob with just system/data/cache or whatever it is.
[Moto X4 Questions & Answers] redwoodie:
I think one of the fixes I tried early on one of these phones (probably Ol' UD) was to restore a TWRP backup with only /system from before rooting, and the restore failed. But I don't remember which one, when and details. Ol' UD was the first one I rooted and the first one to have problems. I should keep notes. I think I wiped everything and flashed -2 (or was it -4?) after that. Never expected this be be such an epic saga.

Have you successfully restored a backup to this phone?
[Moto X4 Questions & Answers] KrisM22:
I haven't tried. I do have one backup out there - of PixelExperience10, but never tried to restore it. I suppose I could but I'm way lazy and need to get to bed early and don't want to chance screwing up my phone, though I suppose that since I have a backup of the little partitions I can't really lose it. Maybe on Wed, if need be...

Why would you be backing up stock on a screwed up phone?
[Moto X4 Questions & Answers] redwoodie:
As stated above the backup was from before rooting so presumably phone was not yet screwed up (but you never really know with this beast, ja?). Only bootloader had been unlocked, to enable booting TWRP.
[Moto X4 Questions & Answers] KrisM22:
So are you then trying to restore this backup? was it a "system image" backup?
[Moto X4 Questions & Answers] redwoodie:
Not now. Tried that couple weeks back, failed. Plan to wipe and flash -2 or -4. Leave the erase modems t1/t2 in, or delete them?
[Moto X4 Questions & Answers] KrisM22:
delete them. you can always do them after if needed.

-2
[Moto X4 Questions & Answers] KrisM22:
check that - I don't know which would be best - without, or with.......
[Moto X4 Questions & Answers] KrisM22:
any news?
[Moto X4 Questions & Answers] redwoodie:
Been dealing with the Zombie Apocalypse here. Details at 11.

Anyway, I just flashed -4 on Undependable with the .bat file (omitted erase modems t1/t2, but Wifi was down still). Went back to fastboot and erased the modems, wifi now on, so far it has managed to take the -5 update (oddly, it went through the install twice with the progress bar reaching 100% both times). Wifi seems stable so far. Getting late, if Wifi's still good in the morning I'll try the SIM. One annoyance, this time during initial setup it did not ask me to use a Google backup. There should be some way to initiate it after the initial setup?
[Moto X4 Questions & Answers] KrisM22:
That's right - you are right in the middle of it... Stay healthy!

There is no way to do a google-backup "restore" after initialization. I found this out the hard way. You can do a backup fine, but can't restore. No idea why it didn't offer it...

I have changed the "guide" a lot. You might want to try the regular bat to flash. But, again, I just don't know.

Good luck and keep me posted!
[Moto X4 Questions & Answers] redwoodie:
Earlier today wifi and mobile were working. Put the SIM back in my reliable phone, now back to intermittent wifi after a reboot.

Something is happening on reboot to bugger the radios. Hardware problem? Later I'll try erasing modems again. This is the phone I don't have EFS etc. backup for.
[Moto X4 Questions & Answers] redwoodie:
Wifi disconnects and reconnects every 20-30 seconds. Same behavior as before reflashing -4.
[Moto X4 Questions & Answers] KrisM22:
flash -2?

research fsg and maybe copy from working phone to bad phone?

EDIT: No - I just realized fsg comes in from the zip each time so that wouldn't do anything, I don't think.

EDIT: No, -1 made no difference.
[Moto X4 Questions & Answers] KrisM22:
One of the reasons I keep pushing -2 is that I think there was a modem change back there in early Pie for us. But I can find no proof of this. - it's a "may have read something somewhere" type of thing.

There are 10 Fi pie zips on lolinet. Maybe try earlier ones? But of course, I really don't know because I haven't done it myself

-ooooo - I suppose I could try - by flashing Pixel experience 10 I know I can induce the problem - then I could try to flash earlier zip"s. Maybe later today - I'll see how my time goes. Long walk comes first...

EDIT - so far, FI_9.0_PPWS29.69-39-6-1 makes no difference. Nope - I let it update to -2 but still no mobile.

EDIT: in doing some more searches, I found this for Persist

https://www.androidpolice.com/2020/...d-10-update-issue-which-breaks-pixel-sensors/

since this didn't mention imei problems, I wonder if you could backup Persist on the good phone and restore it to the bad phone. Dunno.......
[Moto X4 Questions & Answers] redwoodie:
I went back through numerous TWRP backups taken from both phones since I unlocked--all of the modem, EFS, fsg etc. files between the backups on 2 phones are the same file and hash size. I haven't compared the actual hash signatures yet but may do that later.

If -1 doesn't work, maybe try the first Pie update 29.69-26?

KrisM22, regarding ChefGeoff who posted on your Newbie thread, maybe appeal to (IOW "Challenge") his claimed "superior knowledge" about methodology for getting a previously modded phone back to working stock? Man, what an unhelpful and arrogant post.
[Moto X4 Questions & Answers] KrisM22:
stuff like that long ago ceased to bother me. :)

29 69 26 - possibly. I didn't try it. Maybe later...

twrp backups normally only do system,data,cache - not the little stuff - did you check the boxes for the little stuff??? If so, just restore EFS and Persist from the earliest backup for/to bad phone. I didn't know you had that... Oh wait - I just remembered - I think you did system image... So you have that? if so, temp boot to twrp, format data, wipe all 3, restore the oldest pie EFS and Persist, boot to bootloader and run bat.

Edit: it's not the size, but the stuff in it.
[Moto X4 Questions & Answers] redwoodie:
EFs-persist--I have it, but the phone was already having problems then. It may be from before I lost the radios, but OTA was failing.

I'll have to compare backup dates with my posts as I haven't kept a diary on this but wish I had.

But the hash would differ if the file was corrupted?

Do you mind if I post a reply to that wanker asking for some useful information? My finger's almost healed from the first post on your thread.
[Moto X4 Questions & Answers] KrisM22:
I would ignore him Don't feed the trolls... but do as you wish. mod might slam you. Besides, maybe I really don't know anything!!! :)

OTA failed because of junk left by majisk etc, I would suspect. That would have nothing to do with EFS or Persist. They probably good at that point.

---------- Post added at 08:57 PM ---------- Previous post was at 08:27 PM ----------

yeah I would think the hash would change but.................
[Moto X4 Questions & Answers] redwoodie:
So you think flash all the small bits from oldest backup I have?

Neither phone has ever lost IMEI so I am wondering whether EFS has much to do with it.

Think it would be too risky to do an fsg "transplant" from working phone to Undependable?]

If mod should slam anyone it should be him. I'm no XDA sage, but he has 1/4 of my posts. I would just say instead of dissing others, why don't you share your knowledge, post a helpful how-to on your thread or this one?
[Moto X4 Questions & Answers] KrisM22:
I think I would first try restoring the oldest Persist.

I miss-spoke on "fsg" - that is part of the flash - it's in the zip.

If you never lost mobile, maybe ignore EFS for now.

If you give a troll attention, you give it importance, which is what it wants. If it were interested in learning it wouldn't have posted something like that. If it were interested in helping, it would have done so long ago, since it has so much experience. :)
[Moto X4 Questions & Answers] redwoodie:
Lost mobile each time I flashed a full FW. Usually after 2nd reboot following flash. Wifi goes into connect/disconnect loop, mobile will connect momentarily (status bar icon appears for a few seconds once a minute or so, then not at all--is this how yours behaves?) But I never lost IMEI. There are tons or posts on device forums about lost IMEIs, and consensus seems to think corrupted EFS. Lot of that and suggested fixes on old Samsung and One+ forums c. 2014.

And yeah, let the troll stay under the bridge.
[Moto X4 Questions & Answers] KrisM22:
No, mine is very different. I only notice problem coming back from PixelExperience10: on first boot of stock, no mobile. wifi stays working, mobile is impossible to get until after I restore EFS and Persist. Yes, in your case try EFS and Persist. Possibly Vendor later if needed. Nite!
[Moto X4 Questions & Answers] KrisM22:
One other thought - what would happen if you simply restored that oldest system image for the bad phone? that is, temp boot to twrp, format data, advanced wipe the 3, then restore it. You can always flash -4 on top of that if it works.
[Moto X4 Questions & Answers] redwoodie:
EFS/Persist

Tried restoring EFS, Persist, Vendor/Vendor Image in TWRP. Persist and Vendor failed with a tar fork/error 255 and mounted read only. Phone now has zero connectivity, settings keeps crashing. Fastbooted and erased modems again, wifi is back. I'll try the sim in it and reboot this evening.

Thinking about restoring a backup from the working phone to this one. What could go wrong?

[IMG="skull"]http://icons.iconarchive.com/icons/reclusekc/kulo/64/Skull-0-icon.png[/IMG]
[Moto X4 Questions & Answers] KrisM22:
before you try to restore the backup from the other phone, try to restore the backup from THIS(bad) phone.

---------- Post added at 06:05 PM ---------- Previous post was at 06:04 PM ----------

what could go wrong is you wind up with 2 phones with same imei. this will confuse carrier.

---------- Post added at 06:06 PM ---------- Previous post was at 06:05 PM ----------

but you could just try to restore the Persist from the working phone.