Edit /etc/hosts on FP2 with Open Source OS

How can I edit the hosts file? I’m aware of this post, but my understanding is that it may not be necessary to root the device when OSOS is used, or alternatively that rooting is easier. I tried to remount the file system (after su) in order to edit hosts, but got “Permission denied”. Thanks.

No, you don’t need any special actions. Did you get an error message after su? Or was the prompt a #-sign? how did you do the remount? it is sufficient to type
mount -o remount,rw /system
no need to specify a fs type, if this is correct at all…

Thanks for the response, Klaus. I tried a couple of things (all via adb shell):

  1. su; cat /sdcard/Download/hosts >> /etc/hosts. This gives me /system/bin/sh: can't create /etc/hosts: Read-only file system.

  2. Okay, I tried remounting read-write: mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system but that produces: mount: Permission denied.

  3. As you suggest mount -o remount,rw /system but that also gives me Permission denied.

After su, the prompt is not a # but still a $. Does that mean that I’m not root? I tried the same commands on the phone via the Terminal Emulator – no difference.

Ok, I found the solution. I had to activate root more:

  1. Go to settings -> about phone -> tap build number 10 times.
  2. Go to settings -> developer options -> root access and select “Apps and ADB”.
  3. Open terminal
  4. Enter su
  5. Enter mount -o remount,rw /system
  6. Edit /etc/hosts

yes. the error happens on step 1. su is “interactive”. the command after the ; gets executed after su finishes. that is, after you “left” root. just type su all on its own, and the you’ll get the # prompt. after that, got ahead with the rest of the command

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.