How to make /etc/hosts writeable?
Posted: 03 Oct 2020 10:51
I am trying to dynamically replace /etc/hosts with my custom hosts file.
(AdAway is working perfectly on my phone but I need to modify my hosts dynamically using Automagic, which has Root functions enabled)
Using Execute Root Command, these are what I have tried and the result:
stderr: mv: bad '/etc/hosts': Read-only file system
stderr: mount: '/system' not in /proc/mounts
stdout:
Anyone has any idea how to replace /etc/hosts?
(AdAway is working perfectly on my phone but I need to modify my hosts dynamically using Automagic, which has Root functions enabled)
Using Execute Root Command, these are what I have tried and the result:
Code: Select all
mv /etc/hosts /etc/hosts1
Code: Select all
mount -o rw,remount /system
Code: Select all
mount
Code: Select all
/dev/root on / type ext4 (ro,seclabel,relatime)
tmpfs on /sbin type tmpfs (rw,seclabel,relatime,size=2870540k,nr_inodes=717635,mode=755)
/sbin/.magisk/block/persist on /sbin/.magisk/mirror/persist type ext4 (rw,seclabel,relatime,data=ordered)
/sbin/.magisk/block/system_root on /sbin/.magisk/mirror/system_root type ext4 (ro,seclabel,relatime)
/sbin/.magisk/block/system_root on /sbin/dashd type ext4 (ro,seclabel,relatime)
/sbin/.magisk/block/system_root on /sbin/charger_log type ext4 (ro,seclabel,relatime)
/sbin/.magisk/block/vendor on /sbin/.magisk/mirror/vendor type ext4 (ro,seclabel,relatime,discard)
/sbin/.magisk/block/data on /sbin/.magisk/mirror/data type ext4 (rw,seclabel,relatime,discard,noauto_da_alloc,resgid=1065,data=ordered)
/sbin/.magisk/block/data on /sbin/.magisk/modules type ext4 (rw,seclabel,relatime,discard,noauto_da_alloc,resgid=1065,data=ordered)
tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,size=2870540k,nr_inodes=717635,mode=755)
devpts on /dev/pts type devpts (rw,seclabel,relatime,mode=600,ptmxmode=000)
none on /dev/cg2_bpf type cgroup2 (rw,nosuid,nodev,noexec,relatime)
none on /dev/cpuctl type cgroup (rw,nosuid,nodev,noexec,relatime,cpu)
none on /dev/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset,noprefix,release_agent=/sbin/cpuset_release_agent)
none on /dev/stune type cgroup (rw,nosuid,nodev,noexec,relatime,schedtune)
adb on /dev/usb-ffs/adb type functionfs (rw,relatime)
proc on /proc type proc (rw,relatime,gid=3009,hidepid=2)
sysfs on /sys type sysfs (rw,seclabel,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,seclabel,relatime)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,seclabel,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime)
pstore on /sys/fs/pstore type pstore (rw,seclabel,nosuid,nodev,noexec,relatime)
none on /sys/fs/cgroup type tmpfs (rw,seclabel,relatime,size=2870540k,nr_inodes=717635,mode=750,gid=1000)
none on /sys/fs/cgroup/freezer type cgroup (rw,relatime,freezer)
none on /sys/fs/cgroup/net_cls type cgroup (rw,relatime,net_cls)
tmpfs on /mnt type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=2870540k,nr_inodes=717635,mode=755,gid=1000)
/dev/block/sda2 on /mnt/vendor/persist type ext4 (rw,seclabel,nosuid,nodev,noatime,data=ordered)
/data/media on /mnt/runtime/default/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,multiuser,mask=6,derive_gid,default_normal)
/data/media on /mnt/runtime/read/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=23,derive_gid,default_normal)
/data/media on /mnt/runtime/write/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=7,derive_gid,default_normal)
/data/media on /mnt/runtime/full/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=7,derive_gid,default_normal)
tmpfs on /apex type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=2870540k,nr_inodes=717635,mode=755)
/dev/block/dm-1 on /apex/com.android.tzdata@292500002 type ext4 (ro,dirsync,seclabel,nodev,noatime)
/dev/block/dm-1 on /apex/com.android.tzdata type ext4 (ro,dirsync,seclabel,nodev,noatime)
/dev/block/dm-2 on /apex/com.android.conscrypt@291900801 type ext4 (ro,dirsync,seclabel,nodev,noatime)
/dev/block/dm-2 on /apex/com.android.conscrypt type ext4 (ro,dirsync,seclabel,nodev,noatime)
/dev/block/dm-3 on /apex/com.android.media@300900700 type ext4 (ro,dirsync,seclabel,nodev,noatime)
/dev/block/dm-3 on /apex/com.android.media type ext4 (ro,dirsync,seclabel,nodev,noatime)
/dev/block/dm-4 on /apex/com.android.media.swcodec@300900700 type ext4 (ro,dirsync,seclabel,nodev,noatime)
/dev/block/dm-4 on /apex/com.android.media.swcodec type ext4 (ro,dirsync,seclabel,nodev,noatime)
/dev/block/loop7 on /apex/com.android.resolv@290000000 type ext4 (ro,dirsync,seclabel,nodev,noatime)
/dev/block/loop7 on /apex/com.android.resolv type ext4 (ro,dirsync,seclabel,nodev,noatime)
/dev/block/loop8 on /apex/com.android.runtime@1 type ext4 (ro,dirsync,seclabel,nodev,noatime)
/dev/block/loop8 on /apex/com.android.runtime type ext4 (ro,dirsync,seclabel,nodev,noatime)
/dev/block/loop9 on /apex/com.android.apex.cts.shim@1 type ext4 (ro,dirsync,seclabel,nodev,noatime)
/dev/block/loop9 on /apex/com.android.apex.cts.shim type ext4 (ro,dirsync,seclabel,nodev,noatime)
/dev/block/dm-0 on /vendor type ext4 (ro,seclabel,relatime,discard)
/dev/block/sde32 on /vendor/firmware_mnt type vfat (ro,context=u:object_r:firmware_file:s0,relatime,uid=1000,gid=1000,fmask=0337,dmask=0227,codepage=437,iocharset=iso8859-1,shortname=lower,errors=remount-ro)
/dev/block/sde37 on /vendor/dsp type ext4 (ro,seclabel,nosuid,nodev,relatime,data=ordered)
/dev/block/sde33 on /vendor/bt_firmware type vfat (ro,context=u:object_r:bt_firmware_file:s0,relatime,uid=1002,gid=3002,fmask=0337,dmask=0227,codepage=437,iocharset=iso8859-1,shortname=lower,errors=remount-ro)
none on /acct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct)
none on /config type configfs (rw,nosuid,nodev,noexec,relatime)
/dev/block/sda17 on /data type ext4 (rw,seclabel,nosuid,nodev,noatime,discard,noauto_da_alloc,resgid=1065,data=ordered)
/dev/block/sde59 on /op1 type ext4 (ro,context=u:object_r:op1_file:s0,relatime,data=ordered)
/dev/block/sda7 on /op2 type ext4 (rw,seclabel,nosuid,nodev,noatime,data=ordered)
/dev/block/loop2 on /system/reserve type ext4 (ro,context=u:object_r:system_file:s0,relatime,data=ordered)
tmpfs on /system/xbin type tmpfs (rw,seclabel,relatime,size=2870540k,nr_inodes=717635)
/sbin/.magisk/block/data on /system/xbin/busybox type ext4 (rw,seclabel,relatime,discard,noauto_da_alloc,resgid=1065,data=ordered)
/sbin/.magisk/block/system_root on /system/xbin/gamemode_networkboost_disable.sh type ext4 (ro,seclabel,relatime)
/sbin/.magisk/block/system_root on /system/xbin/tcpdump type ext4 (ro,seclabel,relatime)
/sbin/.magisk/block/system_root on /system/xbin/nfc_trasmit_start.sh type ext4 (ro,seclabel,relatime)
/sbin/.magisk/block/system_root on /system/xbin/box type ext4 (ro,seclabel,relatime)
/sbin/.magisk/block/system_root on /system/xbin/nfc_trasmit_stop.sh type ext4 (ro,seclabel,relatime)
/sbin/.magisk/block/system_root on /system/xbin/antradio_app type ext4 (ro,seclabel,relatime)
/sbin/.magisk/block/system_root on /system/xbin/gamemode_networkboost_enable.sh type ext4 (ro,seclabel,relatime)
/sbin/.magisk/block/system_root on /system/xbin/gamemode_networkboost_init.sh type ext4 (ro,seclabel,relatime)
/sbin/.magisk/block/system_root on /system/xbin/pnx type ext4 (ro,seclabel,relatime)
tmpfs on /storage type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=2870540k,nr_inodes=717635,mode=755,gid=1000)
/data/media on /storage/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=7,derive_gid,default_normal)
tmpfs on /storage/self type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=2870540k,nr_inodes=717635,mode=755,gid=1000)