1

I made a post about this yesterday, and I managed to make a lot of progress today, but I'm stuck again, and I am trying to decide what to do. I am not really experienced with coding, but I happen to be very good at teaching myself how to do something when needed and also very bad at giving up.

Below is a summary of my progress thus far:

INITIAL PLAN

  1. Install Android SDK, drivers to PC (Win7, 64 bit)

  2. Root phone (used CF-Auto-Root)

  3. Patch adbd to allow root permissions (installed adbd insecure and SuperSU)

  4. Access /data/userdata

  5. Get image of /userdata, attempt to find files

I am stuck at step 3. I have adbd insecure and SuperSU, but using either of these causes USB debugging to be disabled. Regardless of how I toggle things, I lose my connection to my PC and cannot enable USB debugging.

Some research uncovered that there's something called SELinux that is preventing me from enabling USB debugging while adbd insecure is enabled (patched adbd). There are posts in the adbd insecure thread on the XDA forums from other people (check the last page) describing a similar problem:

https://forum.xda-developers.com/showthread.php?t=1687590

And one post at the end explaining that they fixed it with an app called SELinux Switch:

https://forum.xda-developers.com/showpost.php?p=79689054&postcount=267

SELinux Switch would allow me to turn off the protection preventing adbd insecure from working. Can I get some feedback about this? I'm not enjoying this stuff, and I really need to get back to other endeavors, so it'd be a one-time use, and then I will probably uninstall it from my phone because I won't need it.

ALTERNATIVE PLANS

I also have two alternative "paths" I could take to attempt to recover the deleted photos. I'd rather not do that right now, because I don't think I have time, and because I am trying to avoid anything that would overwrite the deleted photos, but they exist nonetheless:

Alternative 1: Droidexplorer and busybox

I already have droidexplorer installed on my PC and my phone is rooted, so I guess I could install busybox and see if droidexplorer can recover the deleted photos.

Alternative 2: Magisk with/without busybox

I would rather not do this, because it sounds like it would take the most time and more monkeying around with internal storage, but apparently adbd insecure isn't an active project anymore and most people use magisk for rooting, etc. This is an alternative, but it's the least attractive option.

What do people think? For now I am going to try the SELinux switch, since it seems the simplest way. If people could please try to avoid using too much jargon and explain commands, etc. it would really help out; that way I wouldn't need to look up unfamiliar terms first.

  • 2
    As the phone is already rooted: why not working directly on the device using adb shell? An approach would be to extract the userdata partition (storing the image e.g. on an SD card or directly to the PC), then extracting your contents on PC using e.g. TestDisk/PhotoRec. You could use my tool Adebar to create scripts for that ("partition backup"), though that would require either Linux or Cygwin. Example command line if you know the partition: adb exec-out "su -c 'cat /dev/block/mmcblk0p46'" > "images/userdata.img" – Izzy Aug 28 '20 at 06:52
  • Adb insecure is very old and I would assume that no one still uses it (if you really want an insecure adbd you have to manually patch the adbd version installed on your device). The same is true for Droidexplorer. – Robert Aug 28 '20 at 08:10
  • I should have been more clear; I can do adb shell su and lots of other commands, but I can't do anything that requires root, despite being rooted. My understanding is that /userdata is protected and requires root access; searching the internet reveals that many people using adbd insecure are prevented from root access in android 5.1.1 and higher, because SELinux doesn't allow it, and something about the kernel prevents changing the enforcement status manually. – An_Asymptote Aug 28 '20 at 08:16
  • Attempting adb shell su and then adb root briefly starts the adb daemon and then it says "error: device not found". Using setenforce=0 to change the SELinux status from enforced to permissive doesn't work (getenforce gives "enforced" as a result). In addition, patching adbd while in USB debug mode kicks me out of USB debug even if I have that box ticked in the developer menu. Unless Magisk has the ability to get around this somehow, it sounds like rebuilding the kernel without the automatically enforced SELinux setting is the only way out. – An_Asymptote Aug 28 '20 at 08:21
  • Robert, do you suppose you could recommend an alternate method that doesn't involve doing anything that would wipe /data/userdata? If you don't know any, that's okay, but I'm trying to find other ways to do this and apparently Magisk setup inherently wipes the device. Finally, I know I'm "shouting into the void", but it's REALLY stupid that there isn't some way to prevent accidents like this. It should be much easier for a user to recover data than this. – An_Asymptote Aug 28 '20 at 08:24
  • just to avoid confusion, there is no such /data/userdata – alecxs Aug 28 '20 at 10:59
  • samsung kernel doesn't allow selinux permissive (however you could double check with this app) be aware every install will heavily decrease your chance to recover deleted files – alecxs Aug 28 '20 at 11:04
  • adb shell su -c "cat /dev/block/dm-0 2> /dev/null" > userdata.img https://android.stackexchange.com/q/219346 (linux only) – alecxs Aug 28 '20 at 11:22

0 Answers0