I am using Redmi Note 11 running on Custom ROM - Xiaomi Eu

Specs: enter image description here

My device is rooted via Magisk. I want to edit the hosts file. I have tried using ADB, CX File Explorer, X-Plore Manager but I am unable to edit it.

Apparently none of the methods are able to write on /system partition because it is Read Only System.

I looked up online and tried mounting it as writable via ADB using

adb shell
mount -o rw,remount /system

Output : /system not in /proc/mounts


mount -o rw,remount /

Output : /dev/block/dm-0 is read only

adb root and disable-verity aren't working either.

It is so annoying. I had to wait 5 days to unlock the bootloader. Spent whole night installing Custom ROM and rooting my device. And all of it for nothing.

Please help.

  • Since you're using Magisk, didn't Magisk have an option for Systemless Hosts?
    – Andrew T.
    Jan 12, 2023 at 8:40
  • @AndrewT. It says 'support for ad blocking'. But I want to block some particular sites. How can I do that? Jan 12, 2023 at 8:44
  • Perhaps Where is the "systemless hosts" file under Magisk? may help?
    – Andrew T.
    Jan 12, 2023 at 8:50
  • 1
    Do you know AdAway? what's the point of uninstall Magisk? you know you can set to always denial?
    – alecxs
    Jan 12, 2023 at 11:33
  • 1
    And turns out, if I use 'Systemless hosts' method, edit the hosts and then disable it in the Magisk Modules section, the hosts file in /system/etc/ revert back any changes -- this is intended behavior. Systemless hosts is a magisk feature. It overlays this new hosts file over the one that your OEM shipped. Thereafter any changes made to the hosts file are actually made to this overlay hosts file. By disabling systemless hosts, no overlay would be there and the actual hosts file of the system would be used.
    – Firelord
    Jan 12, 2023 at 11:45

1 Answer 1


Thank you everyone for your help.

I managed to edit the hosts file successfully and changes are still intact even after removing Magisk and root.

This is what I did:

Important. Very very important:

  • Your device must be rooted.
  • You must have ADB & Fastboot drivers set-up on your PC.
  • You must have custom recovery like TWRP installed on your phone.
  • Proceed only if you understand what you are doing.


  1. First of all, I used this script which remounts the system partition of your device as rewritable. Link 1 : XDA forums thread page Link 2 : Direct link

  2. Booted in TWRP and installed the zip file of Universal SysRW obtained from link 2. Detailed instructions on how to install via different methods are available in link 1.

  3. Pulled the hosts file from my phone on my computer and edited it. It's format as visible in Notepad++ (UTF-8) with special symbols is

enter image description here

  1. Copied the hosts file into Documents folder in my Android device internal storage.
  2. Enabled USB Debugging on my Android Device and connected it to my PC via USB cable.
  3. Opened Command Prompt on Windows. (Same commands can be given in Linux Terminal)
  4. Executed adb start-server and then adb devices to make sure my device is connected correctly.
  5. Executed adb shell
  6. Executed su. A popup appeared on my phone asking SuperUser permissions for ADB Shell. Clicked on 'Grant'. On successful execution the sign in ADB Shell changes to a #.
  7. Ran the following commands in it
mount -o rw,remount /  

And then,

cp "/storage/emulated/0/Documents/hosts" "/system/etc"

First command remounts the system partition in your device as rewritable. And then the second one copies the custom hosts file from Documents folder to /system/etc.

  1. Cleared all data from my browser. Rebooted my device. Done.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .