Can't edit hosts file - Xiaomi Mi Note 10 Questions & Answers

Can't edit hosts file on mi note 10 rooted with magisk.
Read-only system.
Can't edit with root file manager or adb push from PC
Should I be trying to edit /system/etc/hosts file or /etc/hosts file

Related

Pushing hosts file restarts device

I'm trying to play around with the hosts file through adb. I'm new to android from WinMo and trying to learn a few things but couldn't figure this one out.
when I push a new hosts file with:
Code:
adb push hosts /system/etc/hosts
a few seconds later the evo restarts and reverts back to the old hosts file with only localhost listed in there.
I ran into one tutorial that showed the person booting into recovery mode and moving the hosts file from the sdcard to the etc dir:
Code:
adb shell
mount /system
mount /sdcard
cp /sdcard/hosts /system/etc/hosts
exit
Does the hosts file have to be modified via recovery mode or am I doing something wrong by pushing it?
Any help or input is greatly appreciated.
Incase you dont know yet in the hundreds of post all over the rooting threads system is only writable in recovery. /system is nand locked when the OS is running.
ah ok. thanks.
now I'm a bit confused.
when in recovery mode after invoking
Code:
adb reboot recovery
I can't start a remote shell. I get the following error message:
Code:
D:\adb shell
- exec '/system/bin/sh' failed: No such file or directory (2) -
--EDIT--
Guess I just had to run the batch file toast put together. [http://link.geekfor.me/evorecovery]

[SOLVED]Need file System/bin/debuggerd for 4.4.2 update

i need this file System/bin/debuggerd from the 4.4.1, i tried using the krt16m stock image, used this to extract it and get the debuggerd file, used es file explorer and even total commander to replace it, change its permissions to chmod 755 and root shell, but this ota just doesn't install, in twrp still getting error debuggerd file problem, i use stick mount and i dont know why but i deleted the debuggerd.backup file:crying::crying::crying:
Update: I used this which I extracted from 4.4.2 odexed rom from here, I can confirm it is working, just check the sha1sum which should be 1A008709F0945E8EACA2166D143622EB8D94C3D0
Also i used adb commands to push the file from here
Hi,
If that helps: https://www.dropbox.com/s/eu2x01fkr11x9rh/debuggerd.
Don't forget to set the correct permissions, like this:
viking37 said:
Hi,
If that helps: https://www.dropbox.com/s/eu2x01fkr11x9rh/debuggerd.
Don't forget to set the correct permissions, like this:
Click to expand...
Click to collapse
Thanks a lot for the quick reply, it still doesnt work, i dont freaking undrerstand what the problem is, i double checked the md5 checksum through adb command even of the file, it matched but it the ota still shows
"system/bin/debuggerd" has unexpected contents.
E:Error in /tmp/update.zip
(status 7)
Installation aborted
imrock said:
i need this file System/bin/debuggerd from the 4.4.1, i tried using the krt16m stock image, used this to extract it and get the debuggerd file, used es file explorer and even total commander to replace it, change its permissions to chmod 755 and root shell, but this ota just doesn't install, in twrp still getting error debuggerd file problem, i use stick mount and i dont know why but i deleted the debuggerd.backup file:crying::crying::crying:
Update: I used this which I extracted from 4.4.2 odexed rom from here, I can confirm it is working, just check the sha1sum which should be 1A008709F0945E8EACA2166D143622EB8D94C3D0
Also i used adb commands to push the file from here
Click to expand...
Click to collapse
Thank you, it works! Although I had the debuggerd.backup file, renamed it to debuggerd and still failed. But with your file, I upgrade to 4.4.2 successfully. BTW, I use Root Explorer to change the right.

[TIP] AdAway cannot write hosts file - Stock, rooted

This is for people that like to use the stock firmware (I'm one of them) and you are rooted with ElementalX. One of my main reasons to root the phone is to use AdAway (or similar) to get rid of annoying and useless ads.
Well, the hosts file is write protected by the stock Android and cannot be overwrite by AdAway, even if you give root access. AdAway suggests a work-around for this and this is how you apply it.
1. First run AdAway - it will fail writing the system hosts file, but the new hosts file is downloaded on the phone.
Now change to fastboot mode and then boot TWRP (there is no need for TWRP to be flashed with stock).
I usually do it from a command window opened in the TWRP folder (Shift-RightClick), like this:
Code:
adb reboot-bootloader
Now you are in fastbootmode.
Code:
fastboot boot twrp-3.1.0-athene_shreps.img
Of course, replace the TWRP name with "twrp-3.0.2-r4-athene.img" if that's is what you have.
In TWRP screen now:
1. Select MOUNT and check the System partition. Go back.
2. Select ADVANCED>TERMINAL
You have a # prompt. If not, type SU.
3. Type the following two lines in that terminal:
Code:
mv /system/etc/hosts /system/etc/hosts.bak
This renames the existing hosts file to hosts.bak . Not really needed... but better safer than sorry.
Code:
[COLOR="Blue"]ln -s /data/hosts /system/etc/hosts[/COLOR]
This creates a symbolic link to a location that AdAway can write.
Reboot and enjoy.
Simply copy that hosts file via any root Explorer
Sent from my Moto G4 Plus using Tapatalk
Hari Haran said:
Simply copy that hosts file via any root Explorer
Sent from my Moto G4 Plus using Tapatalk
Click to expand...
Click to collapse
This thing won't directly happen, imo:
SoNic67 said:
Code:
ln -s /data/hosts /system/etc/hosts
This creates a symbolic link to a location that AdAway can write.
Reboot and enjoy.
Click to expand...
Click to collapse
Hari Haran said:
Simply copy that hosts file via any root Explorer
Click to expand...
Click to collapse
Yeah, but you have to do it manually every time you update the hosts (AdAway update). Annoying IMO.
Thanks
Wow it worked great after a reboot. Is it like a hosts shortcut in etc folder to hosts file in data folder?
This needs to be re-done after the 93.14-4 security update.
I am running Stock, ElementalX, rooted with SuperSU.
I installed AdAway 3.2, checked systemless mode in the settings and that's it.
I am still at version 3.1.2. Thanks for the heads up.

Any possible way to replace hosts file?

I download the ad-block hosts file, try use adb send to phone:
adb push ./hosts /system/etc/
Got error message:
remote couldn't create file: Read-only file system
Try adb root and adb remount xxx also not work.
Are there any possible way can replace the hosts file? Thanks.
Becuase current no way to modify hosts, I am use "Block This!" to do ad-block.
official website: https://block-this.com/
You can't modify system files without root

Fflashable zip file to modify host file in android 11.

Hello, I would like to know if someone can help me to create a
flashable zip file to modify the host file in android 11.
I have intermediate knowledge of unix commands, but understand almost nothing about android.
I am looking for something similar to this: MoaAB: Mother of All AD-BLOCKING
But this project is dead.
Thanks
IMO a flashable ZIP isn't needed at all:
If Android not already rooted yet then temporalily root Android to mount /system/etc - where Andoid's hosts file is located - as RW and overwrite existing hosts file.
xXx yYy said:
IMO a flashable ZIP isn't needed at all:
If Android not already rooted yet then temporalily root Android to mount /system/etc - where Andoid's hosts file is located - as RW and overwrite existing hosts file.
Click to expand...
Click to collapse
If I have knowledge of how to do it through TWRP and ADB, but it seems easier to do it through a zip file.

Categories

Resources