How to really clean my phone before a new flash? - Moto G5 Plus Questions & Answers

Hello everyone.
Usually I just format things through TWRP and flash a new ROM, but I found the following in a Nexus 6 thread:
As to what I usually do for a really clean install (likely overkill):
Reboot to Bootloader
Wipe everything (fastboot erase all)
Do flash-base.sh from latest factory image (this reflashes modem partitions; this is required after erase all)
Boot to Recovery
Wipe everything from TWRP
Reboot to Recovery
Wipe everything again from TWRP (old habit from when the first wipe didn't actually get rid of everything on older devices)
fstrim Data, Cache, System, and Firmware partitions
Reboot to Recovery
ROM
GApps (I don't use GApps, but if I did, this is when they are to be flashed)
Reboot to Recovery
Wipe everything except System from TWRP
Format Data and Cache to F2FS
fstrim Data and Cache partitions
Reboot to Recovery
Kernel
Magisk
Reboot to System
Do set-up and copy files over to device
Reboot to Recovery
Wipe Dalvik Cache (I guess the button in TWRP would work; I do rm -Rf /data/dalvik-cache)
Use filesystem tools to check and repair partitions (e2fsck for ext4 being System and Firmware partitions, and fsck.f2fs for F2FS being Data and Cache partitions)
fstrim Data, Cache, System, and Firmware partitions
Reboot to System
Click to expand...
Click to collapse
Is there anything similar for Moto G5 Plus? I would really like to make a deep cleanup in my phone before flashing a new ROM.
Thanks in advance.

vitorsubs said:
Hello everyone.
Usually I just format things through TWRP and flash a new ROM, but I found the following in a Nexus 6 thread:
Is there anything similar for Moto G5 Plus? I would really like to make a deep cleanup in my phone before flashing a new ROM.
Thanks in advance.
Click to expand...
Click to collapse
Except part 1: flash-base.sh from latest factory image (we have no factory image) you can do everything on the Moto G5+ too.
The question is if that is really needed.
Wiping twice with TWRP isn't necessary anymore but you can do it if you want.
fstrim isn't really needed imo, but you can do it from terminal if you want.
And checking the partitions for errors may be a good thing but if the partitions are faulty you would recognise it when you try to flash anything. But this is a thing you can do too if you want to.
You can find the exact usage of the commands for fstrim and e2fsck and fsck.f2fs by googling for it.
If I want to be sure that everything is cleaned up I wipe all partitions except external SD with TWRP, reformat data (you'll have to do that as the F2FS formatted data partition is encrypted) and flash my usual stuff like ROM, gapps, kernel, magisk etc.
Sent from my Moto G5 Plus using XDA Labs

Related

TWRP fail to mount internal storage

Recently I installed nitrogen os, everything work fine. the problem is when i boot into twrp, it only can mount system and cache. I cannot format data in twrp. I tried to install different version of twrp but the result is the same. Anyone know how to fix it?
This is known, it's some bug in the Oreo builds of some ROM. This method will wipe all your data, including your internal storage: Go to fastboot mode, and type in: fastboot format userdata, then wait for it after that you can flash any ROM again. Good luck :good:
Thx a lot
Internal storage Mount in twrp
Same issue I'm having RR Rom i use

Random names TWRP

Hi, I'm from Nougat 4.5.14 and these are the steps I made:
1. Flash codeworx then reboot to twrp
2. Wipe cache and dalvik
3. Install OS 5.0.2
4. Install magisk
5. Wipe cache dalvik
6. Reboot to system
However after rebooting to system it started bootlooping so I decided to reflash OS and wipe data as recommended. So I power off the phone then hold volume down + power to boot to recovery. However when I boot to recovery, file folders started to become random names like its encrypted. Luckily I backed up my internal storage and data so I'm okay to flash everything but can someone help me how to fix the twrp random file names and the steps for reflashing the OS?
EDIT: I rebooted to recovery, wiped dalvik, cache, and data. flashed OS 5.0.2, wipe dalvik cache, flashed magisk, wipe dalvik, reboot to system and it does not proceed to circling dots. So what I did is just, wipe dalvik, cache, data, flashed OS, wipe again dalvik cache, boot to system and it proceeds to circling dots however it takes so long that I can consider this as bootloop. I'm very tempted to wipe everything (data, system, internal storage, cache, dalvik) then just flash again the OS but I don't know if it would work so I hope someone could give me some steps how to fix this
Edit 2: This is solved now: What I did is just after trying the flash OS with no magisk, I booted to system. However, i just dont boot at all so I decided to boot to recovery again, but this time the recovery is the stock one. I wipe everything I could including cache, system reset, and data (music pics etc) and it booted to the system in no time but everythings lost.
You have to format data... Not just wipe it. From TWRP go to format data, write yes, and let it format everything. Then transfer over to the phone all the fil a you need (ROM, kernel, no verity zip) and flash them as per the instructions of your rom thread. You should be fine.
panooos said:
You have to format data... Not just wipe it. From TWRP go to format data, write yes, and let it format everything. Then transfer over to the phone all the fil a you need (ROM, kernel, no verity zip) and flash them as per the instructions of your rom thread. You should be fine.
Click to expand...
Click to collapse
What I did is just after trying the flash OS with no magisk, I booted to system. However, i just dont boot at all so I decided to boot to recovery again, but this time the recovery is the stock one. I wipe everything I could including cache, system reset, and data (music pics etc) and it booted to the system in no time but everythings lost.
Edit: nvm you've solved it
Peshyy said:
Edit: nvm you've solved it
Click to expand...
Click to collapse
You can still show other solutions as others may need it sometime

Problem installing omnirom android 9 on oneplus 5

i follow the instructions as per omnirom thread... flash the vendor/firmware, wipe data , reboot recovery, and flash the rom, but the omni rom does not boot at all and just shows the OMNI sign on/off. How should i proceed?
Which ROM were you on? What Firmware were you on? Were you Encrypted? Did you only Wipe /Data or did you wipe everything?
Dirk said:
Which ROM were you on? What Firmware were you on? Were you Encrypted? Did you only Wipe /Data or did you wipe everything?
Click to expand...
Click to collapse
Lineageos 15.1 (android 8.1)
I first flashed OOS stock firmware, then OOS, then LOS.
I format data and then wipe dalvik cache, cache, data, system.
datg said:
Lineageos 15.1 (android 8.1)
I first flashed OOS stock firmware, then OOS, then LOS.
I format data and then wipe dalvik cache, cache, data, system.
Click to expand...
Click to collapse
Is your Recovery up to date? I'd recommend the latest Codeworkx TWRP. Did you already have the Vendor partition on your device before attempting to flash Omnirom?
If in doubt flash full OOS 5.1.3 and OTA all the way up to and including 9.0.1. Then reinstall TWRP by fastboot, wipe and format everything and then flash Omni.
Dirk said:
Is your Recovery up to date? I'd recommend the latest Codeworkx TWRP. Did you already have the Vendor partition on your device before attempting to flash Omnirom?
If in doubt flash full OOS 5.1.3 and OTA all the way up to and including 9.0.1. Then reinstall TWRP by fastboot, wipe and format everything and then flash Omni.
Click to expand...
Click to collapse
I still tried, it does not work. My phone got bricked, so I used MSM tool to unbrick and after that I got Nougat 7.1.1. I upgrade my Android to 8.0 (OOS 5.1.3) from system update, and after that update another one came, Android 8.1.1 ( OOS 5.1.7). I then unlock bootloader, flash twrp, flash vendor/firmware, wipe data, flash Omnirom but I get stuck into the omni loading screen. The phone does not load.
datg said:
I still tried, it does not work. My phone got bricked, so I used MSM tool to unbrick and after that I got Nougat 7.1.1. I upgrade my Android to 8.0 (OOS 5.1.3) from system update, and after that update another one came, Android 8.1.1 ( OOS 5.1.7). I then unlock bootloader, flash twrp, flash vendor/firmware, wipe data, flash Omnirom but I get stuck into the omni loading screen. The phone does not load.
Click to expand...
Click to collapse
Okay, i'm not seeing anything about a Format operation there. Wipe does not equal Format. I've just finished setting up Omnirom 9 on my own OP5, so it does work. (Great ROM btw)
Backup everything from Internal Storage to your PC, including all the installation files. The following will wipe your storage!
1) Boot into TWRP
2) Wipe Menu, Advanced, Select all Partitions manually and Wipe
3) Wipe Menu, Format. (Type Yes when prompted)
4) Reboot Menu, Reboot Recovery
5) Copy Installation files from PC to Internal Storage
6) Install Menu, Queue up and install zips in the following order:
i) Vendor/Firmware
ii) ROM
iii) Gapps
7) Wipe Dalvik/Cache when prompted
8) Reboot
9) Set up and done.
Dirk said:
Okay, i'm not seeing anything about a Format operation there. Wipe does not equal Format. I've just finished setting up Omnirom 9 on my own OP5, so it does work. (Great ROM btw)
Backup everything from Internal Storage to your PC, including all the installation files. The following will wipe your storage!
1) Boot into TWRP
2) Wipe Menu, Advanced, Select all Partitions manually and Wipe
3) Wipe Menu, Format. (Type Yes when prompted)
4) Reboot Menu, Reboot Recovery
5) Copy Installation files from PC to Internal Storage
6) Install Menu, Queue up and install zips in the following order:
i) Vendor/Firmware
ii) ROM
iii) Gapps
7) Wipe Dalvik/Cache when prompted
8) Reboot
9) Set up and done.
Click to expand...
Click to collapse
I did it, but I get a bootloop. Omnirom does not boot, it just shows the OMNI logo lights.
datg said:
I did it, but I get a bootloop. Omnirom does not boot, it just shows the OMNI logo lights.
Click to expand...
Click to collapse
The only difference between the two of us that i can see is that i flashed OOS 9.0.1 and booted into it once before doing the steps above.
Don't know if it's relevant but the Vendor/Firmware that i used was 9.0.1 also:
https://drive.google.com/drive/folders/11o0FxZ_rw5lhthGz8_iyYEXBt0dwiv3x
Make sure you nuke everything before starting. Wipe and Format everything. Move installation files across and follow steps.
Dirk said:
The only difference between the two of us that i can see is that i flashed OOS 9.0.1 and booted into it once before doing the steps above.
Don't know if it's relevant but the Vendor/Firmware that i used was 9.0.1 also:
https://drive.google.com/drive/folders/11o0FxZ_rw5lhthGz8_iyYEXBt0dwiv3x
Make sure you nuke everything before starting. Wipe and Format everything. Move installation files across and follow steps.
Click to expand...
Click to collapse
I flashed OOS first and booted everything and I followed the steps and got everything right, but still I get stuck with a bootloop that does not load OmniROM.
Works fine for me;
Flashed the latest OxygenOS. Now you dont need to worry about flashing firmware later in the process.
Enabled unlocking the bootloader in developer menu.
Rebooted into bootloader and flashed the recovery image from clockworkx and booted into twrp recovery.
Wiped everything and formatted data as well.
Reboot recovery.
Flashed rom. I always use sideload but that should not matter. Dont flash anything else; first reboot into your working system.

Techincal Question About Wiping System with Custom ROM

So I've seen with installing custom ROMs that there are steps that basically say, "Do not wipe system" in TWRP. I have noticed in doing things the dumb way that I can wipe every partition but the only way it becomes unrecoverable is if system is wiped, this is even if I install a custom ROM in its place. Can someone help me understand what has changed with A/B partition or OnePlus security settings where OOS system partition must be intact to allow one to run a custom ROM?
The reason I ask is that unless it is a byte for byte overwrite then we leave OOS files on parts of the custom ROM storage partition and if it is bit for bit write why would erasing the partition matter?
What seems more important for custom ROM is to not wipe data before rebooting in TWRP to flash magisk. So a clean flash is now flashing the ROM, flashing TWRP then reboot in TWRP and then only wiping data and art. Then flashing magisk. This is important to keep decryption working. That means not using factory reset feature either, always wiping with manually selected partitions.
Anyway wiping system is useless as the flashing script wipes it anyway.

Cannot fix encrypted data problem

Hey everybody.
I have a problem on the phone and i have been trying to fix it for about 2 days.But no luck.
I had been using MIUI for about 1 year, then i wanted to flash a custom rom.The recovery is orangefox R11.1.On the recovery i wipe cache, dalvik, data and system and i try to flash Pixel experience 9.Also i tried to flash lineageos 16.But the same problem occurs.Just after the flash i clean dalvik and cache.And just for the first boot it says the data is encrypting.I can not escape from it.When i restart it asks for a pin and as you know there is no pin i added, so i can not put it.Then to decrypt the data i have to wipe data again.Then if i flash theese roms the same problem again.
Also i, just after the flashing, before rebooting the phone, tried to delete some lock files on /data/system folder.But unless i reboot there is not a system folder in data.And if i try to reboot it encrypts the folder again.
Is there any fix for that?I am expecting your ideas or helps.Thank you.
Does the rom boot?
Try formatting (not wiping) the data partition. Obviously you'll lose all the data but I think it's the only way. When you change rom on rn7 you have to format data.
darhma said:
Does the rom boot?
Try formatting (not wiping) the data partition. Obviously you'll lose all the data but I think it's the only way. When you change rom on rn7 you have to format data.
Click to expand...
Click to collapse
Thank you very much.I fixed the problem and wanted to share it here to help the others who face the same problem.
-First of all i upgraded the latest version of orange fox.
-I formatted data partition completely.Then i wiped Data, Dalvik, Cache, System.
-I flashed Pixel Experience 9 rom.But an important thing is before i flash the rom i enter options > OTA & ROM settings.And ticked "Disable Forced Encryption".
-Then i flashed the rom and on the line it says "disabling forced encryption".And it worked.Now i use the rom without any problem.

Categories

Resources