Question Ways to return the device to stock?

Search This thread

ZanaGB

Member
Oct 3, 2015
35
2
I am a bit of a scaredy cat, and I don’t want to pollute the GSI thread with this question.

OnePlus is not offering fast boot flash images for their Nord 2. And the only way to get a custom rom is by flashing a custom vbmeta image and a system image for GSI.

The question now arises, how could one come back from a GSI into stock? I would assume I would need to do ADB push/pull and copy the whole system NAND to a file, then restore that if needed.

Would that be true? Or are there better / faster / safer ways to turn the phone to stock?

I have not yet received my unit, but i want to start tinkering with it as soon as I get my hands on it. So I want to know if there are any ways to undo any and all modifications i would do to the system.

Cheers
 

ZanaGB

Member
Oct 3, 2015
35
2
I am telling that TWRP Backs up system as System.img in most Phones.
Same should apply to Nord 2.
It should apply, but there's the issue of backups needing to be bit-perfect to ensure not to upset dm-verity

I have however found a bunch of commands that i will be testing in about 6 days, once i receive the terminal. I will be placing them for future reference, and for any poor souls who may need this:

Code:
adb backup --twrp -f /directory/to/save/dump.db
Not exactly my cup of tea, but this should combine bit-perfect system and vendor images with space-saving regular file copies of other lesser i mportant partitions, and ignoring the /data/media partition. Should be good enough.

Code:
adb root 

adb shell 'dd if=/dev/block/mmcblk0 2>/dev/null' > mmcblk0.img

These two commands should, on an ideal world, with debugging enabled on the target device, and from within TWRP, create a bit-perfect copy of the entire nand and leave them on the CWD. however, the path may differ from what i've found, different chipset and all. However, that's nothing that a good old
Code:
lsblk -l
won't solve. The tricky bit will be actually pulling the file back. Since redirects can seemigly be used to copy the image file to the CWD, redirects may be able to be used to write to disk remotely. This one requires more research.

Alternatively, i will need to buy an OTG cable, get a large enough flash drive, and mount it for the purposes and DD'ing the file out and into the device. If all else fails, with 8GB of RAM it should be able to store 1/16 of the total NAND flash onto ram and slowly stitch the nand in chunks. Not shore how well would that go, too many points of failure. But keeping this for my own musings.

Another possible answer would be to boot into TWRP, running
Code:
lsblk -l
to see all the mount points, and using
Code:
adb push / adb pull
on each of them. Research indicates one can't copy the whole NAND this way, but individual partitions. Should suffice as long as the subsequent coopies are bit-perfect. Assuming one can push the generated image back, this may be the most satisfactory answer.

I will attempt to perform these tasks when i receive the phone and see if it can successfuly restore it's own backup.
 
  • Like
Reactions: 8vasa8

ZanaGB

Member
Oct 3, 2015
35
2
I am telling that TWRP Backs up system as System.img in most Phones.
Same should apply to Nord 2.
Additionally, one should note that i intend on fully backing up the NAND of the device. Just the system partition is insufficient. as there may be updates on the way that may make restoring the system partition from an OTA image impossible. Therefore, a full NAND copy is needed. altnernatively, if a low-level copy cannot be achieved, individual bit-perfect copies of individual partitions will need to suffice, and hoping no GSI or custom rom maniulates any of the protected partitions.
 

ZanaGB

Member
Oct 3, 2015
35
2
As I stated previously. I have yet to receive my terminal. So I haven’t flashed anything yet.

however, disabling dm-verity, installing your system image, see it it fails, and if it fails, backing up, will be a great way to test if my backups are effective.

I want to toy around with your image and PHH’s once I get the terminal. So I’m just trying to preemptively have backups in place for when I inevitably flash something without paying attention and bricking the device.

that reminds me, were you the one who needed a full system dump a few weeks ago on another thread? I can upload my image once I get it working

Edit: just checked it was phhusson who needed the dump. Sorry about the mix up
 

sakarya1980

Senior Member
Sep 29, 2004
334
109
OnePlus 7
OnePlus 7T
As I stated previously. I have yet to receive my terminal. So I haven’t flashed anything yet.

however, disabling dm-verity, installing your system image, see it it fails, and if it fails, backing up, will be a great way to test if my backups are effective.

I want to toy around with your image and PHH’s once I get the terminal. So I’m just trying to preemptively have backups in place for when I inevitably flash something without paying attention and bricking the device.

that reminds me, were you the one who needed a full system dump a few weeks ago on another thread? I can upload my image once I get it working

Edit: just checked it was phhusson who needed the dump. Sorry about the mix up
I tested rhe gsi Versions, but not good :( i flash my system.img, dtbo, persist and vbmeta and go back to stock
 

ZanaGB

Member
Oct 3, 2015
35
2
Just got notified that the phone arrived. So this evening i will get it up and running then worry about backing up later.
 

ZanaGB

Member
Oct 3, 2015
35
2
have you tried this method on nord 2?
I made a nand copy but never backed it up.I ended up not needing root for anything and I won't install any ROMs until there's any good ways to have a failsafe for backups. So to all effects I have a backup I haven't tested. I am not gonna risk losing my IMEI or having a zombified phone due to missing blocks on the backup.

To be specific. I have ways to get data OUT of the phone. But I don't have a reliable way to get the data IN and ensure nothing critical is missing or overwritten in the process. And I am too afraid to lose my phone just testing if backups ACTUALLY work.
 

pankspoo

Account currently disabled
K
I am a bit of a scaredy cat, and I don’t want to pollute the GSI thread with this question.

OnePlus is not offering fast boot flash images for their Nord 2. And the only way to get a custom rom is by flashing a custom vbmeta image and a system image for GSI.

The question now arises, how could one come back from a GSI into stock? I would assume I would need to do ADB push/pull and copy the whole system NAND to a file, then restore that if needed.

Would that be true? Or are there better / faster / safer ways to turn the phone to stock?

I have not yet received my unit, but i want to start tinkering with it as soon as I get my hands on it. So I want to know if there are any ways to undo any and all modifications i would do to the system.

Cheers
Keep nandroid backup evry time you want to go back just restore that nandroid backup using twrp if you gets data restoration error just deselect data emmc win file in backup and restore.
Remember on android 12 gsi twrp data encryption issue so u can't able to access internal storage to restore the backup so first go back to android 11 gsi, now transfer that backup to twrp folder and then boot back to twrp and restore

I personally done this when I stuck on android 12gsi
 
  • Like
Reactions: ZanaGB

ZanaGB

Member
Oct 3, 2015
35
2
K

Keep nandroid backup evry time you want to go back just restore that nandroid backup using twrp if you gets data restoration error just deselect data emmc win file in backup and restore.
Remember on android 12 gsi twrp data encryption issue so u can't able to access internal storage to restore the backup so first go back to android 11 gsi, now transfer that backup to twrp folder and then boot back to twrp and restore

I personally done this when I stuck on android 12gsi
One thing i have been reading from the TWRP Nandroid backups, is that people who install the GSI and then restore, lose their IMEI data and other baked-in addresses.

Is that the case? I would imagine that since TWRP backups aren't bit-for-bit it could cause problems. Have you tested for that?

EDIT: additionally, i guess i absolutely need an OTG adatper to properly restore the backup, since the mere ac of restoring the backup would destroy the backup in the process, wouldn't it?
 
Last edited:

pankspoo

Account currently disabled
One thing i have been reading from the TWRP Nandroid backups, is that people who install the GSI and then restore, lose their IMEI data and other baked-in addresses.

Is that the case? I would imagine that since TWRP backups aren't bit-for-bit it could cause problems. Have you tested for that?

EDIT: additionally, i guess i absolutely need an OTG adatper to properly restore the backup, since the mere ac of restoring the backup would destroy the backup in the process, wouldn't it?
No if u r on android 12 gsi u need OTG there twrp will not work.
No issue in Restoration on android 11gsi
 

ZanaGB

Member
Oct 3, 2015
35
2
No if u r on android 12 gsi u need OTG there twrp will not work.
No issue in Restoration on android 11gsi
So. The way i understand it.

1: Full backup from the stock ROM ( Android 11 Based ) using TWRP
2: Install a GSI, for example, Android 12 GSI
3: In need of going back, first install the Android 11 GSI
4: Once with the 11 GSI installed, recover the TWRP Backup

Would that be correct?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    I am telling that TWRP Backs up system as System.img in most Phones.
    Same should apply to Nord 2.
    It should apply, but there's the issue of backups needing to be bit-perfect to ensure not to upset dm-verity

    I have however found a bunch of commands that i will be testing in about 6 days, once i receive the terminal. I will be placing them for future reference, and for any poor souls who may need this:

    Code:
    adb backup --twrp -f /directory/to/save/dump.db
    Not exactly my cup of tea, but this should combine bit-perfect system and vendor images with space-saving regular file copies of other lesser i mportant partitions, and ignoring the /data/media partition. Should be good enough.

    Code:
    adb root 
    
    adb shell 'dd if=/dev/block/mmcblk0 2>/dev/null' > mmcblk0.img

    These two commands should, on an ideal world, with debugging enabled on the target device, and from within TWRP, create a bit-perfect copy of the entire nand and leave them on the CWD. however, the path may differ from what i've found, different chipset and all. However, that's nothing that a good old
    Code:
    lsblk -l
    won't solve. The tricky bit will be actually pulling the file back. Since redirects can seemigly be used to copy the image file to the CWD, redirects may be able to be used to write to disk remotely. This one requires more research.

    Alternatively, i will need to buy an OTG cable, get a large enough flash drive, and mount it for the purposes and DD'ing the file out and into the device. If all else fails, with 8GB of RAM it should be able to store 1/16 of the total NAND flash onto ram and slowly stitch the nand in chunks. Not shore how well would that go, too many points of failure. But keeping this for my own musings.

    Another possible answer would be to boot into TWRP, running
    Code:
    lsblk -l
    to see all the mount points, and using
    Code:
    adb push / adb pull
    on each of them. Research indicates one can't copy the whole NAND this way, but individual partitions. Should suffice as long as the subsequent coopies are bit-perfect. Assuming one can push the generated image back, this may be the most satisfactory answer.

    I will attempt to perform these tasks when i receive the phone and see if it can successfuly restore it's own backup.
    1
    K
    I am a bit of a scaredy cat, and I don’t want to pollute the GSI thread with this question.

    OnePlus is not offering fast boot flash images for their Nord 2. And the only way to get a custom rom is by flashing a custom vbmeta image and a system image for GSI.

    The question now arises, how could one come back from a GSI into stock? I would assume I would need to do ADB push/pull and copy the whole system NAND to a file, then restore that if needed.

    Would that be true? Or are there better / faster / safer ways to turn the phone to stock?

    I have not yet received my unit, but i want to start tinkering with it as soon as I get my hands on it. So I want to know if there are any ways to undo any and all modifications i would do to the system.

    Cheers
    Keep nandroid backup evry time you want to go back just restore that nandroid backup using twrp if you gets data restoration error just deselect data emmc win file in backup and restore.
    Remember on android 12 gsi twrp data encryption issue so u can't able to access internal storage to restore the backup so first go back to android 11 gsi, now transfer that backup to twrp folder and then boot back to twrp and restore

    I personally done this when I stuck on android 12gsi