Question Write to /data/... folder - Google Pixel 6a

I just switched to the Pixel 6a and have botched something with an app I use.
I have the app's files from the old phone, which were in /data/data/com... folder, and want to overwrite files on the new phone, with them.
I did "adb pull ..." on the old phone to get files on the computer and intended to do "adb push ..." to the new,
but I can't get it to connect to adb, in recovery mode.
The old phone had TWRP.
When I rebooted it into recovery and connected with cable to PC, "adb devices" would print:
List of devices attached
<device_ID> recovery
On the new one, when I go into recovery (stock), "adb devices" prints nothing.
When I select the sideload option, "adb devices" prints:
<device_ID> sideload
In this sideload mode, the pull, push, shell... adb commands don't work.
How can I get the Pixel 6a to connect to the computer so that "adb devices" prints:
<device_ID> recovery
?

Stock recovery isn't TWRP! You have no access to anything in your file system.

Svrmirac said:
How can I get the Pixel 6a to connect to the computer so that "adb devices" prints:
<device_ID> recovery
?
Click to expand...
Click to collapse
Use TWRP. Stock recovery has no adbd, only a minimal adbd with no features except a sideload option for signed update.zips

Thank you for the suggestion, @WoKoschekk, but I don't think I can do that.
If I understand correctly, I have to unlock the bootloader to load TWRP.
With an unlocked bootloader, my banking app stops working, which is unacceptable,
and re-locking it apparently wipes all data, which I just jumped through hoops overwriting.
I seem to be at an impasse, with the stock ROM/recovery.

Svrmirac said:
If I understand correctly, I have to unlock the bootloader to load TWRP.
With an unlocked bootloader, my banking app stops working, which is unacceptable,
and re-locking it apparently wipes all data, which I just jumped through hoops overwriting.
Click to expand...
Click to collapse
Yes, (un-)locking wipes all data. But that is exactly the reason why /data is inaccessible from recovery. To keep your data safe.

I don't even think TWRP is a thing for modern pixels

ctfrommn said:
I don't even think TWRP is a thing for modern pixels
Click to expand...
Click to collapse
No it isn't the closing thing you'll find to TWRP on Pixel 6A is the Lineage Recovery.
I would suggest using a tool like Titanium Backup. That allows the saving and reinstating of apps.

Booting a custom recovery requires unlocking the bootlader, which I don't want to do now.
Titanium backup requires rooting as well...
Thank you for the suggestions but I'm counting this one as lost.

You won't be able to directly write to the /data/data/com.your.packagename folder without root. The only options I can think of are
1. Using adb backup... backup your app data from your old phone and restore it to the new phone
Bash:
To backup
# adb backup -noapk com.your.packagename -f backup.adb
To restore
# adb restore backup.adb
2. If the app in question is debuggable, you can assume the application permission and access the folder
Bash:
# adb shell
bluejay:/ $ run-as com.your.packagename
bluejay:/ $ cp -r /storage/emulated/0/Download/backup/* /data/data/com.your.packagename

Related

[Guide] Backing up BlackShark (and other models too)

Hello, this guide explains how to backup your phone. This guide is intended for the BlackShark (SKR-H0), but works on other models, and other phones too.
So let's begin.
First of all, unlock your phone. This might void your warranty. Expect to lose all data on your device, so backup your internal storage to a pc or a cloud or something.
Boot your recovery (fastboot boot yourrecoveryfilename.img)
When inside the recovery (twrp example), it might ask you to enter a password, or swipe to allow modifications. Just ignore it and do nothing.
Now, connect your phone to your pc, and run the following adb command:
adb shell ls /dev/block/bootdevice/by-name/
You will get a list of files. Those are your phone partitions. You are going to back them up.
For every file (except for userdata, which contains the storage) you find, run the following command:
adb pull /dev/block/bootdevice/by-name/<filename> <filename>.img
Examples:
Code:
adb pull /dev/block/bootdevice/by-name/system_a system_a.img
adb pull /dev/block/bootdevice/by-name/system_b system_b.img
adb pull /dev/block/bootdevice/by-name/boot_a boot_a.img
....
Now you have a full backup. Enjoy it and keep it safe. When you **** up, this backup might be the only thing to save you.
I am late, I have updated to Pie and now TWRP is not working.
or do you have TWRP that works on Pie?
goonoth said:
I am late, I have updated to Pie and now TWRP is not working.
or do you have TWRP that works on Pie?
Click to expand...
Click to collapse
What do you mean it's not working?
gilbert32 said:
What do you mean it's not working?
Click to expand...
Click to collapse
when I push twrp with fastboot boot twrp.img its restart to system instead of recovery.
I think TWRP from https://forum.xda-developers.com/android/development/recovery-unofficial-twrp-recovery-t3892707 is not support on Pie yet.
Or do you have another recovery for Pie?

Someone smashed my phone with a rock. (data recovery ?s)

Greetings et al,
Backstory: I climb large granite walls and my phone was left part way up and a party following found my phone and decided to smash the crap out of the screen. They left it on prominently displayed along a trail on a rock and someone else I knew found it and returned it to me.
Device: Google Pixel 3
Status: Screen smashed to bits, but I can power it on and see it in "adb devices" etc...
So it was this past Sunday that the scalawags smashed my phone. Saturday I had taken my daughter and son-in-law on their first ever large/multi-pitch rock climb, 600ft. plus. Unfortunately I had no downloaded the pictures of that event nor the videos.
* I don't know how to get this device in MTP mode so I can transfer the data w/o a screen
* I tried to shell to it and I get "error: insufficient permissions for devices"
* Does anybody have any suggestions on what path I should head down to attempt to pull the files off this thing?
-Thanks in bunches for any and all replies...
nemanator said:
Greetings et al,
Backstory: I climb large granite walls and my phone was left part way up and a party following found my phone and decided to smash the crap out of the screen. They left it on prominently displayed along a trail on a rock and someone else I knew found it and returned it to me.
Device: Google Pixel 3
Status: Screen smashed to bits, but I can power it on and see it in "adb devices" etc...
So it was this past Sunday that the scalawags smashed my phone. Saturday I had taken my daughter and son-in-law on their first ever large/multi-pitch rock climb, 600ft. plus. Unfortunately I had no downloaded the pictures of that event nor the videos.
* I don't know how to get this device in MTP mode so I can transfer the data w/o a screen
* I tried to shell to it and I get "error: insufficient permissions for devices"
* Does anybody have any suggestions on what path I should head down to attempt to pull the files off this thing?
-Thanks in bunches for any and all replies...
Click to expand...
Click to collapse
Since you don't have USB debugging enabled and can't swipe the screen to unlock the lockscreen, there aren't really any options for you other than replacing the screen or sending the device to a professional shop to see if they can retrieve the data from the hardware by pulling it directly from the chip.
Sent from my SM-S767VL using Tapatalk
Droidriven said:
Since you don't have USB debugging enabled and can't swipe the screen to unlock the lockscreen, there aren't really any options for you other than replacing the screen or sending the device to a professional shop to see if they can retrieve the data from the hardware by pulling it directly from the chip.
Sent from my SM-S767VL using Tapatalk
Click to expand...
Click to collapse
I do have USB debugging enabled.
nemanator said:
I do have USB debugging enabled.
Click to expand...
Click to collapse
Ok then, you might have an option. If there is a TWRP custom recovery for your specific model number, TWRP natively supports adb so it should work. You don't have to root but you can try flashing TWRP recovery on your device and then boot into TWRP then connect to PC and use adb with the "adb backup" command to backup all user data then extract the data that you want from the backup.
To find instructions for adb backup, do a google search for:
"ADB backup/restore"
Find the command to backup user data.
Sent from my SM-S767VL using Tapatalk
Droidriven said:
Ok then, you might have an option. If there is a TWRP custom recovery for your specific model number, TWRP natively supports adb so it should work. You don't have to root but you can try flashing TWRP recovery on your device and then boot into TWRP then connect to PC and use adb with the "adb backup" command to backup all user data then extract the data that you want from the backup.
To find instructions for adb backup, do a google search for:
"ADB backup/restore"
Find the command to backup user data.
Sent from my SM-S767VL using Tapatalk
Click to expand...
Click to collapse
I'm getting device unauthorized at this point so now adb doesn't work. I'm not sure what changed to cause that. It was working. I had/have twrp installed. I tried a "flashboot boot twrp.img". I had to temp boot like this when I was rooting this thing. The fastboot flash w/ twrp.img bricked the phone. Anyway, after a flashboot boot twrp.img. adb devices lists nothing. So either it's not booting twrp.img successfully or I'm missing something.
nemanator said:
I'm getting device unauthorized at this point so now adb doesn't work. I'm not sure what changed to cause that. It was working. I had/have twrp installed. I tried a "flashboot boot twrp.img". I had to temp boot like this when I was rooting this thing. The fastboot flash w/ twrp.img bricked the phone. Anyway, after a flashboot boot twrp.img. adb devices lists nothing. So either it's not booting twrp.img successfully or I'm missing something.
Click to expand...
Click to collapse
Ah, your bootloader is locked, that is probably why you previously had to boot a TWRP .img instead of flashing it. Now, I'm not sure it will boot anything. Try flashing a copy of stock recovery, then try the fastboot boot TWRP again.
Other than that, I think you might be at the end of your rope.
Sent from my SM-S767VL using Tapatalk
Droidriven said:
Ah, your bootloader is locked, that is probably why you previously had to boot a TWRP .img instead of flashing it. Now, I'm not sure it will boot anything. Try flashing a copy of stock recovery, then try the fastboot boot TWRP again.
Other than that, I think you might be at the end of your rope.
Sent from my SM-S767VL using Tapatalk
Click to expand...
Click to collapse
The device unauthorized was from the windows machine. I'm back on the linux box and adb can see the device again. I've tried oodles of ways of getting mtp enabled.
When in adb shell and trying to find my photos/videos, I'm getting funky filenames.
sargo:/storage/emulated/0 # ls
+dn0VjXCwXIGBTRlAAdSqA NKZ4osL+U6zJbQICkOBoOB VqEBnQxs1hu4ncv3woVfCB kmOAbyd,bVAJDnQSbomLyA wXQ6rmjvahUKbZQtHof35D
7CdpRTZ8PchPMx4DOUvlLD OuATvxF3HNScfmEIoaabiB Ya0QbX5aki6BstVDxMXi5LRPcRD nZETC6WByAa5h7jO2tDyqC
I didn't have much success with mtp when my phone was screen was operational but at least I could see and navigate to the DCIM folder. I'm not sure why adb shell is rendering the files as such.
nemanator said:
The device unauthorized was from the windows machine. I'm back on the linux box and adb can see the device again. I've tried oodles of ways of getting mtp enabled.
When in adb shell and trying to find my photos/videos, I'm getting funky filenames.
sargo:/storage/emulated/0 # ls
+dn0VjXCwXIGBTRlAAdSqA NKZ4osL+U6zJbQICkOBoOB VqEBnQxs1hu4ncv3woVfCB kmOAbyd,bVAJDnQSbomLyA wXQ6rmjvahUKbZQtHof35D
7CdpRTZ8PchPMx4DOUvlLD OuATvxF3HNScfmEIoaabiB Ya0QbX5aki6BstVDxMXi5LRPcRD nZETC6WByAa5h7jO2tDyqC
I didn't have much success with mtp when my phone was screen was operational but at least I could see and navigate to the DCIM folder. I'm not sure why adb shell is rendering the files as such.
Click to expand...
Click to collapse
If adb is working, try this:
https://stackoverflow.com/questions/54959259/enable-mtp-using-adb
Or this:
https://forum.xda-developers.com/showthread.php?t=2786395
Sent from my SM-S767VL using Tapatalk
Droidriven said:
If adb is working, try this:
https://stackoverflow.com/questions/54959259/enable-mtp-using-adb
Or this:
https://forum.xda-developers.com/showthread.php?t=2786395
Sent from my SM-S767VL using Tapatalk
Click to expand...
Click to collapse
Well I believe I mucked it up worse. I used the command line to do a set persistent mode to mtp and forgot to add adb e.g. "mtp,adb"
I forget the specific syntax but it worked. I'm in MTP mode persistently but I'm not able to mount the device from windows or linux and both operating systems see the device.
I have no idea how I'm going to get back to adb mode.
Anybody have a clue as to why I cannot see the proper file names in /storage/... ?
Does MTP mode do some magic and decrypt the files or something?
They file names looked to be encrypted when I was able to get at the file system with adb.

Cant get ADB in recovery mode, but works in live mode, and so does fastboot

On my Rooted Pixel 4a, I can use:
Fastboot - I flashed the latest update firmware as well as the rooted boot image
ADB Over WiFi - This is the most comnon way I connect for ADB
ADB While the Android OS is running
What I cannoit get woirking is ADB while in recovery mode,
If I go to recovery and connect via a high quality cable, I can see the device with
Code:
adb devices
C:\Java\x86\Android\android-sdk\platform-tools>adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
091????????490 rescue
Click to expand...
Click to collapse
But none of the below works
Code:
>adb shell
error: closed
>adb connect 091XXXXXXXX490
cannot resolve host '091XXXXXXXX490' and port 5555: No such host is known. (11001)
>adv shell 091XXXXXXXX490
error: closed
What am I doing wrong? how can I connect in recovery?
Stock recovery?
WillisD said:
Stock recovery?
Click to expand...
Click to collapse
Yes.
DiamondJohn said:
What I cannoit get woirking is ADB while in recovery mode
Click to expand...
Click to collapse
I always thought that adb from recovery was a TWRP thing?
I did adb reboot recovery. My phone has an Android on its back, with "No command" on the screen.
Code:
$ adb devices
List of devices attached
xxx unauthorized
$ adb shell
adb: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
I got the same thing booting to recovery by holding Vol down at boot.
Booting to rescue (another option on the boot menu) got me the same thing on my screen and the same symptom you saw.
Code:
$ adb devices
List of devices attached
xxx rescue
$ adb shell
error: closed
Are you sure this is supposed to work with the stock recovery?
a1291762 said:
Are you sure this is supposed to work with the stock recovery?
Click to expand...
Click to collapse
Actually no, i guess it was an assumption, and the response to adb devices, gave me further hope.
However,, it does respnod to ADB. As is seen, it provides a list of devices. But, maybe one can't shell out while in stock recpvery. Which goves me an idea, maybe we can send commands from the command window in windows/linux. eg adb shell ls But it wouldn't make sense that it would allow root, which negates what I wanted to be able to do in the first place. ie recovery from a bootloop by selectively editing the data partition. in my previous case, it was to disable a single magisk module.
DiamondJohn said:
It wouldn't make sense that it would allow root, which negates what I wanted to be able to do in the first place. ie recovery from a bootloop by selectively editing the data partition. in my previous case, it was to disable a single magisk module.
Click to expand...
Click to collapse
Yeah, it certainly seems to be speaking adb...
I didn't think to try...but maybe adb push and pull work?

Backup HTC 10 with broken screen

Hey guys, I am trying to pull data from my HTC 10 via adb. I accidently dunked my phone in water and now my screen is black but still responsive. Phone has usb-debugging enabled but not rooted. I have a second HTC 10 which I am using for reference and a test run. When I boot into recovery, adb devices shows that the device is in sideload mode. What should I do now?
If the data of interest are stored in Android's user-space ( i.e. /storage/emulated/0 AKA /sdcard ) then you at any time can try to pull them by means of ADB
Example code what pulls entire /sdcard folder
Code:
mkdir C:\Data-Pulled
adb devices
adb pull /storage/emulated/0 C:\Data-Pulled
But I can't pull from sideload mode
jwoegerbauer said:
If the data of interest are stored in Android's user-space ( i.e. /storage/emulated/0 AKA /sdcard ) then you at any time can try to pull them by means of ADB
Example code what pulls entire /sdcard folder
Code:
mkdir C:\Data-Pulled
adb devices
adb pull /storage/emulated/0 C:\Data-Pulled
Click to expand...
Click to collapse
RogueDragon117 said:
But I can't pull from sideload mode
Click to expand...
Click to collapse
Confused.
You boot into ADB Sideload mode only if you want to re-flash phone's Stock ROM. To pull data you have to boot phone in ADB Normal mode, means into phone's Android OS.
jwoegerbauer said:
Confused.
You boot into ADB Sideload mode only if you want to re-flash phone's Stock ROM. To pull data you have to boot phone in ADB Normal mode, means into phone's Android OS.
Click to expand...
Click to collapse
The problem is that my phone is password protected. Normally when I connect my phone there is a prompt to confirm usb-debugging. I can't press yes to that prompt because I can't see it. I tried booting to recovery mode but all I could get was sideload mode. I could also load something through sd card, maybe a command somehow?
IMO the problem isn't that your phone is password protected, but that you obviously aren't knowing that on Android side ADB gets loaded/started via phone's bootloader ( keyword: init.rc -> service adbd ).
" I am trying to pull data from my HTC 10 via adb. I accidently dunked my phone in water and now my screen is black but still responsive."
I almost choked reading this ahaha is there a water bucket waiting around also how did you know its still responsive if screen is black also you provably need a screen repair at this point
You can download platform tool on computer. Open shell, use command adb backup all and also use adb pull to copy partition directory.
?
ineedroot69 said:
" I am trying to pull data from my HTC 10 via adb. I accidently dunked my phone in water and now my screen is black but still responsive."
I almost choked reading this ahaha is there a water bucket waiting around also how did you know its still responsive if screen is black also you provably need a screen repair at this point
Click to expand...
Click to collapse
There was a water bucket around. I know the screen is responsive because when I press I can hear sounds coming from the device.
Hey guys, so after letting my phone sit in the sun for two days, the screen is now functioning. I am now trying to backup adb, but it always stops around the 5GB mark.
The command I used on cmd is : adb backup -apk -all.
Did I do something wrong?
jwoegerbauer said:
IMO the problem isn't that your phone is password protected, but that you obviously aren't knowing that on Android side ADB gets loaded/started via phone's bootloader ( keyword: init.rc -> service adbd ).
Click to expand...
Click to collapse
I'm sorry, I don't understand what you are saying, I am very new to this and don't understand a lot of things.
RogueDragon117 said:
I am now trying to backup adb, but it always stops around the 5GB mark.
The command I used on cmd is : adb backup -apk -all.
Did I do something wrong?
Click to expand...
Click to collapse
IMO a complete phone backup via ADB is invoked by
Code:
adb backup "-apk -obb -shared -all -system -f C:\phone-backup.ab"
but I may err, as always ...
why not adb pull data
jjgvv said:
why not adb pull data
Click to expand...
Click to collapse
IMO the far better method because "adb backup" creates a file what is compressed and encrypted, whereas "adb pull" simply creates a file that contains the at 100% readable content of pulled data.
deleted
jwoegerbauer said:
IMO the far better method because "adb backup" creates a file what is compressed and encrypted, whereas "adb pull" simply creates a file that contains the at 100% readable content of pulled data.
Click to expand...
Click to collapse
is internal storage inside data
jwoegerbauer said:
IMO the far better method because "adb backup" creates a file what is compressed and encrypted, whereas "adb pull" simply creates a file that contains the at 100% readable content of pulled data.
Click to expand...
Click to collapse
how encrypted
@jjgvv
The Android Backup (*.ab) file is a compressed TAR. It is compressed using the DEFLATE algorithm. On top of that, there can be AES encryption used. This is determined when you create the backup: if you enter a password then the backup is encrypted, otherwise; there is no encryption, it is only compressed.
jwoegerbauer said:
IMO a complete phone backup via ADB is invoked by
Code:
adb backup "-apk -obb -shared -all -system -f C:\phone-backup.ab"
but I may err, as always ...
Click to expand...
Click to collapse
And will there be an indicator of whether the backup is complete?

problems with phone decryption

I have older device, it is htc 10.
I was using corporate MS Teams on it however at some point corporate required encryption to be done on my phone i got poop-up and trigger encryption.
Now phone consume much more power, i think because of the encryption.
I would like to decrypt the phone however there is no such button.
Any idea how to trigger this decryption without factory reset, it is Android 8.0 ?
It can't be undone normally. Back up all critical data, factory reset.
I never encrypt any device as it will come back to bit you sooner or latter.
-Never- encrypt backup data drives or set PC bios passwords. You are the one most likely to get locked out, sometimes through no fault of your own!!!
seba.kwiat said:
...
I would like to decrypt the phone however there is no such button.
Any idea how to trigger this decryption without factory reset, it is Android 8.0 ?
Click to expand...
Click to collapse
3 methods possible
1.
You can turn your device's /data partition to an unencrypted state if you do a backup of this partition via the adb backup command and play back the backup via the adb restore command.
2.
Boot phone into recovery and then from your computer run
Code:
adb shell "recovery --set_filesystem_encryption=off"
3.
If you need to run it from the phone itself (ie: you don't have a computer nearby to adb with): in a terminal window run
Code:
recovery --set_filesystem_encryption=off
jwoegerbauer said:
3 methods possible
1.
You can turn your device's /data partition to an unencrypted state if you do a backup of this partition via the adb backup command and play back the backup via the adb restore command.
2.
Boot phone into recovery and then from your computer run
Code:
adb shell "recovery --set_filesystem_encryption=off"
3.
If you need to run it from the phone itself (ie: you don't have a computer nearby to adb with): in a terminal window run
Code:
recovery --set_filesystem_encryption=off
Click to expand...
Click to collapse
Could u recommend any terminal app, I have tried a couple but looks like recovery command is missing on them?

Categories

Resources