17

I am currently trying hard to modify my Genymotion Android emulator's hosts file.

The well-known way of remounting, pulling and pushing does not seem to work at all when using Genymotion, as the filesystem is always read-only and remounting is denied.

Earlier I recognized that Genymotion VMs are already shipped with superuser, so I opened the shell and su'd, but the problem is the same: the filesystem is read-only.

Does anyone have an idea how to change that file in a Genymotion VM?

Thanks

Arne

arnekolja
  • 1,687
  • 5
  • 22
  • 29
  • The normal approach of adb remount works well for me. What error message do you get when you try to remount? What version of Genymotion are you using? Are there any other devices connected to the adb? – Alex A. Jun 25 '14 at 13:20
  • I have the same problem, is driving me crazy – R01010010 Jul 20 '16 at 11:22

3 Answers3

43

Run Genymotion Android emulator and introduce this instructions in the console:

  1. adb root
  2. adb remount
  3. adb push /etc/hosts /system/etc

In the third step, specify your hosts file.

It works for me, I hope also works for you.

jam0ral3s
  • 534
  • 4
  • 9
2

I'm using this :

ip="$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)"
adb root
adb remount
cat /etc/hosts|sed 's/127.0.0.1/'$ip'/' > /tmp/hosts-adb
adb push /tmp/hosts-adb /system/etc/hosts

basically this gets your hosts file, change all 127.0.0.1 to your local network ip and send it to genymotion.

Eduardo Moniz
  • 2,095
  • 3
  • 18
  • 27
  • This worked great for me, except I had to modify the top line: `ip="$(ifconfig | grep -A 1 'en0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 2)"` – dclowd9901 May 01 '15 at 22:07
0

Yes, this problem exists and adb root will not solve it on windows, it can't be edited/replaced from eclipse either.

Instead install Total Commander on Genymotion (if you have google apps installed its pretty simple), then go to file you want to edit and long press and select edit with Total Commander Editor. It will ask for root priveleges, grant.

Tertium
  • 6,049
  • 3
  • 30
  • 51