Android SQLite db pull error - android

i am trying to pull db from my app but i keep getting this error in eclipse->DDMS->FileExplorer
[2014-08-07 12:53:03 - ddms] transfer error: Permission denied
[2014-08-07 12:53:03] Failed to pull selection: Permission denied
i tried to do it from CMD with this command
C:\Android\sdk\platform-tools>adb -d shell
shell#android:/ $ run-as com.iqpandroid
run-as com.iqpandroid
run-as: Package 'com.iqpandroid' has corrupt installation
as u can see the message that installation has currupt installation.. can somebody help?

Execute this command from terminal:
adb root - restarts the adb daemon with root permissions

As far as I am aware you will need to have root access.
From terminal:
adb shell
su
chmod -R 777 /data/data/com.your.package

Related

How to change permission of internal folder/file in android?

I wanted to get database file from the emulator. So, I tried to change the permission of package folder using adb shell. When I use the below command:
adb shell su -c chmod 777 /data/data/com.mypackage.test
It always returns:
Chmod: need 2 arguments
I have changed permission some days ago using above command. But recently I'm always getting the above warning. I have searched a lot and found large information regarding using above command but no one mentioned about this warning issue.
I have overcome this issue instead of running adb shell su -c "chmod 777 /data", I run the adb shell first and then the following command : su -c "chmod 777 /data".
I have overcome this issue : adb shell su -c 'chmod 777 /data/data/com.mypackage.test'

- ddms] transfer error: open failed:Permission denied

I get a trouble when learning android Data-Persistence.
I changed the daenter image description hereta/data/com.flexible.filepersistencetest/files/data permission to 777. But I still can't pull it to my PC.
when I try to delete Nexus_5_API_24.avd 's permission of Read-Only, the Read-Only will be back.
It really exaust me.
Any advice is ok, thank you very much!
change file permissions.
C:\Android\sdk\platform-tools> adb shell
generic_x86:/ $ su
generic_x86_64:/ # chmod -R 777 /data
generic_x86_64:/ # exit
run the below commands under the terminal in Android studio integration.
C:\Android\sdk\platform-tools> adb shell
generic_x86:/ $
generic_x86:/ $ exit
$ adb root
restarting adbd as root
$ adb shell
generic_x86:/ # exit
open cmd windows.
C:\Android\sdk\platform-tools> adb pull /data/data/xxxx C:\Android\sdk\platform-tools
or use "pull" button

Why am I getting Permission Denied when trying to push a Sqlite file to my rooted Android device?

So I have a local Sqlite file I am trying to push to my Rooted Android (Nexus 7 2013) device. Which I have confirmed is Rooted by tying adb shell, su and seeing the # displayed instead of $
I am trying to run the following command:
adb push D:\tfs\MyApp\MyDatabase.db3 /data/data/MyApp/files/MyDatabase.db3
But I keep getting
Failed to copy ...MyApp.. to ...MyApp...: Permission denied
I have searched the internet and found answers here and here and have come up with the following:
adb shell su -c "mount -o rw,remount /data"
adb shell su -c "chmod 777 /data"
But even after running these two above commands and running my Push Command I am still getting Permission Denied.
What am I doing wrong?
'adb push' cannot push to data/data/ directory.
However, you can do it by using a transfer station like this:
adb push D:\tfs\MyApp\MyDatabase.db3 ~/sdcard/MyDatabase.db3
adb shell
su
mv /sdcard/MyDatabase.db3 /data/data/MyApp/files/MyDatabase.db3
It works for me,good luck to you.
To push an APK file Eg:"MyApp" to /data/local/tmp/ from my local C:/Apps
adb push C:/Apps/MyApp /data/local/tmp/ is giving Permission Denied error
Steps to make this work (issue these commands in an order)
adb shell
su
chmod 777 /data/local/tmp/
exit
chmod 777 /data/local/tmp/
exit
Now if i give adb push, it worked
adb push C:/Apps/MyApp /data/local/tmp/
Simple solution:
Instead of:
.\adb.exe push c:/files-to-push.zip /mnt/sdcard/Download
I used:
.\adb.exe push c:/files-to-push.zip /sdcard/Download
The problem I had
After going to adb folder(in my case c:/adb)
I connected with:
.\adb.exe connect 127.0.0.1:58526
And then I tried to push this zip file c:/Games/pokemon.zip by running:
.\adb.exe push c:/Games/pokemon.zip /mnt/sdcard/Download
I got this error:
adb: error: stat failed when trying to push to /mnt/sdcard/Download: Permission denied
Explaining my solution:
I was trying to push files to a path that does not exist...
In my case I tried to push to /mnt/sdcard/Download
Then after running adb shell I got access to console
Finally just typed ls to check which folder I had there
In my case I saw there was no /mnt
So after that I tried to ls /sdcard and saw Download folder there...
Ok so heres my solution.
My phone was already Rooted but for some reason this isnt enough to do anything you want.
I had to go and download the apk onto my device named adbd insecure mentioned here which you can download on that thread or from the google play store. I then had to open the App on my device and click "Enable Insecure adbd" and I also clicked "Enable at boot"
After this running my normal command:
adb push D:\tfs\MyApp\MyDatabase.db3 /data/data/MyApp/files/MyDatabase.db3
worked
Run the commands below:
adb root
or
adb wait-for-device root && adb remount

Cannot adb pull database even after chmod 777 on my device

I am unable to pull a the database from the device even after changing the permission. I have a rooted phone.
It used to work. I could pull before. For some unknown reason now I cannot.
The error I receive is
remote object '/data/data/com.thuptencho.transitbus/databases/ttc.db' does not exist
Does anybody know why this is happening?
Below is what I did in command window.
C:\users\thupten>adb shell
shell#android:/ $ su
su
root#android:/ # cd /data/data/com.thuptencho.transitbus/databases/
cd /data/data/com.thuptencho.transitbus/databases/
root#android:/data/data/com.thuptencho.transitbus/databases # ls
ls
ttc.db
ttc.db-journal
webview.db
webview.db-journal
webviewCookiesChromium.db
webviewCookiesChromiumPrivate.db
root#android:/data/data/com.thuptencho.transitbus/databases # chmod 755 ttc.db
5 ttc.db <
root#android:/data/data/com.thuptencho.transitbus/databases # chmod 777 ttc.db
7 ttc.db <
root#android:/data/data/com.thuptencho.transitbus/databases # exit
exit
shell#android:/ $ exit
exit
C:\users\thupten>adb pull /data/data/com.thuptencho.transitbus/databases/ttc.db
remote object '/data/data/com.thuptencho.transitbus/databases/ttc.db' does not exist
I using these commands to get data from /data/data folders, no changing permission required
adb kill-server
adb root
I figured it out.
I had to chmod the databases folder as well and then the file.
The problem is that you need permission not just to the file, but also to its parent directories.
(That permission should not be 777 though!)
Rather than trying to change the permission, what you probably want to do is get adb running as root if that is supported, (ie, if you have an engineering build, rather than an aftermarket "rooting" of a secured device) or else use your root access (or the app itself, or the stock run-as command if you have a debug apk) to copy the file of interest somewhere accessible and then adb pull the copy.
My preferred solution was:
Install Chainfire's adbd insecure app
From within the adbd insecure app, select "Enable Insecure adbd"
adb pull /data/data/com.package.name/databases/database.db
Caution - adb insecure means adb is running as root on your device.
for i in `adb shell ls /data/ -1`;do adb pull /data/$i data; done

Attempting to gain r/w access to android /system

Working on a root script for the Nexus 4 with the latest stock rom .img for google (occam) and I have the following code snippet:
./adb wait-for-device
echo "remounting system"
./adb shell "mount -o remount,rw /system"
./adb push su /system/bin/
echo "pushing super user"
./adb push Superuser.apk /system/app/
echo "pushing busybox"
./adb push busybox /system/xbin/
./adb shell "chmod 06755 /system/bin/su"
./adb shell "chmod 0644 /system/app/Superuser.apk"
./adb shell "chmod 04755 /system/xbin/busybox"
./adb shell "cd /system/xbin"
./adb shell "busybox --install /system/xbin/"
I keep getting the error
mount: Operation not permitted
failed to copy 'su' to '/system/bin//su': Read-only file system
pushing super user
failed to copy 'Superuser.apk' to '/system/app//Superuser.apk': Read-only file system
pushing busybox
failed to copy 'busybox' to '/system/xbin//busybox': Read-only file system
Unable to chmod /system/bin/su: No such file or directory
Unable to chmod /system/app/Superuser.apk: No such file or directory
Unable to chmod /system/xbin/busybox: No such file or directory
/system/bin/sh: busybox: not found
I've tried using multiple methods of obtaining r/w access, but nothing seems to be working. I have to automate this process due to the fact that other people will use the script so it needs to be automation friendly, but I just can't figure this out.
I've also tried the
#su
#mount
#mount | grep system
followed by inputting the partition with the system mount and changing it to r/w access, but that also hasn't worked.
Really frustrated at this point. Can anyone help?
It gives the error because you aren't root. The system partition is mounted read-only. You can try to push the binary to /data/local/tmp. Then you can make su executable and eventual run it. But it doesn't mean you can have root. To become root you need to push an exploit like psneuter to /data/local/tmp and run it. It crashes the shell and reopen a new one with root rights. Then you can remount the system-partition read-write and install su.
Try the commands below
adb shell "su -c mount -o remount,rw /system"
adb shell "su -c chmod 06755 /system/bin/su"
and so on.

Categories

Resources