Search code examples
androidadb

Android: edit /system/etc/host file


I want to edit /system/etc/hosts int my Xiaomi 5 (rooted). I first pull /syste/etc/hosts and made some changes to it, I want to pushit ,then I came across this problem

adb push hosts /system/etc/hosts
failed to copy 'hosts' to '/system/etc/hosts': couldn't create file: 
Read-only file system

I checked this, but that didn't work out for me.

adb root   
adbd is already running as root

adb remount
remount of /system failed: Read-only file system
remount failed

I tried this, didn't work either.

it shows:

gemini:/ # mount -o rw,remount /system
'/dev/block/dm-0' is read-only
gemini:/ # mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
mount: '/system' not in /proc/mounts

Can anybody show me a way out, any advice is appreciated.


Solution

  • Ok,I finally find an answer on MIUI forum.

    What I found ,if you can read Chinese, open it directly; if you can't I will explain the reason .

    I can't edit the hosts file, because I didn't unlock system. MIUI has some kind of protect mechanism to prevent user delete important files after root.

    So, download this, make sure your phone is in Fastboot mode. Connect it to your PC, and open a terminal where you put your adb files you just download.

    adb root 
    
    adb disable-verity
    

    This will do it!