In the past, I've used a modified hosts file on my system that I place at /system/etc/hosts
. The process is pretty straightforward
- Boot into recovery using a custom recovery.
- Mount
/system
read-write - Use
adb push
to copy a hosts file to/system/etc/hosts
- Reboot and the hosts file takes effect.
Note that the above process doesn't require rooting. It does, of course, modify the system partition.
However, after upgrading to Nougat, I'm seeing some weird behavior where once I reboot, the hosts file is just the standard one with only localhost
in it. This never used to happen on Marshmallow or below.
I thought at first that the system was overwriting my hosts file on each boot, but the strangest part is that if I go back to recovery, the file I copied is still there at /system/etc/hosts
. My guess is that the system is doing a mount at boot time that's hiding my file.
Does anyone have any experience with this or have a way to fix it?