[GUIDE] Backup EFS Partition Without A Decryptable TWRP [No Root Required] - OnePlus 7T Pro (Regular & McLaren) Guides, News...

As there is no decryptable TWRP, it isn't as easy as before to bakcup the EFS partition. But doing it via Terminal isn't too difficult. I didn't find a good tutorial that isn't burried somewhere on the internet. And none for the 7T Pro (though the commands and partitions are the same on older OnePlus devices.
If you already know how to boot TWRP or you already have it, go to the second instructions list and skip the first one.
I am not responsible if anything goes wrong. You do this at your own risk!
Requirements:
- An unlocked bootloader
- Working adb and fastboot (e.g. Google's Platform Tools)
- Download a bootable TWRP
Instructions to boot TWRP:
- Connect your device via USB
- Go to Settings > Developer Settings > Enable Advanced Reboot Menu
- Hold down the power button and select "Bootloader"
- In the bootloader use (It won't modify anything, you simply boot into TWRP once and after a reboot it's "gone".)
Code:
fastboot boot NameOfTWRPImage.img
Instructions to backup EFS:
If TWRP has booted, type the following into your computers' terminal one after the other:
Code:
adb shell
dd if=/dev/block/sdf2 of=/tmp/modemst1.bin bs=2048
dd if=/dev/block/sdf3 of=/tmp/modemst2.bin bs=2048
exit
adb pull /tmp/modemst1.bin modemst1.bin
adb pull /tmp/modemst2.bin modemst2.bin
This will copy modemst files to the temporary folder on the phone (which can be accessed though the data is lost after a reboot) and "adb pull" copies them from the device to the user's profile folder on Windows or Mac. You have successfully backed up the EFS partition!
Please note that this could be performed with root permissions on a booted device. Though I always prefer backing up files with a non-booted system. Also this guide will work if you're not rooted.

Is it possible to backup all system and data so we dont have to setup everything in the device after a factory reset? I mean, that backup we all were used to in TWRP.
Best regards

lucfig said:
Is it possible to backup all system and data so we dont have to setup everything in the device after a factory reset? I mean, that backup we all were used to in TWRP.
Best regards
Click to expand...
Click to collapse
Unfortunately not. Backing up EFS doesn't require decryption as it's not stored on /data. Everything on /data can't be backed up afaik.
Also /vendor and /system can't be mounted as of now making a Nandroid backup impossible.

Macusercom said:
Unfortunately not. Backing up EFS doesn't require decryption as it's not stored on /data. Everything on /data can't be backed up afaik.
Also /vendor and /system can't be mounted as of now making a Nandroid backup impossible.
Click to expand...
Click to collapse
Thanks.
That is a shame. At least titanium backup still working great.
Enviado de meu HD1903 usando o Tapatalk

Macusercom, thank you for the guide!
Now how do we restore them? With the opposite dd command?
Or we can just flash them directly via fastboot?
Also, what is the full list of partitions which contain data unique to this specific device?
I mean all these EFS, persist, IMEI, screen/touch calibration data, all sensors factory calibration data, fingerprints, etc.
Is it only EFS + persist or there are more of them?

Related

Will a Nandroid restore undo my ROM upgrade?

I wouldn't think so, but I'm really clueless about what's going on...
I have Cyanogen 3.9.8
I want 4.0.2
When I use the CM Updater, I get the dreaded acore Force Close.
So I try the manual approach, putting the 4.0.2 zip file on my SD card's root, then I reboot into recovery, and I perform a Nandroid backup (I run Linux on my computer, and don't use ADB).
Then I do a wipe, before I install the 4.0.2 zip.
Finally, I do I Nandroid restore.
Rebooting takes a long time, which tells me something has been done in the ROM department.
But when I have it up and running, everything seems just as they were before the operation, and when I start CM Updater it says "Running version: CyanogenMod-3.9.8"
I tried again, this time I booted the phone before I did the Nandroid restore, was met with the "factory fresh" Google account login screen (so it looked wiped to me...), then did a reboot to recovery and a Nandroid restore, reboot, checked CM Updater: "Running version: CyanogenMod-3.9.8".
Maybe I need to tweak my ROM updating routines..?
I have 3 partion SD card, so apps2sd is running.
Any help is highly appreciated.
Thanks,
Christopher
I'm kinda confused here, it's Monday morning. Since your trying to upgrade why do you keep doing a nandroid restore? You only want to restore nandroid if you want to go back to that previous point when you made the restore point. If you are just upgrading, just upgrade without restoring nandroid.
do exactly what you did without doing the nandroid restore at the end
Nandroid Restore is pretty simple.
Say you have ROM1 installed and there is an experimental ROM2beta out. So you want to try it.
Do a nandroid backup and it saves it to your sdcard.
The files that are saved are:
recovery.img
data.img
system.img
cache.img
misc.img
boot.img
This is almost every part of your phone except the spl and radio.
When you do a ROM upgrade MOST of the time it only updates the system and boot (some ROMs like Hero wipe/update the system, data, cache and boot.) But if your going from Cyan1 to Cyan2 then the only things being changed are system.img and boot.img. Unless you wipe, everything else should remain the same.
With all that said... you flash from ROM1 to ROM2beta and then do a restore from the ROM1 backup. So what does that mean for your phone? Is it possible to have ROM2beta ROM with the ROM1 system.img and boot.img? No. Since system.img is restoring the key elements for the ROM1 over your newly flashed ROM2beta. Bottom line. You'd be right back to where you started.
Binary100100 said:
With all that said... you flash from ROM1 to ROM2beta and then do a restore from the ROM1 backup. So what does that mean for your phone? Is it possible to have ROM2beta ROM with the ROM1 system.img and boot.img? No. Since system.img is restoring the key elements for the ROM1 over your newly flashed ROM2beta. Bottom line. You'd be right back to where you started.
Click to expand...
Click to collapse
Which explains what I am experiencing.
Thanks, 36!
That means I have misunderstood what Nandroid does.
I thought it would just take a backup of "user changed" files, like application data, configurations, call logs, that sort of things - like MyBackup Pro, more or less.
Guess I will get back to using MyBackup Pro before I upgrade my ROM.
Thanks, this really clarified things - I'm sorry I had to post such a n00b question, but I haven't found any other Nandroid postings telling me in such details what Nandroid backs up (and restores) - but then again I probably haven't looked hard enough! ;-)
~Christopher
Seems I had the same misconception and it seems that Nandroid is not nearly as useful as I had been led to believe by all the posts harping on about it. What I want is a backup of all my user data which I can restore to the updated ROM. Luckily I suspected Nandroid wasn't going to do this and used MyBackup Pro too
MikLSP said:
Seems I had the same misconception and it seems that Nandroid is not nearly as useful as I had been led to believe by all the posts harping on about it. What I want is a backup of all my user data which I can restore to the updated ROM. Luckily I suspected Nandroid wasn't going to do this and used MyBackup Pro too
Click to expand...
Click to collapse
nandroid can do this you just have to do a backup flash youre rom then push youre data.img
I understand you push the data.img but.....
how...
please
Perform a nandroid backup
Locate the backup on your sdcard under the foler "Nandroid"
Navigate to the last folder (this should be your latest)
Copy all or at least the folder that you want to push back (in this case just data.img to a directory say c:\nandroidbackup)
Open the cmd prompt and make sure that you have your fastboot.exe file in your pc's system32 directory.
If your phone is already on type "adb shell reboot recovery" in the cmd prompt to get to the bootloader and ready for FASTBOOT and then type "exit" to quit the adb shell.
If not then power on your phone while holding the camera button to get to the bootloader and then press the back button on your handset to get to FASTBOOT mode.
On your cmd prompt type "cd" along with the location of the data.img file (example cd c:\nandroidbackup) to move the command prompt to the backup location.
On the cmd prompt type fastboot flash userdata data.img and hit enter.
You should see "sending" followed by "writing" once complete type fastboot reboot and hit enter.
That should do it.
Now mind you that pushing your data across different builds may not work. If you are trying to restore your data on Hero that was previously saved from Cupcake then you're wasting your time. And vice versa. Always store a backup or two on your pc for quick and easy access in case something doesn't work.
In the event that it does not work simply wipe and follow the above directions to restore.
fastboot flash system system.img
fastboot flash userdata data.img
fastboot flash boot boot.img
Thanks great thanks mate!!
On the cmd prompt type fastboot flash userdata data.img and hit enter.
Click to expand...
Click to collapse
This step fails for me during the "verifying signature" phase. I believe this is todo with my spl.
Is it possible to use adb to do this? or will the spl still prevent it?

[Q] How to properly make a total backup of your current ROM

I have a very decent working ROM at the moment (4.4.4 rooted xposed gravitybox etc.) and I'm not sure I can live with Lollipop without al those tweaks. So before upgrading to Lollipop (whenever that may be), I want to make a decent backup of my current ROM.
Normally I would do this with TWRP, but the backup doesn't seem to work at the moment. And there doesn't seem to be a properly working version of TWRP.
So how do I make a proper backup of my ROM?
Adb?
A confirmed working version of TWRP?
CWM?
Another?
Jeltel said:
I have a very decent working ROM at the moment (4.4.4 rooted xposed gravitybox etc.) and I'm not sure I can live with Lollipop without al those tweaks. So before upgrading to Lollipop (whenever that may be), I want to make a decent backup of my current ROM.
Normally I would do this with TWRP, but the backup doesn't seem to work at the moment. And there doesn't seem to be a properly working version of TWRP.
So how do I make a proper backup of my ROM?
Adb?
A confirmed working version of TWRP?
CWM?
Another?
Click to expand...
Click to collapse
You can use standard tools installed on the phone to dump your partitions. See here for a rundown. I'd recommend backing up /boot, /recovery, /system, /pds, /modem and /fsg.
Ah yes, that's what I was looking for. Thanks
When I restore the mentioned items, will I get back my old installation? Or should I backup more? i.e. userdata for example?
And how to restore all these items? (I know to flash the boot, recovery and system.img via adb).
Yeah, you'd need to backup the data partition too, if you want to keep settings and user data. Remember, dd produces a 1:1 copy of the partition... I prefer to backup personal data selectively. The quick way to do it is by using a backup app: Most use Titanium Backup, but I find Chainfire's Helium does the job well, too. The other way is to use the built-in 'backup' command directly to select a range of files to save (i.e. 'adb backup')...
The partition images can be restored from adb using the reverse version of the command you used to make to the backup, i.e. use dd but with the 'if' and 'of' parameters switched:
Code:
dd if=/path/to/source.img of=/path/to/block/device
Be careful though; if you write the wrong image to the wrong partition, you can damage -- or even hose -- your software environment.
In the case of most partitions, restoring images should be done whilst booted into recovery for safety reasons, rather than overwriting a filesystem whilst it is mounted and in use. If you have the stock recovery installed, you can temporarily boot into TWRP or CWM recovery from a recovery image stored on your computer (i.e. 'adb boot /path/to/recovery.img') and then enable adb from within the custom recovery environment. Then you just use 'adb shell', followed by the 'su' command to switch to the root user account.
For the same reason, you should write the recovery partition backup back to disk from adb within the normal android environment. Again, you must do this after switching to the root user account by issuing the 'su' comand.
Alternatively, you should be able to write all the images from fastboot mode (i.e. 'adb reboot lootloader'). For example:
Code:
adb fastboot flash recovery recovery.img
AFAIK, fastboot will accept standard images created with dd, but I have never tried it on a Moto G, so YMMV... Maybe someone else would care to comment on this?

[RECOVERY][Huawei P7][Unofficial TWRP Recovery 3.0.3-0]

Hi everyone.
Here's my build of TWRP 3.0.3-0 for Huawei P7.
Features:
Supports USB OTG, so you can use USB flash drive as external storage for backups, zip installations.
Added feature to make backup/restore of internal storage.
Added feature to make backup/restore of oeminfo partition. This partition contains info about vendor and current installed version. So in case if you want to rollback to 4.4.2, for example, or revert back your previous vendor version, you can just restore oeminfo from backup with 4.4.2 version or other vendor and flash appropriate firmware without flashing transition package, vendor and without getting "cust fail" error.
Combined with stock EMUI 3.1 recovery. In case of power-on by holding power + vol+ or rebooting into recovery by command or any 3rd party application: will boot in TWRP. In case of local update, OTA-update, factory reset from menu or "force update" (3buttons method): will boot into EMUI recovery. Thus you don't have to flash stock recovery before OTA-update, flashing official firmware or doing factory rest.
Off-mode charger updated from EMUI 3.1 (for 4.4.2)
custom.bin and cust symlinks are saved/restored (if they were exist) in case of Wipe/Format Data. So there is not gonna be "cust" issues after factory reset in TWRP.
Excluded SuperSU from build.
Enabled encrypted data support.
Screen lock by power button replaced with screen off.
Requirements:
Unlocked bootloader
Android 4.4.2 - 5.1.1
Installation:
Reboot in fastboot mode
Flash image via fastboot
Code:
fastboot flash recovery TWRP_P7-3.0.3-0.img
fastboot reboot
From TWRP: Press "Install" and select zip-archive
Notes:
Because internal storage is not a separate block device and just a subfolder of "userdata" partition, before you can make backup/restore of internal storage, first you should do Mount -> Data.
Download: TWRP_P7-3.0.3-0.img
For TWRP: TWRP_P7-3.0.3-0.zip
Previous:
Download: TWRP_P7-3.0.2-0.img
For TWRP: TWRP_P7-3.0.2-0.zip
Download: TWRP_P7-3.0.0-0.img
For TWRP: TWRP_P7-3.0.0-0.zip
Thanks for supportion the P7 devices, greate job
Is it possible, to restore 2.8.7.0-backups?
pokko said:
Is it possible, to restore 2.8.7.0-backups?
Click to expand...
Click to collapse
I can't tell you for sure about backups made by araca's 2.8.7.0 - I don't know his partition layouts and backup naming method, but if you were using my build of 2.8.7.0, then yes, you can.
Anyway, it's better to make a new backup, for any case...
Thanks . works great on my p7 especially the factory reset with cust .
can you explain how i can build similar twrp for the mate S . your help will be much appreciated
Hi !
Whenever I use 3buttons method my phone goes to EMUI recovery ,
Whenever I use 3rd party application my phone goes to TWRP recovery !
There is no update file on my storage so in both cases my phone should go to TWRP recovery ! What is the problem ? Please solve this !
andromodgod said:
can you explain how i can build similar twrp for the mate S . your help will be much appreciated
Click to expand...
Click to collapse
What do you mean by similar?
You'll have to make device tree to build TWRP. Mate S is much different from P7, so I think I couldn't help you with it.
mohammadsaa said:
Hi !
Whenever I use 3buttons method my phone goes to EMUI recovery ,
Whenever I use 3rd party application my phone goes to TWRP recovery !
There is no update file on my storage so in both cases my phone should go to TWRP recovery ! What is the problem ? Please solve this !
Click to expand...
Click to collapse
There is not any problem. 3 buttons method is used for "force update". If you want to boot into TWRP, use "power" + "vol+" instead of 3 buttons. Read the first post attentively!
@Kostyan_nsk_one question, why if internal storage is a subfolder of user data in recovery the size of internal storage partition is bigger of data partition?
complicazio said:
@Kostyan_nsk_one question, why if internal storage is a subfolder of user data in recovery the size of internal storage partition is bigger of data partition?
Click to expand...
Click to collapse
TWRP excludes /data/share folder from backup of /data folder. Thus, if you have a lot of photos, music, etc in your internal storage, its backup size will be greater than size of /data backup.
Kostyan_nsk said:
TWRP excludes /data/share folder from backup of /data folder. Thus, if you have a lot of photos, music, etc in your internal storage, its backup size will be greater than size of /data backup.
Click to expand...
Click to collapse
Well, thus if I want to do a nandroid backup I have to check data and internal storage, not only data partition because of default it's not selected internal memory
complicazio said:
Well, thus if I want to do a nandroid backup I have to check data and internal storage, not only data partition because of default it's not selected internal memory
Click to expand...
Click to collapse
It's not mandatoryly for nandroid backup. Depends on what kind of data you want to save. /data contains user applications and system settings; /data/share (i.e. internal storage) contains your personal data (screenshots, photos, music, videos, etc) if you didn't moved them to sd-card. It's up to you, what to backup and what not.
@Kostyan_nsk I appreciate your work. I have already built TWRP for my Huawei device but I am struggling to fix custom.bin and /data/cust symlink being destroyed after factory reset. I have placed the necessary code in partitions.cpp under Wipe partition block. Can you tell me which method you used to fix this?
@Kostyan_nsk When I do a backup in the internal memory then via es file Explorer goes into TWRP folder in sdcard0 (internal memory) it is empty, and if I go into the folder media / share / 0 / TWRP I find the backup. They are not the same thing? While if I do backup in the external sdcard its all ok.
Sent from my Paris using XDA-Developers mobile app
Hi,, I am new here ... i think this very nice .. do you tell me how is instal for my phone p7?
albelushi7 said:
Hi,, I am new here ... i think this very nice .. do you tell me how is instal for my phone p7?
Click to expand...
Click to collapse
Read first post
RangerP7 said:
Read first post
Click to expand...
Click to collapse
What is the first post?
I mean instal twrp!!
How?
If you mean Buckup I do this ?!!
I'm new don't forget this hhh
Think you
albelushi7 said:
What is the first post?
I mean instal twrp!!
How?
If you mean Buckup I do this ?!!
I'm new don't forget this hhh
Think you
Click to expand...
Click to collapse
First post on first page
Kostyan_nsk said:
Hi everyone.
Here's my build of TWRP 3.0.0-0 for Huawei P7.
Features:
Supports USB OTG, so you can use USB flash drive as external storage for backups, zip installations.
Added feature to make backup/restore of internal storage.
Added feature to make backup/restore of oeminfo partition. This partition contains info about vendor and current installed version. So in case if you want to rollback to 4.4.2, for example, or revert back your previous vendor version, you can just restore oeminfo from backup with 4.4.2 version or other vendor and flash appropriate firmware without flashing transition package, vendor and without getting "cust fail" error.
Combined with stock EMUI 3.1 recovery. In case of power-on by holding power + vol+ or rebooting into recovery by command or any 3rd party application: will boot in TWRP. In case of local update, OTA-update, factory reset from menu or "force update" (3buttons method): will boot into EMUI recovery. Thus you don't have to flash stock recovery before OTA-update, flashing official firmware or doing factory rest.
Off-mode charger updated from EMUI 3.1 (for 4.4.2)
custom.bin and cust symlinks are saved/restored (if they were exist) in case of Wipe/Format Data. So there is not gonna be "cust" issues after factory reset in TWRP.
Excluded SuperSU from build.
Enabled encrypted data support.
Screen lock by power button replaced with screen off.
Requirements:
Unlocked bootloader
Android 4.4.2 - 5.1.1
Installation:
Reboot in fastboot mode
Flash image via fastboot
Code:
fastboot flash recovery TWRP_P7-3.0.0-0.img
fastboot reboot
From TWRP: Press "Install" and select zip-archive
Known issues:
Because internal storage is not a separate block device and just a subfolder of "userdata" partition, before you can make backup/restore of internal storage, first you should do Mount -> Data. Otherwise you will get error, saying that TWRP can't mount "storage". So don't bother if you'll see this error.
Download: TWRP_P7-3.0.0-0.img
For TWRP: TWRP_P7-3.0.0-0.zip
Click to expand...
Click to collapse
Download ADB/FASTBOOT
Download TWRP_P7-3.0.0-0.img
And put it into the ADB / FASTBOOT folder
Install drivers of your phone
Connect your phone to your computer
Enable USB debugging on your phone
Open ADB and type:
"adb devices" (you should see now your device)
"adb reboot bootloader"
Now you should see at the bottom unlocked or locked. That means if your bootloader is unlocked. You need to unlock your bootloader to install a custom recovery.
If you see unlocked...
"fastboot flash recovery TWRP_P7-3.0.0-0.img"
That's it
Reboot your phone.
RangerP7 said:
First post on first page
Download ADB/FASTBOOT
Download TWRP_P7-3.0.0-0.img
And put it into the ADB / FASTBOOT folder
Install drivers of your phone
Connect your phone to your computer
Enable USB debugging on your phone
Open ADB and type:
"adb devices" (you should see now your device)
"adb reboot bootloader"
Now you should see at the bottom unlocked or locked. That means if your bootloader is unlocked. You need to unlock your bootloader to install a custom recovery.
If you see unlocked...
"fastboot flash recovery TWRP_P7-3.0.0-0.img"
That's it
Reboot your phone.
Click to expand...
Click to collapse
There are some nots ==
Where is ADB or link ADB/Fastboot
Where is folder Fastboot
albelushi7 said:
There are some nots ==
Where is ADB or link ADB/Fastboot
Where is folder Fastboot
Click to expand...
Click to collapse
Use the power of Google, maybe the force will be with you and you will find it
And please! inform you about flashing things on your phone. First learn how it work (your phone, bootloader, recovery, system, adb/fastboot) and after that start work...
If you are just flashing random **** on your phone without knowing what your are doing I will promise you, in less then one week you will ask for help because your phone won't start anymore...
RangerP7 said:
Use the power of Google, maybe the force will be with you and you will find it
And please! inform you about flashing things on your phone. First learn how it work (your phone, bootloader, recovery, system, adb/fastboot) and after that start work...
If you are just flashing random **** on your phone without knowing what your are doing I will promise you, in less then one week you will ask for help because your phone won't start anymore...
Click to expand...
Click to collapse
I know that
But This new for me ?
I want install this twerb ,because I think phone be better..
Just Try ?
Think you ?

Xperia Complete Backup?

Is there a way to completely backup the phone? All partitions (kernel/system etc.)? Preferably something that I can run with the phone connected to a PC.
I thought this might have been possible with FlashTool, but it only seems to be capable of pushing stuff onto the phone rather than pulling, which seems a bit odd.
Is TWRP or similar the only method?
Mroid said:
Is there a way to completely backup the phone? All partitions (kernel/system etc.)? Preferably something that I can run with the phone connected to a PC.
I thought this might have been possible with FlashTool, but it only seems to be capable of pushing stuff onto the phone rather than pulling, which seems a bit odd.
Is TWRP or similar the only method?
Click to expand...
Click to collapse
i was have tool here but it under upgrading to support z3+ and z5
maybe release it and maybe not
you can do it manually if you have minimal adb
by
Code:
adb shell
su
1. for Boot
dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=/sdcard/boot.img
2. for System
dd if=/dev/block/platform/msm_sdcc.1/by-name/system of=/sdcard/system.img
3. for Data
dd if=/dev/block/platform/msm_sdcc.1/by-name/userdata of=/sdcard/userdata.img
4. TA
dd if=/dev/block/platform/msm_sdcc.1/by-name/TA of=/sdcard/TA.img
md5 /dev/block/platform/msm_sdcc.1/by-name/TA TA.img
this will make dump of your partition to your sdcard
to pull it to pc use
adb pull /sdcard/your_partition.img .[COLOR="Red"]\[/COLOR]
Remember
1. you must have space for backup on your internal storage
2. i recommend you Backup-TA by DevShaft for TA partition
hit thanks if helped

[GUIDE] Upgrade 4.5.15 rooted & encrypted -> 5.0.2 WITHOUT DATA/SETTINGS LOSS

as usual, if anything goes wrong, no responsibility etc
The official update tutorial for rooted users doesn't keep app data, only internal storage! This tutorial keeps EVERYTHING
This method allows updating from 4.5.15 (unlocked, encrypted, rooted) to 5.0.2 without any data (sys settings + app data + user data) loss
A FAQ section is present at the end of this post and will be regularly updated.
List of files to download while doing the following steps:
OOS 5.0.2 ROM
Codeworkx TWRP recovery
Latest Magisk
Terms and software used in this guide:
Fastboot / Bootloader = bootloader of the phone, it's a very low level mode of the phone that allows booting into recovery. Can be accessed by using the advanced reboot menu (enable in dev options) or by "adb reboot fastboot".
Recovery = a small operating system on the phone that allows you to do various operations even when the main OS (Android) is broken. This includes flashing ROMs, modifying stuff on the storage, etc. It's the Android swiss army knife. If you can get a phone to boot TWRP, then you can do almost anything.
Magisk = rooting software that uses a systemless method to keep SafetyNet working. Systemless = instead of modifying the system, every change is put in a separate image that is mounted "over" the system. When the system tries to access a file modified by Magisk, instead of reading it from the partition, it reads it from Magisk. It's recommended to use Magisk instead of SuperSU as of 2018.
ADB = tool that allows controlling the phone from your PC through USB. You can use it when you're in Android if USB debugging is enabled in the settings, or when you're in TWRP. Here, we mostly use it for transferring files directly (without MTP) and running commands (using "adb shell")
Note: For this guide you will be required to download and install Magisk. If you don't want your phone to be rooted, then at the end of this guide reboot into TWRP, wipe both caches and re-flash the OS. This will uninstall Magisk and any other root patch. Beware: it will reflash stock recovery, so if you ever want to re-root, you'll need to reboot to fastboot and flash TWRP manually.
Convention for commands that you will have to run:
a command line starting with "C:" means that it should be run on your PC
a command line starting with "~ #" means that it should be run on your phone (through adb shell) while in TWRP
a command line starting with "OnePlus5:/ $" means that it should be run on your phone (through adb shell) while in OxygenOS
Although the commands start with "C:", this is just for readability purposes. You should run everything from inside an empty directory with enough disk space and writing access.
Your phone will have to be plugged in to your PC from the beginning to the end. Also, make sure it has at least 80% battery before beginning, just in case.
I know, the tutorial is huge. This is simply due to the fact that if I just wrote "make a nandroid backup of this and that, flash, and restore the backup while doing this", then some people may encounter problems because not everyone knows how to do a nandroid backup, restore it, etc. Also, there are a lot of things that need to be done precisely that way and not another way, which explains why the tutorial is huge. Also, you may notice that there is a lot of commands to run throughout the tutorial, this is because that way, I'm sure that at the end, you will have done everything like I did it on my phone, so that if you have a problem it's much easier to figure out where it comes from.
Summary of what you need to do (this is only a SUMMARY to give you a preview of what the whole thing looks like, you shouldn't follow it except if you're really an expert since a lot of things need to be done precisely, instead you should follow the easier complete steps below):
Make a Nandroid backup of /data
Backup files on internal storage
Wipe everything (internal storage + /data + system + caches), and then format data (important!)
Push and flash the OOS zip
Wipe caches and reboot (to Oreo!)
When it reboots, make sure everything (features, like Wi-Fi and fingerprint sensor) works. Don't "save anything" though, everything you do will be erased when we'll restore your backup. This is just a "test drive" for Oreo.
Reboot to TWRP, wipe Data and restore the /data backup
Run the three commands to fix Wi-Fi and fingerprints
Reboot (to System) and check everything works (don't do anything, don't change any setting, just make sure it works)
Reboot to TWRP, rename the "Android" folder to "Android_oreo" on sdcard, delete everything else on sdcard and restore your internal files
Rename the freshly restored Android (nougat) folder to "Android_nougat" and rename "Android_oreo" to "Android".
Flash Magisk, wipe dalvik+cache and reboot to System
When in Android, everything should work except some apps won't have their data. This is normal. Open a terminal (either on your phone using Termux or from your PC using adb shell), elevate using su and rename "Android" to "Android_oreo" and "Android_nougat" to "Android" (this is so that it correctly restores permissions)
If everything works fine, delete the "Android_oreo" folder
First, if you have Xposed Framework (systemless or not) installed, uninstall it. Next, if needed, uninstall any Magisk module that is "Nougat-only" to prevent any problems afterwards.
Boot the phone to bootloader/fastboot (either using advanced reboot, or by using volume down button when you start your phone) and boot to the TWRP recovery by doing
Code:
C:\> fastboot boot twrp-3.2.1-0-oreo-8.1-codeworkx-cheeseburger.img
from your PC.
Next, in TWRP, make a backup of /data (using the Backup button). Then, still while in TWRP, run the following commands:
Code:
C:\> adb shell
~ # cd /sdcard
/sdcard # tar cvf twrp.tar TWRP
/sdcard # md5sum twrp.tar
<< md5 checksum of twrp.tar >>
/sdcard # exit
C:\> adb pull -p /sdcard/twrp.tar
When the above command has finished, make sure that the checksum of the received twrp.tar file matches the one previously displayed.
If it doesn't match, delete the file and run adb pull again. Don't continue following this guide until you have received a 1:1 (checksum-wise) backup of /data.
Code:
C:\> adb shell
<< WARNING: dangerous command! double check the following line is correct before pressing enter! >>
~ # rm -rf /sdcard/TWRP
~ # rm /sdcard/twrp.tar
That was for /data. Now, the backup for the internal storage:
Code:
~ # cd /sdcard
/sdcard # du -csh
<< you should see here the total size of sdcard, that'll give you an idea of how long it'll take >>
/sdcard # tar cvf sd.tar element1 element2 element... elementN
<< in the command above, replace "element1..N" by a space-separated list of what you want to have in the backup.
Keep in mind that your list HAS to contain the element "Android" (case is important). It contains the app data.
Let's say for example you want to keep only the photos you have taken (and nothing, nothing else that was on internal storage).
The photos are in the folder DCIM, so the command will look like this:
tar cvf sd.tar Android DCIM
(because you want DCIM, and Android has to be in the list, no matter where)
>>
/sdcard # md5sum sd.tar
<< md5 checksum of sd.tar >>
/sdcard # exit
C:\> adb pull -p /sdcard/sd.tar
When the above command has finished, make sure that the checksum of the received sd.tar file matches the one previously displayed.
If it doesn't match, delete the file and run adb pull again.
Keep in mind that anything you don't put in that list will not be backed up and will be lost!
Now, you have a backup for all the important stuff so we can start doing the real sh*t.
Now, the important step:
Go back to the TWRP home screen, press "Wipe", "Advanced Wipe" and there check "Dalvik / ART Cache", "Cache", "System", "Data" and "Internal Storage". Confirm using the slider at the bottom of the screen. Press the home button, then "Reboot" and "FastBoot". Now, type the same fastboot command as in the previous step to boot the recovery image. You'll enter the recovery as before.
Now, on your PC, in the terminal, type
Code:
adb push -p OnePlus5Oxygen_23_OTA_029_all_1801292040_d71af3d.zip /sideload
(note: here, we are not using "adb sideload", we are really using "adb push"). In TWRP, click Install, in the file manager go to /sideload and select the OOS zip file. Confirm by sliding. If you get an error, go back to home, click Mount and ensure System is not checked. Then try installing again. If it still does not work, reboot to fastboot, type command again, get to the recovery and install again.
When the zip-file is installed, go home, click "Wipe", "Advanced Wipe" and check both caches and confirm. Then, go home, click "Wipe" and then "Format Data". Then, go home, click "Reboot" and then "System". Your phone will now reboot to Oreo. It will take a long time, but do not turn off the phone. Let it run. On my phone, it took on average 2 minutes for that boot.
You'll be greeted by the "first boot" page. It'll ask you if you want to restore a backup or start anew, choose start anew. Connect to your Wi-Fi network and Google account. Follow all the instructions until you get to the home screen. There, make sure everything works (especially Wi-Fi and fingerprint sensor). Don't save your fingerprints yet, they will be erased afterwards. If everything works, you can continue following these instructions. If not, post a comment down there.
Now that you're at the home screen, go in the settings, About Android and click the build number 8 times to enable Developer Options. Go in there and enable advanced reboot. Then, reboot your phone into fastboot/bootloader using the power button. Type the exact same command as before to start TWRP. Once that you are in TWRP, run the following commands:
Code:
C:\> adb push -p twrp.tar /sdcard/
C:\> adb shell
~ # cd /sdcard
/sdcard # tar xvf twrp.tar
/sdcard # cp /data/misc/wifi/WifiConfigStore.xml /sdcard/
In TWRP, click "Wipe", "Advanced Wipe" and check only the "Data" partition. Confirm. Press home, then "Restore" and choose the backup in the list. Confirm to restore. Back to the terminal, we need to run the following commands otherwise Wi-Fi and fingerprints won't work:
Code:
/sdcard # cp WifiConfigStore.xml /data/misc/wifi/
/sdcard # rm /data/misc/wifi/wpa_supplicant.conf
<< WARNING: dangerous command! double check the following line is correct before pressing enter! >>
/sdcard # rm -rf /data/system/users/0/fpdata
/sdcard # rm /data/system/users/0/settings_fingerprint.xml
Note: the command above are ran from your PC in an adb shell while the phone is still in TWRP.
Reboot the phone to system and ensure Wi-Fi and fingerprints are still working. Right now you should already see your old home screen and all your apps, but the internal storage isn't there yet. Reboot in fastboot, run the command to get in TWRP.
Once TWRP has booted, run the following commands:
Code:
C:\> adb push -p sd.tar /sdcard/
C:\> adb shell
~ # cd /sdcard
<< WARNING: dangerous command! double check the following line is correct before pressing enter! >>
/sdcard # rm -rf Alarms Albums DCIM Download Movies Music Notifications Pictures Podcasts Ringtones
/sdcard # ls
<< now, look at the list of files that were printed, and rm anything left that is not called "Android" or "sd.tar"
<< WARNING: dangerous command! double check everything is correct before pressing enter! >>
if when you do rm <the thing> it tells you it's a directory, then do: rm -rf <thething>
if there's a folder called SomeFolder, do "rm -rf SomeFolder"
next, run this:
/sdcard # ls
Android sd.tar <-- expected output
/sdcard # mv Android Android_oreo
/sdcard # tar xvf sd.tar
/sdcard # mv Android Android_nougat
/sdcard # mv Android_oreo Android
If you don't have Magisk somewhere on your sd card, download it and upload it using MTP or adb. Then flash it using the Install button. Clear dalvik/cache and reboot to system.
When the phone has booted (again, it might take time), make sure USB debugging is enabled and run the following commands:
Code:
C:\> adb shell
OnePlus5:/ $ su
<< here, you might see a Magisk screen asking for superuser access. Allow. >>
OnePlus5:/ $ cd /sdcard
OnePlus5:/sdcard $ mv Android Android_oreo && mv Android_nougat Android
Now, try some apps and make sure all the data is there (especially games and Netflix/Hulu/etc). If everything is there, and the phone works properly, go back in the terminal and type:
Code:
OnePlus5:/sdcard $ rm -rf Android_oreo
Optionally, start the TWRP app and flash it, it can always be useful. You can also reboot to fastboot to do that.
Now reboot your phone (normal reboot) one last time.
There, working OOS 5.0.2 / Android 8.0.0 phone with no data loss.
Frequently Asked Questions
How long does the whole thing take?
Highly depends on the amount of data you have on your phone. Since it the USB port only supports USB 2.0, it may take 4 or 5 hours in total.
Will doing this void my warranty?
No.
Will I be able to install future OTA updates using the regular download-reboot-flash-twrp procedure?
Yep. Just use the regular method as you would have on Nougat.
Will I lose my data?
If you follow all the instructions, no. Even if you don't follow them, as soon as you have made a backup of /data and internal storage, then no matter how bad you screw up you could always get a working phone back.
I followed the instructions and now my phone doesn't work
Boot in TWRP, wipe everything, reflash.
questions will be added there in the future
Having WiFi and fingerprint issues
You sure it is a good idea to just delete those files? I would have guessed that I need to replace these (nougat version from backup) with the oreo version to have it working just like before the restore.
Code:
/sdcard # rm /data/misc/wifi/wpa_supplicant.conf
/sdcard # rm -rf /data/system/users/0/fpdata
/sdcard # rm /data/system/users/0/settings_fingerprint.xml
I'm having the issues with wifi and fingerprints. Neither one is working. I'll try to figure out how to fix this.
@zdimension Thanks for this guide, I don't have time to test it yet, but I have a question
pdluke said:
Code:
/sdcard # rm /data/misc/wifi/wpa_supplicant.conf
/sdcard # rm -rf /data/system/users/0/fpdata
/sdcard # rm /data/system/users/0/settings_fingerprint.xml
Click to expand...
Click to collapse
At this point in the procedure, adb shell is still using root (before flashing magisk) ? How is that possible ? Does the adb /sideload preserve root ?
olivier380 said:
@zdimension Thanks for this guide, I don't have time to test it yet, but I have a question
At this point in the procedure, adb shell is still using root (before flashing magisk) ? How is that possible ? Does the adb /sideload preserve root ?
Click to expand...
Click to collapse
These commands should be run while the phone is in TWRP. Also note that adb /sideload is not used here, only adb push.
pdluke said:
You sure it is a good idea to just delete those files? I would have guessed that I need to replace these (nougat version from backup) with the oreo version to have it working just like before the restore.
Code:
/sdcard # rm /data/misc/wifi/wpa_supplicant.conf
/sdcard # rm -rf /data/system/users/0/fpdata
/sdcard # rm /data/system/users/0/settings_fingerprint.xml
I'm having the issues with wifi and fingerprints. Neither one is working. I'll try to figure out how to fix this.
Click to expand...
Click to collapse
If you delete them, they will be generated automatically at the next system boot. But you could also make a backup of those three files before wiping /data, store that somewhere, restore Nougat /data and then restore your backup of those three files. The result would be the same.
Note: actually, not exactly. Erasing the first file won't change anything since it's not used anymore in Oreo, but the two other files contain the fingerprint configuration (list of saved fingerprints). So,
Either you remove the files and you have to save your fingerprints again at next boot
Either you restore them from an Oreo backup and you'll get the fingerprints you had saved during the "first boot" procedure when you rebooted the phone right after flashing the OS
But the result is mostly the same: everything works. Deleting the files ensures you get something clean. If you restore from an Oreo backup I can't guarantee the result (as it may interfere with other files from the Nougat backup).
10 bucks to make a script to do this all for me haha.
@zdimension Thanks for the clarification Another thing you might add to the files to download would be Magisk (optionally). In this kind of guide, I've always find it useful to download everything first.
olivier380 said:
@zdimension Thanks for the clarification Another thing you might add to the files to download would be Magisk (optionally). In this kind of guide, I've always find it useful to download everything first.
Click to expand...
Click to collapse
Oops, forgot to add it
I added the link, and also instructions for how to un-root afterwards for those who would want it.
To improve the guide, here are some ideas :
- You should highlight that rm -rf is a very dangerous command, and that it needs to be checked twice (especially the targeted folder)
- It could be useful to use the du -csh command to check the size of a folder (to estimate the backup time for example).
- As a safety measure, one could md5sum the tar file before and after using adb pull
What do you think ?
olivier380 said:
To improve the guide, here are some ideas :
- You should highlight that rm -rf is a very dangerous command, and that it needs to be checked twice (especially the targeted folder)
- It could be useful to use the du -csh command to check the size of a folder (to estimate the backup time for example).
- As a safety measure, one could md5sum the tar file before and after using adb pull
What do you think ?
Click to expand...
Click to collapse
Thanks for the ideas! I updated the post (and I added a changelog at the bottom for future reference).
Followed guide for successful upgrade from 4.5.15 encrypted, unlocked bootloader w/ Magisk root.
One note, after the first complete wipe and flash of the full ROM, it was getting stuck on first boot and never completed. Discovered that I needed to not just wipe the Data partition but Format it in TWRP, to clear out the old encryption I think. Magisk wouldn't install either until I did this.
@debork thanks for the positive feedback (all the merit goes to @zdimension of course)
@zdimension there are many people in the other thread https://forum.xda-developers.com/oneplus-5/how-to/official-oxygenos-4-5-2-7-1-1-ota-t3627003 that tried (unsucessfully) to upgrade from 4.5.15 to 5.0.1, maybe a link to this topic could be useful for them (if it's not too late).
Regarding the
Go back to the TWRP home screen, press "Wipe", "Advanced Wipe" and there check "Dalvik / ART Cache", "Cache", "System", "Data" and "Internal Storage".
Click to expand...
Click to collapse
I think it should be highlighted in red, since it is the actual "clean flash" (AFAIU, correct me if I'm wrong).
if we only have the BL unlocked non root and stock recovery can we only ota without any loss of data ?
debork said:
Followed guide for successful upgrade from 4.5.15 encrypted, unlocked bootloader w/ Magisk root.
One note, after the first complete wipe and flash of the full ROM, it was getting stuck on first boot and never completed. Discovered that I needed to not just wipe the Data partition but Format it in TWRP, to clear out the old encryption I think. Magisk wouldn't install either until I did this.
Click to expand...
Click to collapse
Thanks for feedback, I will add that to the guide (although it worked with just Wipe for me )
zdimension said:
Thanks for feedback, I will add that to the guide (although it worked with just Wipe for me )
Click to expand...
Click to collapse
Have you rooted the 4.5.15 with Magisk or SuperSU (which is not compatible with Oreo anymore) ?
olivier380 said:
Have you rooted the 4.5.15 with Magisk or SuperSU (which is not compatible with Oreo anymore) ?
Click to expand...
Click to collapse
I stopped using SuperSU when it was sold to that shady company. Also, Magisk is better imo.
quick05 said:
if we only have the BL unlocked non root and stock recovery can we only ota without any loss of data ?
Click to expand...
Click to collapse
Official OnePlus support said that nothing is guaranteed if your bootloader is unlocked. But since you're on stock recovery + non rooted, you could always try. But backup everything first. Some people here on XDA have reported that it doesn't work, though.
Just followed your guide with no problems. Thank you very much!! I can confirm also that you need to format data after the wipe otherwise it gets stuck in a bootloop!
Thanks so much for this. I was able to successfully follow the guide and get upgraded to 5.0.1 without losing any data. In fact, I even messed up one step by failing to include the Android directory in the sdcard.tar backup (perhaps that should be more explicit), but it doesn't seem to have affected everything; all of my apps seem to have retained their data.
A few notes:
1. The file size of twrp.tar was ~14GB but when executing the pull command, it recognized it as only ~1.3 GB. As a result, the pull was not complete until it reached over 1000%. All the more reason to do the md5 check.
2. As others stated, I needed to format the data partition, not just wipe it.
3. I might recommend also including a "summary" version somewhere on what this guide does. Scrolling through the guide the first time, it seemed pretty daunting, but really all that you're doing is: backing up data partition and internal storage; wiping device; flashing Oreo ROM; tweaking a few files; and restoring backed up data and internal storage.
Thank you again so much! Glad to finally be on Oreo.
elight3 said:
Thanks so much for this. I was able to successfully follow the guide and get upgraded to 5.0.1 without losing any data. In fact, I even messed up one step by failing to include the Android directory in the sdcard.tar backup (perhaps that should be more explicit), but it doesn't seem to have affected everything; all of my apps seem to have retained their data.
A few notes:
1. The file size of twrp.tar was ~14GB but when executing the pull command, it recognized it as only ~1.3 GB. As a result, the pull was not complete until it reached over 1000%. All the more reason to do the md5 check.
2. As others stated, I needed to format the data partition, not just wipe it.
3. I might recommend also including a "summary" version somewhere on what this guide does. Scrolling through the guide the first time, it seemed pretty daunting, but really all that you're doing is: backing up data partition and internal storage; wiping device; flashing Oreo ROM; tweaking a few files; and restoring backed up data and internal storage.
Thank you again so much! Glad to finally be on Oreo.
Click to expand...
Click to collapse
Thanks for the feedback! I'll add a summary to the guide.

Categories

Resources