yashsingh1/xdaforums huggingface dataset:
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] IronTechmonkey:
Thank you for the information you've shared, including the helpful video which seems to be yours. Although I (and others) are still trying to figure out the ramifications of the flashing method in different scenarios but your information is indeed helpful regarding the process of flashing. That being said and with apologies for "punishing you for your kindness" (aka "brazenly asking more").

- Can we create and restore nandroid backups with the version of TWRP on the device without breaking TWRP on device?

- If we never use the built-in updater can we clean flash a newer LOS build from TWRP on device without breaking TWRP on device?

Also, for what this is worth regarding A/B & seamless updates in stock: My recently purchased X4 (XT1900-1) which had Oreo 8.1 pre-installed did receive seamless OTAs, so to your point that change seems to have been made. Thanks again for the helpful information.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] munchy_cool:
No idea about TWRP nandroids.

to flash a newer build of los and keep twrp, you need to flash twrp zip after los + gapps zip. just like you initially flashed los. only difference is this time it can be a dirty flash and you dont need copy partitions zip file.

why we need to flash twrp zip?

the answer to that is, on ab devices recovery is part of boot.img. so, whenever you flash a new kernel or rom you have to flash twrp zip as the zip file patches boot.img, removes stock recovery and inserts twrp recovery.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] Ultramanoid:
So you're confirming it is not possible to have a persistent TWRP in A/B devices like this one without carrying a computer around at all times ? ( Seems insane to me, but not surprising the way Android's going lately. )

Edit : Is there some partition now where TWRP could be flashed and booted from, as when we did that in old SONY devices with FOTAKernel, because they did not have a recovery partition ?
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] munchy_cool:
just keep the twrp installer zip file handy. or you can just build los with twrp instead of stock los recovery if its too much of a pain for you.

ps:- los recovery works fine as well.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] Ultramanoid:
To build Lineage you need a computer too. Last time I checked Lineage's recovery was almost useless. Admittedly it's been quite a while since I've used it.

Is it possible now then, with the X4 only, no computer anywhere :

0. Running Lineage and having TWRP...

1. Flash a new Lineage build with TWRP in-device.

2. Reboot to Lineage recovery.

3. Flash TWRP with Lineage recovery in-device.

4. Back to 0... ?
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] munchy_cool:
like i said before, you can flash twrp zip right after you flash los update zip ..twrp has an option for add more zips use that.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] IronTechmonkey:
Just FYI, may be missing a key point about what I and [MENTION=4004386]Ultramanoid[/MENTION] (who I do not speak for) seek, perhaps I've because not explained enough of the reasons why it is being sought. I was in the process of writing an explanation of just that when I saw the quoted post above and will finish that reply shortly.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] munchy_cool:
and what key point is that?

you are thinking too much about something simple and easy. and trying to understand a lot of it by theory, sometimes you need to try it practically to understand it.

if you are expecting ab devices to act like a only devices, then that is not happening. a only devices have a separate recovery partition hence they can keep persistent twrp. ab devices dont have a recovery partition, hence you need to flash twrp zip from within twrp after every rom and kernel flash. doesn't get any simple than that.

---------- Post added at 08:20 AM ---------- Previous post was at 08:18 AM ----------

no there is not, and that is what you are NOT understanding. ab devices DONT have a separate recovery partition like a only devices.

You have to flash twrp zip from within twrp after rom/kernel flash if you want to have persistent twrp.

reason for that :- already explained in previous reply.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] IronTechmonkey:
Mind yourself. Take that snark and put it back in your pocket.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] munchy_cool:
what do you mean? i just told you to try it practically to get a better understanding and you tell me not snark.

how about you mind yourself , i am trying to help you and explain stuff to you and this is how you respond?

Edit

done explaining stuff in this thread.

people on the internet get offended way too easy these days. time for me to bounce from this thread and mind my own business, and do something better rather than helping strangers on the internet.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] Ultramanoid:
I am trying to decide if I should buy a few of these devices, one for myself. It's quite a bit of money. We need to know first if it is possible to use them, flash them, fix them, restore them, _without any computer available at all_, when working out in the field, so that's why all the discussion.

Maybe you're too young to remember the old SONY FOTAKernel procedure. ( No offense intended. ) SONY did NOT have a recovery partition either. At all. Boot was bundled with the kernel.

Still nobody said if this can be done in-device without a computer or not. A simple yes or no would immediately end the conversation.

(っ´▽`)っ
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] IronTechmonkey:
I do appreciate the time you spent but, without understanding the reasons for the questions (which you summarily dismissed) you re-explained the mechanics of AB (which I said I already understood) and declared that it is other people who "are NOT understanding". You summarily dismissed a very popular and long running method of flashing which countless people have used for many years because of its very notable benefits. If people exploring options regarding maintaining or moving away from that long popular method of flashing (which you seem not to value) is a problem for you then by all means take a break.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] gee one:
Step 1 and 2 will replace the installed TWRP with whatever recovery is in the los boot.img (los recovery).

You would have to flash the installer right after flashing the ROM, or install twrp into the ROM manually before flashing. The first option is easier for most.

A/B devices don't have a dedicated recovery. If you want to boot to recovery, the bootloader boots the boot.img and used the ram disk inside. If you want to boot to the system, the bootloader boots the boot.img, but skips the ram disk and instead mounts the system partition to the root mount point.

In the past, and with other Linux systems, the ram disk or initrd, would have a skeleton file system that the root file system was overlaid on top of.

I have a corner use case, and I repack the boot.img myself, similar to what the trwp installer does. After flashing the ROM, I use adb to replace the boot.img that was just flashed with my own. If I were a better programmer, I would just use the build system to do the installation for me. The point here us that 99.99% of the time, keeping trwp is a 2 step process.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] munchy_cool:
ok. let us try to cover a soft brick scenario for you then.

we have 2 slots, a and b.

lets assume right now you are on slot a, and you have twrp (remember twrp zip is flashed on both slots).

you need to update. so you download latest los and flash it from twrp and you forget to flash twrp zip and end in a soft brick or a bootloop.

is it possible to fix it without a computer? if stock los recovery lets you change the slot, then it is possible.

how?

well, once you flashed los update and forgot to flash twrp zip, your slot changed to b as rom updates are flashed to inactive slot.

slot a still has twrp recovery and old build of los. if you can change slot to a from los recovery then you will be able to boot back into twrp, and either boot into old los build, or flash new los build and this time dont forget to add twrp installer zip file.

all of this is based on whether los recovery allows you to change the slot or not. i can check for you in a few hours once i am near my moto x4.

let me read up on sony thing and see if this is something similar. i owned only one sony device and i dont know about it, but i will read and let you know if this ab thing is similar to what sony did.

---------- Post added at 09:16 AM ---------- Previous post was at 09:11 AM ----------

what method are we talking about here? if you are talking about a nandroid backup, then i just said i have no idea about it because that is the truth. i dont know if nandroid backups work on moto x4 or not. i did not dismiss them. if you read my previous reply about changing slot from los recovery (if its possible) then that might be solution to a soft brick (if that is your concern). if not, then let me know your concern and i will try to help if i can. if i dont know about it, i will tell you i dont and that doesnt mean i am dismissing it.

---------- Post added at 09:24 AM ---------- Previous post was at 09:16 AM ----------

so i read about Fotakernel thing here.

https://twrp.me/sony/sonyxperiazl.html

and ab devices have same thing. if kernel devs/rom devs build roms with twrp recovery then we will not have to flash twrp installer zip after every rom/kernel flash but unfortunately that is not the case.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] IronTechmonkey:
Not nandroid backup. I did see your answer about that (thank you) and figured that once I sort out the initial flash I could test and report about attempts to backup/recover on device, then share that back to the thread. The "method" to which I referred is the all on-device flashing method which I seek (but now know probably will not find). Just to describe a few real world scenarios to which that method is critical:

- Re-flash (full clean flash) work device in driver's seat of truck during lunchtime.

- Work on devices at locations where access to a laptop with proper ADB/fastboot is not assured, such as at a client site.

- Simultaneously flashing multiple devices at once (I call this "flash racing").

- Working in locations off the grid where laptop battery life is at a premium or laptop is not present.

- Others.

BTW, Although I might not not retract anything I said I could also have used a different tone, and I do appreciate your willingness to regroup the conversation. When one person manages to do that others follow.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] HACK3DANDR0ID:
Is it normal to loose TWRP after doing the LOS OTA?
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] gee one:
In most cases, if one slot is unbootable, the bootloader will switch to the other slot after 7 tries on the unbootable slot.

If you have root access, I think you could install twrp to the boot partition from the recovery or the system itself. Again, it's easier just to flash the twrp installer.

I haven't had much luck switching slots manually in twrp. The flash then switch logic seems to work automatically for flashing. It was also working in the los recovery on 15.1, but in 16.0, it seems to be the aosp recovery still, not los. It might still work automatically in the aosp recovery, but I haven't tested.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] Ultramanoid:
It's all my fault, folks.

Too insistent, I apologize to everyone.

Thanks for all the answers.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] munchy_cool:
right now, los build come with stock android recovery. los recovery is work in progress. and stock android recovery cannot change slots.

so, if you are in a situation where dont have twrp, and no computer and your phone is in a bootloop or soft-bricked nothing you can do about it without a computer (unless a factory reset from stock recovery fixes it).

or if what [MENTION=2790198]gee one[/MENTION] said works, and after 7 unsuccessful attempts the slot changes to the one which has twrp, then you might be in luck.

cc [MENTION=4004386]Ultramanoid[/MENTION]
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] edufur:
I tried this on 2 vehicles and neither work. This has always been a problem. Am I the only one who has concerns with this?

I am attaching a logcat that I think identifies the errors happening at the time I tried to have the AA engage. How can I get some real attention on this? This seems to be a USB device issue.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] IronTechmonkey:
Yes that scenario requires a computer but no-one in this discussion who is seeking to be able to flash, backup, restore on-device has asked about that, nor does that have any bearing on our quest for on-device flash via TWRP. With a ratio of hundreds of successful on device flashes, backups and recoveries to 1 softbrick 6 years ago which would never have occurred in the field, the possibility of a brick is not a compelling reason to bring the laptop everywhere, so again: The scenarios where on-device flashing is critical are the following.

- Re-flash (full clean flash) work device in driver's seat of truck during lunchtime.

- Work on devices at locations where access to a laptop with proper ADB/fastboot is not assured, such as at a client site.

- Simultaneously flashing multiple devices at once (I call this "flash racing").

- Working in locations off the grid where laptop battery life is at a premium or laptop is not present.

- Others.

Since I've already got the device I may end up trying this and would share what I learn if and when I get to that point.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] Ultramanoid:
I've read and re-read all the posts, thanks a million.

I had the SONY ZL myself, and several other Z models after that. It's interesting that we're repeating history with A/B. SONY did not have a recovery partition, boot was bundled with kernel.

So there were two solutions to have a persistent TWRP always in-device. One was, CyanogenMod developers ( or users, and yes, it was long ago, before Lineage ) could build the kernel with TWRP bundled and some did that. Or, more commonly, we could flash TWRP to the FOTAKernel partition. Then we would actually have two recoveries, the kernel boot one, and TWRP in FOTAKernel. Different hardware button combinations would boot in one or the other. The boot would change with every CM build and kernel, but TWRP would always persist in FOTAKernel.

It'd be great if the second solution we used then, finding an unused partition we could use for recovery when there is no recovery partition, could be done in the X4 or all A/B devices. Must research this a bit further.

Anyway, sorry for the history lesson.

From what I read then, in a normal case scenario, with :

1. An X4 running Lineage with TWRP and the twrp.zip always available in the device.

2. Flashing the twrp.zip always _immediately_ after flashing a Lineage build, to reinstall TWRP, before rebooting..

... Assuming no problems, no computer would be needed in this case. Correct ?

If there are issues or problems, then a computer and adb will be required, I gather. Multiple cases that we've talked about...
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] gee one:
Yes, as long as the flash goes OK, no computer would be needed.

That being said, this phone has been a little temperamental with updates and flashes. I think there were USB issues with the stock OS. Even with LOS, there was one update that required blankflash to recover. That was due to changes in the bootctrl source. So, the x4 might nit be an ideal candidate for your use case, although I'm not sure I could point to a clearly better one.

The A/B partitions are just getting some forward movement. It's been around since marlin/sailfish? but the development was stalled until devs figured out what to do with it. So this is relatively new for the android world. Things like verity and verified boot only add to the complexity.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] munchy_cool:
I am sorry, but i am unable to understand these scenarios, but from what i understand

full clean flash - as long as you flash twrp zip after flashing a rom zip or kernel you should be good. if a format data is needed then it is advisable to download twrp installer zip again and keep it in internal storage after you have booted into android.

if by full clean flash, you mean going from stock to custom, then yes you need a computer.

---------- Post added at 11:26 AM ---------- Previous post was at 11:23 AM ----------

due to how they designed seamless updates (ab slots) i dont think we have a partition which can be used to flash a second recovery so as to avoid flashing twrp zip right after rom and kernel flash.

and your assumption is correct. assuming no problems. also, once you have twrp you can change the slot from twrp and boot into old slot which still has older version of los in case things go bad with the update.

---------- Post added at 11:28 AM ---------- Previous post was at 11:26 AM ----------

yeps, bootctrl from nash (z2 force) was corrupting the partition table (we had this issue when we initially porting los).

solution was to manually flash partition table (gpt.bin) manually

the issue has since been fixed and ota's are working fine now.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] IronTechmonkey:
They are "The scenarios where on-device flashing is critical", hence the reasons for the quest to be able to continue flashing ROMs without computer. i.e. The background reason for the questions.

That sounds like it could work in my case. I might keep the twrp.zip on external and copy it to internal when needed or have copies both places.

Apologies, there was a lack of clarity on my part. I'm so conditioned by false claims of clean flash (not in this thread) that I've taken to using phrases such as "true clean flash" or "full clean flash" which are meaningless to people who know what a clean flash actually is. You can take that to mean just clean flash. The transition between stock and LOS happens rarely, sometimes only once from stock to LOS so having to do that on the computer is not so bad. Thanks again.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] munchy_cool:
for an on device clean flash, keeping a copy of twrp installer zip in the microsd card and ensuring that you flash twrp installer zip after flashing/updating a rom/kernel will work.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] Ecthelion3:
I'd also be interested in a solution. I had the same problem, with the system on the car reporting some USB error. I hope your logcat gives the developers some helpful insights, so that the problem gets easier to fix.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] IronTechmonkey:
You may (or may not) have an actual LOS bug there, which got buried under all the flashing discussion (apologies). The log is a good start (not that I see the answer in it). If you are convinced this is an LOS issue and can reproduce it in clean flash then it's probably worth creating a full bug report at LOS GitLab (LOS' official problem tracking system - formerly LOS Jira) https://gitlab.com/LineageOS/ and sharing the details here at XDA.

The bug report would include :

- Details of the device: Model #, specific builds of LOS, Gapps, SU, storage and other details where pertinent.

- List of exact steps that someone else could take to reproduce the issue.

- A log captured while you reproduced the issue.

The benefits of filing the report at LOS gitlab as well as here is that the issue may then be exposed to more developers and more users who might be able to reproduce it (helpful for unique usage cases) and can be voted on by users, and is tracked by LOS. For universal issues (not device specific) this can save individual maintainers some efforts. The benefits of sharing a full report anywhere is that you'll have a better chance of engaging the developers.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] ajayankg:
Google Pixel Launcher bundled with the ROM is always crashing.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] edufur:
Please go to my logged bug and give it a me too... That might get the ball rolling.

https://gitlab.com/LineageOS/issues/android/issues/397
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] jtnc:
Thanks, I had been wondering if you could just flash them serially like that in one TWRP session. Definitely used that capability on my old S3 all the time.

John
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] gillyboatbruff:
After moving to LOS 16 from stock, Google Assistant does not work when the screen is off. It is set to work with lock screen. Any thoughts on getting this working?
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] maxawesome:
What an absolute cluster****. An OTA for Lineage 16.0 from the March 3rd nightly to the March 20th nightly has completely hard-bricked my device. I know, I know. There's a disclaimer for a reason, but FFS, who would expect this kind of volatility this far into the life of this OS??

I guess I'm glad I only paid $130 for this device, because it won't even power on now, and none of the solutions posted here are even possible to attempt because the device doesn't respond to anything.

I guess this will be the last time I ever **** with LOS again. I guess the good old days of CyanogenMod are truly behind us.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] Ultramanoid:
Android is a clusterckuf, to be perfectly honest. And with a million device / version / developer combinations is quite a miracle anything works at all.

Edit : Wish I could find the X4 for 130 USD, cheapest I've found is 300 !
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] gee one:
Look for the blankflash files and use that.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] IronTechmonkey:
Although I'm unable to reproduce and confirm the issue (not in position to test) I checked the ticket to see if it could receive "votes" or "watches" and noticed it was rejected (automatically by a bot). The ticket is missing the device name which for Moto X4 is "Payton". Additionally, if not already required it is good to also include the model # eg XT[whatever].

Don' be discouraged by this. Unlike XDA where we chat a good bit (sometimes too much, mea culpa) LOS gitlab is all business and wont accept reports which don't include accurate details and logs. The fact that your ticket quickly got 2 other reports of same issue may indicate a genuine bug. If double check the instructions they referenced and add the missing detail they will re-open it. In any event thanks for taking the time to make a real bug report.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] edufur:
It was auto-closed in the beginning of the ticket due to that fact, but I added the device name and reopened it. It appears open to me at the moment, but that should have been something you noticed. So am I looking at it wrong? Is it closed or open?
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] IronTechmonkey:
Ahhh, yes, the ticket was re-opened. I missed that - Reasons but no excuse, that was the first time I've ever been in the new system which is different from the old Jira system. Thanks.
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] ungoogler:
Could anyone help me with my network connectivity woes? I installed the latest nightly on xt1900-2 and I hardly have any LTE (Carrier: Jio 4G) reception and mobile data hardly works with abysmal transfer rates... any help would be really appreciated!
[Moto X4 ROMs, Kernels, Recoveries, & Other Develop] gillyboatbruff:
The current nightlies have the March security patch already. If I choose to go back to stock, do I have to wait until there is one released with March's security patch, or can I go back to an earlier security patch?