4

The Android device I am using does not hold sqlite3 on it, so i thought to push it to the device after pulling it from the AVD.

I had no problem pulling it from the AVD, though I cannot push it to the device since I need to enable a write permission. I tried to follow sqlite3: not found

I tried the following

$ adb -d shell
$ mount
mount
rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,relatime,mode=111 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/usb tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /app-cache tmpfs rw,relatime,size=7168k 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/dev/block/mmcblk0p9 /system ext4 ro,relatime,barrier=1,data=ordered 0 0
/dev/block/mmcblk0p7 /cache ext4 rw,nosuid,nodev,noatime,barrier=1,data=ordered
/dev/block/mmcblk0p1 /efs ext4 rw,nosuid,nodev,noatime,barrier=1,data=ordered 0
nil /sys/kernel/debug debugfs rw,relatime 0 0
/dev/block/mmcblk0p10 /data ext4 rw,nosuid,nodev,noatime,barrier=1,data=ordered,
/dev/block/mmcblk0p4 /mnt/.lfs j4fs rw,relatime 0 0
/dev/block/vold/179:11 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,noatime,n
epage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro,discard 0

I followed this link and tried to mount the filesystem as follows but I got a permission error.

$ mount -o rw,remount -t yaffs2 /dev/block/mmcblk0p9 /system
mount: Operation not permitted 

Any clue what is needed to be done in order to push sqlite3 into an Adroid device for debugging reasons?

Community
  • 1
  • 1
Mr.
  • 9,429
  • 13
  • 58
  • 82

3 Answers3

22

Edit: Found a better solution

From host machine(Linux or windows PC), execute the following commands.

>> adb root
>> adb remount

remount will by default remount the /system partition with rw, if you have the permissions.

The Note 1 and 2 mentioned below are still applicable.


Old way

To remount a mounted system you need to have root privileges. Do an su. You will enter root mode. Then run the below command. It will work, I did it many a times.

So here are the steps:

 adb shell 
 su
 mount -o rw,remount /system

Note 1: To execute the commands su or adb root, your device must be rooted and have su executable on it. If the command su is successful, terminal prompt will change from $ to #.

Note 2: In recent mobiles, Security has been tightened, and even after rooting the phone, adb remount wouldn't work. As of i know, there is no solution available for it so far.

Sandeep
  • 18,356
  • 16
  • 68
  • 108
  • Firstly, thank you for your answer. I know I have to use super user mode (`su`), but I will have to root my device. Is there any way to bypass that? I just wish to copy the `sqlite3` binary for debugging. – Mr. Apr 24 '12 at 09:18
  • If you want to use sqlite library with some specific app, you can include it in jni folder, build it using Android NDK, and then use it inside the application. Yes this is possible. You can refer the solution i posted here http://stackoverflow.com/questions/10169336/can-i-use-the-native-libraries-installed-in-android-stack-in-my-ndk-applicatio/10169880#comment13048836_10169880 But doing this way, only your app can use sqlite. – Sandeep Apr 24 '12 at 09:21
  • Have you tried this with a rooted Android device running LineageOS? I keep having problems with remounting the file system in RW mode. I do have root permissions though. Any ideas? – warfreak92 Sep 15 '17 at 06:30
  • LineageOS - Not sure what it means. But the failure could be because of the extra security taken by OEM's or could be because of selinux violation.. you can look into the kernel log to see who is denying you with remount. – Sandeep Sep 15 '17 at 10:27
0

As mk points out, many newer phones have adb root and adb remount disabled. My LGL34C is locked out, and adb is pretty much only useful for pulling in the protected areas of the filesystem.

But there IS a way around it (there's ALWAYS a way)! You still need a rooted phone with su installed, of course. Install a shell terminal and/or sshd service on the phone. Remount and writing to /system work just fine from the local OS.

0

the main reason you didnt have permissions...no root on that script hince the $ su turns that into a # i believe....