Android - adb pull /data fails
Files and directories below /data/data
are protected from the "average user", so you cannot simply "pull" them unless the ADB daemon is running in root mode. Other than the file you were referring to (/system/buildprop
is at least readable by all apps), folders below /data/data
are "invisible" (except for root), so they cannot even be read.
To be able to use adb pull
on them, you need to make your ADB daemon run in root mode first. Depending on the device, a simple adb root
command might do that – but most devices will refuse to do. In those cases, you can use chainfire's adbd insecure: Install this app on your device, start it there, and manually switch to "insecure" mode. Now the pull
should succeed.
Remark: It's called "insecure" because running adbd
as root gives everybody with a computer and an USB cable access to everything on your device. Just in case you wonder.
If your phone's rooted, there are three ways to go around this. The first one is to use ADBD insecure.
The other one is to move it to another folder with root and then pull it from there:
$ adb shell
shell@android:/ $ su
root@android:/ # mkdir /sdcard/data
root@android:/ # cp /data/data/* /sdcard/data
root@android:/ # exit
shell@android:/ $ exit
$ adb pull /sdcard/data .
$ adb shell
shell@android:/ $ rm -r /sdcard/data/
shell@android:/ $ exit
I think you can build a script such as:
echo 'echo "mkdir /sdcard/data; cp $1/* /sdcard/data; exit" | su; exit' | adb shell
adb pull /sdcard/data .
echo 'rm -r /sdcard/data; exit' | adb shell
and save it somewhere.
Finally, the third option is chmod -R 1777 /data/data
, but this is much more unsafe, so it's highly discouraged.
You cannot pull data folder directly since adb doesn't have file listing access to it. If you want to pull the /data folder you can do it via recovery ([Custom recovery, CWM/TWRP] run adb while device is in recovery mode, hopefully a custom recovery). Or as root, copy /data to another directory (sdcard) and pull it from there.