• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Question Ways to return the device to stock?

Search This thread

ZanaGB

Member
Oct 3, 2015
27
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
27
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
27
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
27
2
Do you flash the system.img from my backup?

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
307
89
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
 

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.