Problem with adb push command read-only file system - android

I am trying to copy a file via cmd Windows 7 to a Samsung Tablet but I get the following message:
remote could not create the file.Read-only system.
Why does it happen? How can I remove it? I execute the command adb list devices and my tablet appears normally, but I cannot copy the file adb push filename /Sdcard/Android/etc.

Related

cannot change file permissions on Android Virtual Device (AVD)

I am unable to change permissions on a shell script I need to test on an Android Virtual Device (AVD). The AVD is Google Pixel 2 (API 29) - it was created via Android Studio. Using Android Debug Bridge (adb) from Android SDK on a MacBook, I did:
%adb push file.sh /sdcard/steve
The file.sh script is executable (mode 755) on the MacBook, but when it gets pushed onto the AVD, the mode goes to 660 (i.e. no longer executable). So then I do:
%adb shell
which opens up an emulator shell session. I then proceed in the AVD shell session as follows:
%generic_x86: cd /sdcard/steve
%generic_x86: chmod +x file.sh
This yields no error message and actually no message at all. There is no change to the permissions for file.sh. It remains not executable. Do I need to push the file to a different directory on the AVD? Or is there some other way to make me able to change file permissions once it is pushed onto the AVD (emulator)? Note: I have looked at the Android Studio "Device File Explorer" where one can create files and directories on the AVD, however, one cannot change permissions on the files. TIA for any tips,Steve
OK - I seemed to have solved this via what I would call circuitous means. As mentioned earlier, I can push a file to my AVD via:
%adb push file.sh /sdcard/steve
The problem was then I could not change permissions on this file. I found out the command "run-as (classname)" gave me the ability to do a chmod. So the sequence is this:
%adb push file.sh /sdcard/steve
%generic_x86:run-as com.example.helloworld
%generic_x86:cd /data/data/com.example.helloworld
%generic_x86:mkdir steve
%generic_x86:cd steve
%generic_x86:cp /sdcard/steve/file.sh .
%generic_x86:chmod +x file.sh
Now I'm off to the races. Interestingly, the one location on the AVD I can push files to is /sdcard. Thanks to "blackapps" for your inputs.

How I can pull files from my Android Sony Xperia Z1 using ADB tool? P.S My phone is rooted

I tried on my own but failed , when I looked around I didn’t find except tool called adbd insecure which make me can run this command
“adb root”.
when I run this command I got no response on CMD and when I tried to use this program mentioned above on my phone I got an error.
when the desired action when I run the command "adb root" om my Windows 10 OS
is "adbd is already running as root" in CMD.
So far I can run "adb pull /data/data & put it everywhere on my PC".
Any help please.
Okay, so here are the steps that works for me.
I'm a Linux user so you can later convert terminal commands to windows if necessary:
Since you mentioned that your device is already rooted:
adb devices--> Make sure your device is connected.
adb shell--> runs shell command on your device.
su --> gives you root access.
cd data/data --> (data/data/xyz) is apparently the file you want to pull).
pwd--> will display the path.
copy that path and save it somewhere.
use "exit" to get out from the shell.
Once you are back in C:\Program Files (x86)\Android\android-sdk\platform-tools, run adb pull (paste the path that you copied).
Now you should have your file. Hope that helps.

How to copy file using adb to android directory accessible from PC

If you attach android device to PC you can browse files and dirs. It is possible to get this directory using Environment.getExternalStorage(). You can use it from your application and create accessible files and dirs. It works fine.
On my devices this path looks like /storage/emulated/0 and if i try adb push to this directory i will get access denied error. Is it possible to copy files using adb to the same folder as Windows Explorer does?
D:\...\tools>adb push ACCOUNTS.DB /storage/emulated/0
failed to copy 'ACCOUNTS.DB' to '/storage/emulated/0': Permission denied
58969 KB/s (606505 bytes in 0.010s)
I'm implementing automated import/export and i want files to be accessible without adb shell in case anything will go wrong.
Currently using variable$EXTERNAL_STORAGE as workaround, it works for both adb and application.
Device: Asus Fonepad 7, Android 5.0, tried Genymotion Custom Tablet 6.0 - works.
Try to use /sdcard/. Although it is strongly discouraged to do this in code. It seems to be the only way with adb :
$ adb push somefile /storage/emulated/0/somefile
[100%] /storage/emulated/0/somefile
adb: error: failed to copy 'somefile' to '/storage/emulated/0/somefile': Read-only file system
$ adb push somefile /sdcard/somefile
[100%] /sdcard/somefile
By the way, on my device they don't have the same value : Environment.getExternalStorage() points to /storage/emulated/0/ while /sdcard points to /storage/emulated/legacy.
It's pretty easy, internal storage is unavailable on non-rooted devices. So as was mentioned in bwt answer you just need to push your data to sdcard :
adb push somefile /sdcard/somefile
With retrieving files from your filesystem you'll also have few problems. But with the case of pulling a database from a debug application - you'll just need to change file permission via chmod.
Here you have a useful link - XDA guys about adb

How I can push file onto Android Device (NexusS) using eclipse or adb?

Description
I'm trying to Push file (.so library) onto Android Device (Samsung NexusS) "system\lib" folder using Eclipse. But when I press "Push a file onto the device" an error appears:
[2011-06-24 15:41:21] Failed to push
selection: Read-only file system
Researches
To solve this problem I search through internet and find some articles and documentations, but nothing helps me, here are some articles and documentations which I have tried.
Read-Only File System" when trying to ADB Push an App
Here users suggest to write adb shell sysrw, but when I an permission denied error appeared:
sysrw: permission denied
Copying Files to or from an Emulator/Device Instance
Here on Android Developers Forum I found "You can use the adb commands pull and push to copy files to and from an emulator/device instance's data file. Unlike the install command, which only copies an .apk file to a specific location, the pull and push commands let you copy arbitrary directories and files to any location in an emulator/device instance."
I also try to run adb remount command, but same permission error appeared:
remount: permission denied
Question
How I can push file onto Android Device (NexusS) using eclipse or adb ?
Typically access to system folder requires root permission, so unless you have rooted your phone i.e. you have superuser permission its not possible to access system folder or change its permission.
Check this:
Rooting samsung Nexus S,
Okay I have done rooting of my device and push files into it.
To root your Android Nexus S device check How to get root and recovery for Nexus S on Windoes 7.
After do this:
$adb shell
#mount -o remount, rw -t yaffs2 /dev/block/mtdblock3 /system
#cat (file which you want) > (destination path)
Thats All !

Moving files to SDcard on Android

How do I put a file onto an sdcard using command line? I tried by using the adb push command but it's not working. My file is in D:/sample.ogg. I have written:
adb push sample.ogg/sdcard/sample.ogg
It's not working. Any help would be appreciated
Thanks
In Command prompt type the following...
mksdcard -l test 10M c:/test1.img
try starting the emulator and loading the SDcard from command prompt by typing...
emulator -sdcard c:/test1.img
once emulator is started open another command prompt instance and try copying a file to SDcard by typing
adb push e:/test.png sdcard/test.png
Later try retrieving the same file from sdcard to your system by typing
adb pull sdcard/test.png d:/
see if the file has been copied in your d:/ ..try and tell me if it works for u:)
You can check my post here
http://www.anddev.org/error_while_writing_on_sdcard-t2997.html?sid=c01c1a23f34eb6bb7f97b6af99ca9816
Edit--
In the newer Android SDK's you can directly create an SD Card and start your emulator from your AVD in eclipse. You can neglect step 1 and 2 in that case and try push and pull commands directly
In your case it should be
adb push d:/sample.ogg sdcard/sample.ogg

Categories

Resources