0

I rooted on my S8+. I used the app root checker to check that it's rooted. I was attempting to block ads by hosts files with this tutorial

I attempted to copy the hosts file to my pc, changed it, and pushed it back... got:

adb: error: failed to copy 'hosts' to '/system/etc/hosts': remote couldn't create file: Read-only file system
hosts: 0 files pushed. 62.2 MB/s (456580 bytes in 0.007s)

I then attempted to do it by following this tutorial which uses apps to change the files

I did change the host file permissions to -rw-rw-rw-

Then I tried to use the editor to add some DNS but I was unable to save the hosts files once again. When I tried to save it, I got a Toast saying root permissions were given to the text editor.

Any ideas?

  • 1
    Did you mount /system read/write? Did you disable dm-verity with/after rooting? – Irfan Latif Aug 31 '19 at 23:09
  • 1
    Quick question: did you try AdAway? – Death Mask Salesman Sep 1 '19 at 6:43
  • 1
    @alecxs valid point. But all that needed is mount -o bind /data/media/0/.hosts /etc/hosts or something similar. – Irfan Latif Sep 1 '19 at 14:19
  • 1
    @IrfanLatif I guess that, if one wants to do this manually, then they must find a way to run their command at startup. If their kernel doesn't support init.d out of the box, the hacks are either dirty or require init.d emulators, aka apps. Bottom line: if the kernel doesn't already support init.d, then AdAway appears to be the cleanest solution. – Death Mask Salesman Sep 3 '19 at 22:41
  • 1
    @IrfanLatif Putting two lines in any .rc file plus repacking and flashing boot.img. If memory serves, the / directory, aka rootfs, is populated anew at every boot, with the contents of boot.img. – Death Mask Salesman Sep 4 '19 at 14:35
0

So I finally was able to come back to this issue. I was unable to mount the adb with write permissions either because i was not su or it would deny me to change the host files...

I tried to write the text on the hosts file but it was a file with hundreds of lines... even seemed that android was not able to store it in the "copy/paste"

So in the end I used Solid explorer 2 from play store.

I wrote a hosts file... then i navigate to the /system/etc/ and I rename hosts to "hosts.old" and my "hosts.txt" to "hosts"

until now it seems to be working fine

I'm not considering this an answer because I was unable to write on hosts and someone can come up with a better solution

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.