4

It seems to be under /system_root/etc but the hosts file really is just a symbolic link to /system/etc/hosts.

How to modify the "systemless hosts” file under the newer Magisk?

7
  • It might look like that, but doesn't Magisk use an overlay file system here?
    – Izzy
    Jul 27, 2018 at 6:44
  • What does that mean and what can I do? Jul 27, 2018 at 10:31
  • If you doubt Magisk is handling systemless root (and systemless hosts), either don't use it if you want to avoid it – or ask at the Magisk issue tracker to make sure.
    – Izzy
    Jul 27, 2018 at 13:24
  • @Izzy no no, I mean how can I manually modify systemless hosts with adb shell? Jul 29, 2018 at 9:02
  • 1
    @Izzy so I would just edit system files as if they were system files but Magisk takes care of the overlay for me? Jul 29, 2018 at 12:24

1 Answer 1

3

In recent versions of Magisk and "Systemless Hosts" module you can no longer directly edit the file /system/etc/hosts.

Instead you have to modify the hosts file in the Magisk modules directory of the hosts module (the internal name of the "Systemless Hosts" module).

  1. Open Magisk -> Settings -> touch Systemless hosts (this will create the necessary directory structure and the hosts file.

  2. Use an editor of your choice and edit the file

/data/adb/modules/hosts/system/etc/hosts

Any change to that file will directly be visible in /system/etc/hosts respectively /etc/hosts.

The Magisk modules directory and it's file-system structure is explained here: https://topjohnwu.github.io/Magisk/guides.html#magisk-modules

You must log in to answer this question.

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