[RECOVERY][UNOFFICIAL][TWRP 3.2.1][MOTO x4 PAYTON][7.1.1/8.0]

Search This thread

kraatus90

Senior Member
Sep 2, 2012
406
479
Redmi Note 10 Pro
Device bootloops with Magisk 15.2 flashed either from TWRP or via fastboot on top of a TWRP-ifyed boot image.

If starting from stock Oreo boot image, I can flash the Magisk patched_boot.img and it does boot but has broken wifi just like the SuperSU method. Stuck for now.

UPDATE: Whatever is breaking wifi is not fixed by re-flashing the stock boot.img. Interesting, as other devices have reported the "fix" as flashing a standalone kernel. It seems that on the X4 once wifi is broken by a root method, the only fix is to reflash the entire system partition from stock firmware.

wait even patched boot.img is breaking wifi ? that's weird. im using same method, and wifi is perfectly fine. although i'm on retail moto x4.
 

mightysween

Senior Member
Feb 18, 2011
1,561
1,293
Maine/USA
Moto G Stylus

I see... need to boot all the way through the setup and then drop to bootloader and flash patched_boot.img. I was just flashing it on initial boot after flashing firmware.

Now... can I take the patched image and repack it with TWRP as the recovery, format data, and then reboot with working wifi??? Stand by :)
 

mightysween

Senior Member
Feb 18, 2011
1,561
1,293
Maine/USA
Moto G Stylus
Unbelievable... I repacked the patched-boot.img with the TWRP ramdisk and ended up with a file that BOOTS DIRECTLY TO TWRP. Exactly what I spent weeks trying to accomplish before. Geez. Guess I will hang onto that one.

Anyhow. I tried this: flash Magisk patched_boot.img and boot phone normally/flash TWRP/Format Data/flash Magisk patched_boot.img. When it reboots, the /data partition remains unencrypted but the system is unuseable with constant acore errors and force closes.
 

vivek638

Senior Member
Aug 19, 2013
143
24
Device bootloops with Magisk 15.2 flashed either from TWRP or via fastboot on top of a TWRP-ifyed boot image.

If starting from stock Oreo boot image, I can flash the Magisk patched_boot.img and it does boot but has broken wifi just like the SuperSU method. Stuck for now.

UPDATE: Whatever is breaking wifi is not fixed by re-flashing the stock boot.img. Interesting, as other devices have reported the "fix" as flashing a standalone kernel. It seems that on the X4 once wifi is broken by a root method, the only fix is to reflash the entire system partition from stock firmware.
I think its kernal issue.. if we have a custom kernal maybe we can fix that
 

mightysween

Senior Member
Feb 18, 2011
1,561
1,293
Maine/USA
Moto G Stylus
Updated the OP with my "accidental" fastboot-bootable TWRP image. This opens up a whole new stream of possibilities for testing, so I am flashing back to stock and will try testing some solutions with a temporarily booted TWRP (rather than a modified boot.img).

Of course, there is not much to be done with temporary TWRP as long as /data remains encrypted. But if we can either unencrypt or decrypt, it may become possible to temporarily boot TWRP to make or restore a nandroid, and otherwise leave your system 100% intact for OTAs

---

UPDATE: Partial success... from the temporarily booted TWRP, we are now able to flash SuperSU with working wifi. The bootloader also still recognized the Software Status as "Official" instead of "Modified". This is pretty cool. But unfortunately, whatever magic worked in 7.1.1 to disable forced encryption when flashing SuperSU does not work in 8.0 so the /data partition is re-encrypted on the initial boot.

---

UPDATE 2: Cellular AND wifi radios are still broken by flashing the "RemoveOreoEncryption" ZIP from temporary TWRP. This is a bummer since the ZIP file actually works and provides unencrypted /data. I can't see what is in the binary updater... need to look for source somewhere I guess.
 
Last edited:

Brownstain

Member
Jan 8, 2018
7
10
UPDATE: Partial success... from the temporarily booted TWRP, we are now able to flash SuperSU with working wifi. The bootloader also still recognized the Software Status as "Official" instead of "Modified". This is pretty cool. But unfortunately, whatever magic worked in 7.1.1 to disable forced encryption when flashing SuperSU does not work in 8.0 so the /data partition is re-encrypted on the initial boot.
.

So, if I'm reading this right, I can now flash SuperSU without any other modifications. Would this work with a locked bootloader?

UPDATE: Duh, of course this doesn't work. A locked bootloader won't let you use fastboot boot boot.img
C:\platform-tools>fastboot boot twrp-x4-BOOTABLE.img
downloading 'boot.img'...
OKAY [ 0.699s]
booting...
(bootloader) permission denied!
FAILED (remote failure)
finished. total time: 0.711s
 
Last edited:

mightysween

Senior Member
Feb 18, 2011
1,561
1,293
Maine/USA
Moto G Stylus
So, if I'm reading this right, I can now flash SuperSU without any other modifications. Would this work with a locked bootloader?

Not sure about the bootloader. Mine was unlocked about 3 minutes after I got the phone :)

This works on a freshly flashed system... it does not play well with any other flashes or attempts at flashing, and I am not sure how it will work flashing on top of an existing system. If you decide to do it, let us know if it works.
 
Last edited:
  • Like
Reactions: f3r.and0

kraatus90

Senior Member
Sep 2, 2012
406
479
Redmi Note 10 Pro
Updated the OP with my "accidental" fastboot-bootable TWRP image. This opens up a whole new stream of possibilities for testing, so I am flashing back to stock and will try testing some solutions with a temporarily booted TWRP (rather than a modified boot.img).

Of course, there is not much to be done with temporary TWRP as long as /data remains encrypted. But if we can either unencrypt or decrypt, it may become possible to temporarily boot TWRP to make or restore a nandroid, and otherwise leave your system 100% intact for OTAs

---

UPDATE: Partial success... from the temporarily booted TWRP, we are now able to flash SuperSU with working wifi. The bootloader also still recognized the Software Status as "Official" instead of "Modified". This is pretty cool. But unfortunately, whatever magic worked in 7.1.1 to disable forced encryption when flashing SuperSU does not work in 8.0 so the /data partition is re-encrypted on the initial boot.

---

UPDATE 2: Cellular AND wifi radios are still broken by flashing the "RemoveOreoEncryption" ZIP from temporary TWRP. This is a bummer since the ZIP file actually works and provides unencrypted /data. I can't see what is in the binary updater... need to look for source somewhere I guess.

wait, so i can just flash magisk modules by booting to twrp ? no need to decrypt it ?
 

mightysween

Senior Member
Feb 18, 2011
1,561
1,293
Maine/USA
Moto G Stylus
Was just thinking... if I were to unroot and satisfy the update engine in order to take OTA from 7.1 to 8.0, would I remain unencrypted? Or more directly: will an existing userdata partition be encrypted on first boot of Oreo?
 

rehanraza

Senior Member
Feb 7, 2008
266
65
London
sorry for the off topic query but is it possible to falsh back nougat after flashing oreo?
can't live without root but i can wait for some days while root becomes stable on oreo.
 

mightysween

Senior Member
Feb 18, 2011
1,561
1,293
Maine/USA
Moto G Stylus
sorry for the off topic query but is it possible to falsh back nougat after flashing oreo?
can't live without root but i can wait for some days while root becomes stable on oreo.

Yes, you can flash back.

Root is working fine in Oreo with both SuperSU and Magisk. Use the BOOTABLE twrp in this thread with "fastboot boot" to flash SuperSU, or use Magisk Manager (switch to BETA channel!) to patch stock boot.img and flash it.

I will update root OP with instructions over the next day or two
 
Last edited:

Doranku

Member
Jul 29, 2017
8
1
Backup system image fails

Running the bootable twrp image, and trying to backup all partitions, backup fails for the system image part to an otg device.
Haven't looked into what it is used for, is it needed for full restores?

Device is a xt1900-7 (reteu) running the november update (was stupid enought to update before reading the thread closely)

PHP:
Backing up System Image...
I:Reading '/dev/block/bootdevice/by-name/system_b', writing '/usb-otg/TWRP/BACKUPS/x/1970-01-19--05-28-40/system_image.emmc.win'
Truncating string cache entries.
Truncating string cache entries.
Truncating string cache entries.
I:TWFunc::Set_Brightness: Setting brightness control to 5
I:TWFunc::Set_Brightness: Setting brightness control to 0
I:TWFunc::Set_Brightness: Setting brightness control to 90
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:TWFunc::Set_Brightness: Setting brightness control to 0
I:TWFunc::Set_Brightness: Setting brightness control to 90
Truncating string cache entries.
Truncating string cache entries.
I:Error writing destination fd (Operation not permitted)
Backup Failed. Cleaning Backup Folder.
 

bombaglad

Senior Member
Dec 14, 2014
356
140
27
Bratislava
a little off topic but i have to ask.. has anyone tried flashing the new oreo xposed from this? or do you know any reason why i shouldn't attempt that?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 33
    OFFICAL TWRP RELEASED, this thread is no longer active. 3-30-2018

    https://twrp.me/motorola/motorolamotox4.html


    ---



    UNOFFICIAL BUILDS -- USE AT YOUR OWN RISK AND KNOW HOW TO GET YOURSELF OUT OF TROUBLE IF IT ARISES. I ASSUME NO RESPONSIBILITY FOR YOUR BROKEN THINGS. :)

    UPDATED 01-11-2018
    There are now 7.1 based and 8.0 based builds. Obviously, be careful to select the proper download. While I don't think flashing/booting the wrong one would permanently brick the device, let's not find out :)

    For now I will not be attempting to make data decryption work. It is REQUIRED that you unencrypt your device by formatting userdata, so back up your stuff first.


    IMPORTANT NOTES: TWRP for OREO is a bit of a pain as it currently requires manually editing your fstab. I have tried to automate this process, but it breaks stuff. So just be aware before you begin that it is a rather time consuming process.

    If you make any change to your boot partition after flashing SuperSU, you will need to reflash it or you will get a bootloop.

    8.0 OREO TWRP INSTALLATION:
    OREO SEEMS VERY FINICKY AND DOES NOT LIKE CHANGES TO ITS FILESYSTEM -- BE PREPARED TO REFLASH STOCK.

    0. FLASH OREO FACTORY IMAGE (may work otherwise, but we should be starting from fresh stock here)
    1. Download FASTBOOT BOOTABLE TWRP for 8.0/OREO below
    2. Download SuperSU 2.82 SR5 below
    3. Move SuperSU to external SD or USB OTG
    4. From bootloader, fasboot BOOT TWRP
    5. Flash SuperSU (note: do not format /data now... not necessary and will cause errors on boot)
    6. Reboot system
    7. With any root file editor/text editor (Amaze, Total Commander, etc) open /system/vendor/etc/fstab.qcom as a text file for editing.
    8. At the end of the /data partition entry, delete "fileencryption=ice" and replace it with "encryptable=footer".
    9. Save fstab.qcom (and make sure it is actually saved properly!)
    10. Reboot to bootloader and fasboot BOOT TWRP
    11. Go to Wipe, hit the FORMAT DATA button, and type "yes" to format /data. This will erase your data, obviously:silly:
    12. Reboot system (should now be unencrypted, verify in Settings>Security or by booting TWRP and checking /data with File Manager.

    If you later choose to flash TWRP (not the bootable we used here!), you may need to flash SuperSU again to avoid bootloops.



    7.1.1 NOUGAT TWRP INSTALLATION:
    1. Download current TWRP for 7.1.1 build below
    2. Download SuperSU 2.85 SR5 (https://xdaforums.com/apps/supersu/2014-09-02-supersu-v2-05-t2868133

    3. Move SuperSU to your external Micro SD card.
    4. Fastboot flash the TWRP image.
    5. Reboot to TWRP.
    6. FORMAT data (not wipe...use the "FORMAT DATA" button and type "yes". OBVIOUSLY THIS WILL ERASE YOUR DATA)
    7. Install SuperSU 2.85 SR5
    8. Reboot to system (it WILL bootloop a couple times...don't panic!) and confirm that device is unencrypted by checking that SETTINGS>SECURITY>ENCRYPTION now prompts "encrypt" (don't do it).


    DOWNLOADS:
    TWRP FOR 7.1.1 (Nougat) DOWNLOAD: https://drive.google.com/open?id=1Et-AQgCNx7WDAwzihlI51euUa2ixKHEP

    TWRP FOR 8.0 (Oreo) DOWNLOAD: https://drive.google.com/open?id=1WcVS_3rloF7jxPulj_jKxfsp3zy5pB5N

    FASTBOOT BOOTABLE TWRP IMAGE (OREO BASED): https://drive.google.com/open?id=12ClviqtEjtflB63UQ1CZQNKEqkprBO0u **For temporary TWRP boot using "fastboot boot". Do not flash or you will be stuck in recovery!**


    DEVICE TREE: https://github.com/mightysween/android_device_motorola_payton (NEEDS TO BE UPDATED WITH OREO BRANCH)

    changelog:
    BETA4
    -reverted to 3.2.0 for current build (release candidate rebased to 3.2.1).
    -fixed "format data" button
    -finalized fstab for OTG/SD/INTERNAL mounting
    -target is now UNENCRYPTED devices only (/data decrypt will not be fixed)

    BETA3
    -Rebased to TWRP 3.2.1
    -USB OTG working
    -all partitions mounting correctly
    -considered working except for decrypt and MTP/ADB

    BETA2
    -fixed internal storage mount

    BETA1
    - updated source to TWRP 3.2.0

    ALPHA3
    - Fixed USB mounting (adb/mtp still nonfunctional) BROKEN IN BETA1

    ALPHA2
    - SD Card fixed

    ALPHA1
    - /system is now properly mounted.
    - now plays nice with our working root method.
    - ramdisk is patched to prevent first boot encryption once /data is decrypted (now requires flashable ZIP)


    NOT WORKING:
    adb/mtp/sideload
    /data decryption (abandoned -- /data access requires unencryption)

    CREDITS: @kraatus90 for kernel fix, @Chainfire for SuperSU, @jcadduono for no-verity-opt-encrypt scripts.



    ---
    19
    Well, all attempts to make this work are still leading back to the exact same issue: /data decryption does not work. It is possible to format userdata and remove encryption, but it returns on the first boot of the system, and attempts to change fstab to prevent this have been unsuccessful. The only other SDM660 device with working TWRP is one that has a separate /recovery partition (lucky!).

    I have tried dozens, maybe hundreds of "fixes" with virtually zero change from the first day I booted TWRP on the X4. I am quite certain that the solution requires starting from 100% stock, booting a temporary recovery (fastboot BOOT), and using a ZIP installer to inject the recovery ramdisk. With that method apparently unavailable to us, we are simply stuck.

    I will be putting further work on TWRP on hold for now... not because I don't think it can be solved, but because I would rather work on other things that can help us solve this problem indirectly. For example, building out a Lineage based ROM with a custom kernel (maybe even the latter alone) will allow us to avoid the forced-encryption issue and at least have fully working TWRP for custom ROM uses.

    I will probably take one last look at what I have, clean up some stuff and push a final beta build. If a temporary-boot solution becomes available, I already have compiled a flashable ZIP file for our device.

    Going to shift now to using my limited spare time to build out the proprietary files and vendor tree. This is what we really need in order to jumpstart custom ROM development. I may also make a custom stock-based flashable ZIP (there is nothing stopping us from using TWRP to flash ROMS !)

    ---
    14
    I think moto x4 is not that popular rit now. But i can definitely say that its a best budget phone in sub 20k.. But nowadays only people are getting attention of 18:9 ratio phone. Whether it have something good inside or not.. Atleast in india i am not seeing any phone which comes close to this device with this much specs n ip68...

    I have two people from India helping me on development, which is great! Once TWRP is fully functional for all variants, we will see increased interest in this device. Went through this with the original Moto G 3-4 years ago... took us forever to get all unlockable variants built. But that old device has TWRP and bleeding edge custom Oreo support now. This device will be a great one to hold onto in the long run.

    Still struggling with the final stage of TWRP implementation... as are many other newer A/B devices. I feel like this is the week (though I have felt that way for a month) :)
    11
    Hi guys i built new TWRP, oreo and N with encryption
    img : https://androidfilehost.com/?fid=962187416754469184
    installer zip : https://androidfilehost.com/?fid=746010030569962775

    please try if everything worked i'll go for official

    ****** Don't swap slots if you don't have firmware on your slot B, this will brick the device and you have to use blankflash to unbrick

    Tree : https://github.com/erfanoabdi/android_device_motorola_payton
    11
    Not having much luck preventing forced encryption on first boot. Looking at some other devices that are taking this route, and the same fixes for those do not seem to apply to us.

    In other news I did get USB OTG working again in my latest build, and I have been in touch with a couple other people who are interested in both helping get TWRP decrypt fixed and working out the rest of the tree/blobs for building LineageOS.