FORUMS

[Recovery][Stock OOS]Oxygen OS Stock recovery with ADB enabled

411 posts
Thanks Meter: 194
 
By s3axel, Senior Member on 18th April 2020, 10:35 AM
Post Reply Email Thread
While waiting for a working TWRP for all those needful of the possibility to access their file system from recovery, e.g. for removing an offensive magisk extension preventing boot I repackaged the Stock OOS recovery but with ADB enabled.

Prerequisites:
  • Oneplus 8 Pro
  • unlocked bootloader
  • access to fastboot on the phone
  • adb and fastboot

Installation:
Reboot the phone to fastboot, then flash the recovery from fastboot with the command
Code:
fastboot flash recovery <filename>
(with <filename> being the name of the recovery in the format of "recovery.img" you wish to flash)

Uninstall:
Same as installation, but flash the original stock recovery instead.

Usage:
Boot up recovery, enter encryption key if file system is encrypted. Then connect the phone to PC and you are ready to go with adb. E.g. by using
Code:
adb shell
to open a shell and access the file system. Magisk modules are located in /data/adb/modules, deleting the corresponding directory there will remove the module in question.

Step-by-step this would be:
  • Code:
    cd /data/adb/modules
    to change to the Magisk modules directory
  • Code:
    ls
    to list the content of this directory, each module has its own directory, usually with a well-recognizable name
  • Code:
    rm -r <directory>
    to delete the directory in question. Tip: in console TAB-autocomplete works

Downloads:

10.5.4 BA Recovery
  • Modified 10.5.4 BA recovery from GDrive
  • Original 10.5.4 BA recovery from Gdrive

10.5.5 BA Recovery
  • Modified 10.5.5 BA recovery from GDrive
  • Original 10.5.5 BA recovery from Gdrive

10.5.6 BA Recovery
  • Modified 10.5.6 BA recovery from GDrive
  • Original 10.5.6 BA recovery from Gdrive

Notes of caution:
  • ADB security is disabled as I could not get the recovery to allow for authorizing a connected computer. As a consequence any computer connected is automatically authorized in ADB, although with encrypted filesystem at least no data is accessible without the key.
  • with direct ADB access to your file system you can easily wreck you phone requiring a factory reset or even reinstallation of the OS from fastboot - please be careful on what you are doing

Credits: Thanks to osm0sis for Android kitchen and all great developers for the Oneplus devices, specifically mauronofrio for his TWRP efforts.
The Following 11 Users Say Thank You to s3axel For This Useful Post: [ View ] Gift s3axel Ad-Free
18th April 2020, 10:36 AM |#2  
OP Senior Member
Thanks Meter: 194
 
More
Description of method to modify recovery by yourself:


Prerequisites:
  • Android Image Kitchen (credit to osm0sis for providing this tool)
  • the original recovery image file (henceforth called "recovery.img"). You can extract this yourself from an update zip file by unpacking "payload.bin" and then use a tool like payload_dumper (credit to vm03 for providing this) to extract the recovery.img file

Now do the following:
  1. unpack image with Image Kitchen --> this will create a "ramdisk" and a "Split_img" directory with the unpacked content within
  2. navigate into the "ramdisk" folder and use a text editor (on windows preferably Notepad++) to edit the file "prop.default"
  3. look for entry "ro.adb.secure" and change entry value from "1" to "0". Note this entry can occur multiple times (I noticed twice), change each --> this will prevent adb from asking for authorization (the recovery does not provide such a dialogue)
  4. look for entry "ro.debuggable" and change this from "0" to "1" --> this actually enables adb
  5. look for entry "ro.secure" and change this from "1" to "0" --> may be unnecessary but I wanted to avoid brick in case a modified recovery would result in such a behaviour
  6. save textfile
  7. repack the image with Android Image Kitchen and voila:
  8. you have a new modified recovery image you can flash
The Following 4 Users Say Thank You to s3axel For This Useful Post: [ View ] Gift s3axel Ad-Free
18th April 2020, 10:55 AM |#3  
cultofluna's Avatar
Senior Member
Thanks Meter: 1,801
 
More
Thanks for this...
On fastboot we have to flash the modified recovery img?
EDIT : Nevermind haven't read the whole OP
19th April 2020, 02:21 AM |#4  
Member
Thanks Meter: 1
 
More
I have a noob question: this won't affect data or magisk right?
The Following User Says Thank You to HottieLinus For This Useful Post: [ View ] Gift HottieLinus Ad-Free
19th April 2020, 10:40 PM |#5  
cultofluna's Avatar
Senior Member
Thanks Meter: 1,801
 
More
To remove a module , command should not be :

( rm -rf < directory> ) ?...
The Following User Says Thank You to cultofluna For This Useful Post: [ View ] Gift cultofluna Ad-Free
20th April 2020, 08:53 AM |#6  
OP Senior Member
Thanks Meter: 194
 
More
Quote:
Originally Posted by cultofluna

To remove a module , command should not be :

( rm -rf < directory> ) ?...

Thanks for your comment, but technically no

The - f flag is used to omit prompts before each removal, which may or may not be helpful - depending in how sure the user is on what he does

I chose the safer variety in my example, confident that users with more knowledge can always look at the "rm" man page to decide what command they want to use...

But again thanks, I do appreciate your help!
The Following User Says Thank You to s3axel For This Useful Post: [ View ] Gift s3axel Ad-Free
20th April 2020, 08:55 AM |#7  
OP Senior Member
Thanks Meter: 194
 
More
Quote:
Originally Posted by HottieLinus

I have a noob question: this won't affect data or magisk right?

Correct, the recovery resides in a separate partition and flashing it doesn't do anything anywhere else.

In fact the recovery looks and behaves the same when booting into it, the change only becomes apparent by being able to use adb in recovery.
21st April 2020, 07:39 AM |#8  
cultofluna's Avatar
Senior Member
Thanks Meter: 1,801
 
More
@s3axel can we use this recovery to escape bootloop due to install unsupported theme or any issue from substratum?
Or maybe just flashing stock boot IMG on fastboot is enough...
21st April 2020, 07:51 AM |#9  
OP Senior Member
Thanks Meter: 194
 
More
Quote:
Originally Posted by cultofluna

@s3axel can we use this recovery to escape bootloop due to install unsupported theme or any issue from substratum?
Or maybe just flashing stock boot IMG on fastboot is enough...

It should be possible as the recovery gives you full access to your file system and so, given you know what to remove/change, it should also be possible to recover from issues as you mentioned.

My problem: I have no idea where themes or substratum additions are installed directory-location wise, will need to research a bit. Or maybe someone else can chime in on this, then I could update OP with info on that as well...
The Following User Says Thank You to s3axel For This Useful Post: [ View ] Gift s3axel Ad-Free
21st April 2020, 08:11 AM |#10  
cultofluna's Avatar
Senior Member
Thanks Meter: 1,801
 
More
Ok one more question..
Can we flash zips through the recovery?...
Via ADB sideload?.. maybe..
21st April 2020, 09:07 AM |#11  
OP Senior Member
Thanks Meter: 194
 
More
Quote:
Originally Posted by cultofluna

..Can we flash zips through the recovery?...Via ADB sideload?..

I don't know but I doubt it as to my knowledge ADB sideload is a special mode that needs to be activated e.g. in TWRP. So far I didn't have the need to use such a functionality and thus haven't tried it
The Following User Says Thank You to s3axel For This Useful Post: [ View ] Gift s3axel Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes