I'm trying to install rsyncdroid app in my emulator using the following steps:
$ ./adb push rsync /sdcard/rsync
$ ./adb shell mount -o remount,rw /system
$ ./adb shell "cat /sdcard/rsync > /system/bin/rsync"
$ ./adb shell chmod 755 /system/bin/rsync
$ ./adb shell mount -o remount,ro /system
I'm getting stuck on step 2, which results in the error:
cannot create /system/bin/rsync : not enough memory in emulator
The System partition of the standard avd's have not much free space. You can start the emulator on the command line, adding the following parameter:
-partition-size <size>
alternatively you can also declare the partition size in the command line options of your android run/debug configuration in eclipse.
Have you created new AVD ?? Use SDKManager to create new AVD. and assign 1000 MB to SDCard
Related
I want to be able to write to /system in my Android Studio Emulator. I've made sure to use a rootable, non-Google Play Services AVD. I'm currently using the Pixel 2 - API 28 AVD (targets Android 9.0).
I've made sure to run adb root and that works, though adb remount gives remount of the / superblock failed: Permission denied as an error. (I also tried running adb disable-verity and rebooting before remounting, but I still get the same remount error.)
I've tried adb shell mount -o rw,remount /system, but I get mount: '/system' not in /proc/mounts.
I've also tried
adb shell
su
mount -o rw,remount /system
but get the same mount: '/system' not in /proc/mounts error
(I've tried it without /system too. It appears to work, but if I then try to write to /system, I get mv: /system: Read-only file system)
I've tried emulator -avd -writeable-system but I get 'emulator' is not recognized as an internal or external command, operable program or batch file.
Can someone please help me figure out how to run the emulator in such a way that I can write to /system?
On Windows open a command prompt/power shell in C:\Users\YourUser\AppData\Local\Android\Sdk\tools and execute
.\emulator.exe -writable-system -avd Pixel_2_API_28
In another command prompt/power shell in C:\Users\YourUser\AppData\Local\Android\Sdk\platform-tools execute
.\adb.exe remount
On Linux you can use the the following commands:
$ANDROID_HOME/tools/emulator -writable-system -avd Pixel_2_API_28
adb remount
I'm trying to setup hosts file for android emulator. I saw this advice:
adb remount
adb push hosts /etc/system/hosts (most tutorials suggest
this file)
adb push hosts /system/etc/hosts (some VM systems seem to
prefer this file instead!, for me this worked)
But when I do adb remount it writes "remount of the / superblock failed: Permission denied". I'm going to adb shell, but it also writes an error.
generic_x86:/ # mount -o remount,rw /system
mount: '/system' not in /proc/mounts
1|generic_x86:/ # mount -o rw,remount,rw /system
mount: '/system' not in /proc/mounts
generic_x86:/ # mount -o remount,ro /system
mount: '/system' not in /proc/mounts
1|generic_x86:/ # whoami
root
I reinstalled Android Studio twice it didn't help. Could anyone help pls?
Usage of -writable-system flag made ADB remount work. Hosts were replaced with the new file.
Launched emulator as:
emulator.exe -writable-system -avd Nexus_5X_API_28_x86
The hosts file is located at a directory that is not allowed to write over a file. So, you should first copy hosts to somewhere else, edit it, and then copy it back.
For example, let's work on the standard emulator:
Run the following command while the emulator is open:
adb devices
This command will show the running emulators. Run the following command to disable the emulator's read-only behaviour:
adb -s emulator-5554 remount
After this step, it should log remount succeeded. Then you should copy the emulator to another directory for editing:
adb -s emulator-5554 pull /system/etc/hosts ~/Desktop/
After this step, it will log about the file transfer's success. Now you can edit the hosts file. After the edit, you should push the file back. First of all, you should reboot the adb:
adb reboot
Emulator will restart itself. After this, you can remount the adb:
adb -s emulator-5554 remount
After the remount, you can push back hosts file:
adb -s emulator-5554 push ~/Desktop/hosts /system/etc/hosts
I'm trying to edit the hosts file on the Marshmallow emulator, but I can't do it. I use ADB tool:
I start emulator using emulator.exe
adb mount
adb pull /system/etc/hosts c:\temp
Then I edit hosts file
ADB push c:\temp\hosts /system/etc (this step doesn't work, because I get error - "read-only file system").
Also, I tried to do adb shell and then SU commands and then mount -o rw,remount /system. But every time when I try to edit hosts file, I get the error that file system is read only.
Any ideas?
Try this for the remount:
adb shell
setenforce 0
mount -o rw,remount /system
setenforce 1
These steps work for me (Windows 8.1 and Android Studio emulator (qemu))
Open a Command Prompt
cd %localappdata%\Android\sdk\tools
Run the emulator from the command line with -writable-system flag, e.g.
emulator -avd (your AVD name) -writable-system
While the emulator is booting (wait until the Android splash appears):
cd %localappdata%\Android\sdk\platform-tools
adb root (do not proceed until this command has been successful)
adb remount
adb push c:\temp\hosts /system/etc/hosts
I am trying to fallow this tutorial in order to install SSL certificate on Android emulator.
I need to start the emulator from command line, so I run
emulator -avd myDevice -http-proxy myIp:8888
After device is started I want to copy my certificate file from PC to the device, so I run those commands
mount -o remount,rw /system
cp /sdcard/5ed36f99.0 /system/etc/security/cacerts/
cd /system/etc/security/cacerts/
chmod 644 5ed36f99.0
I bundle them all together using this suggestion
The final command looks like this:
adb shell su -c 'mount -o remount,rw /system; cp /sdcard/5ed36f99.0 /system/etc/security/cacerts/; cd /system/etc/security/cacerts/; chmod 644 5ed36f99.0'
But I am getting an error:
su: invalid uid/gid '-c'
If I do it from the shell it works, but then when I restart the emulator it restore the system to previous state without saving my changes.
How can I solve those two problems?
I'm trying to root my ICS AVD, and have tried this:
adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock03 /system
adb push su /system/xbin/su
adb shell chmod 06755 /system
adb shell chmod 06755 /system/xbin/su
It fails with the following error:
failed to copy 'su' to '/system/xbin/su': Out of memory
How can I fix this?
This blog explains the problem:
To avoid the "Out of memory" error when trying to copy the su-executable to /system/bin, you need to start the emulator manually with a large –partion-size argument:
$ emulator -avd MYNAME -partition-size 300
Then:
$ adb remount
$ adb push su /system/bin/su
$ adb shell chmod 06755 /system/bin/su
Note that MYNAME above is the name of the emulator. Also note that if you are using snapshots, you will need to start the emulator without it due to the change in hardware configuration. Append -no-snapshot-load to do so.
With this you'll have 512MB of size on /system
ICS is the name I gave to my android emulator:
android-sdk-linux/tools$ emulator -avd ICS -partition-size 512