Edit hosts file via Custom ROM? - Android Builders Collective

I want to edit hosts file in my non-rooted Android device.
Since flashing a Custom ROM is basically installing a new OS, I was wondering,
Is a hosts file already present in a Custom ROM or is it generated later and at what point?
If it is preincluded in the ROM, is it possible to edit that hosts file and then flash the ROM, basically editing the hosts file without rooting?

parker_04 said:
I want to edit hosts file in my non-rooted Android device.
Since flashing a Custom ROM is basically installing a new OS, I was wondering,
Is a hosts file already present in a Custom ROM or is it generated later and at what point?
If it is preincluded in the ROM, is it possible to edit that hosts file and then flash the ROM, basically editing the hosts file without rooting?
Click to expand...
Click to collapse
Some custom ROMs do include custom hosts files, and you could potentially edit it before flashing the ROM. I'm not sure why you'd want to use a custom ROM without root, though - with root access, you can use a hosts manager like AdAway to update your hosts file on the fly.

V0latyle said:
Some custom ROMs do include custom hosts files, and you could potentially edit it before flashing the ROM. I'm not sure why you'd want to use a custom ROM without root, though - with root access, you can use a hosts manager like AdAway to update your hosts file on the fly.
Click to expand...
Click to collapse
(I am a newbie in rooting and flashing Custom ROM so please correct me)
Well my main objective is to edit the hosts file.
I understand it generally require root privileges but I want to use rooting as a last resort.
I am already going to flash Xiaomi Eu ROM in my Redmi Note 11. And if it is possible to edit the hosts via the ROM, wouldn't it be a better alternative than rooting? As with rooting, there also comes some consequences like tripping SafetyNet which I would gladly like to avoid.

parker_04 said:
(I am a newbie in rooting and flashing Custom ROM so please correct me)
Well my main objective is to edit the hosts file.
I understand it generally require root privileges but I want to use rooting as a last resort.
I am already going to flash Xiaomi Eu ROM in my Redmi Note 11. And if it is possible to edit the hosts via the ROM, wouldn't it be a better alternative than rooting? As with rooting, there also comes some consequences like tripping SafetyNet which I would gladly like to avoid.
Click to expand...
Click to collapse
SafetyNet is no longer relevant; it has been replaced by Play Integrity. See this thread. Even so, it is possible to pass Play Integrity BASIC and DEVICE attestation using the Universal SafetyNet Fix Magisk module.
I'm rooted with Magisk 25.2 on my Pixel 5. I use AdAway to manage my hosts file, and USNF 2.3.1 MOD 2, and I have zero issues with Play Integrity.

O
V0latyle said:
SafetyNet is no longer relevant; it has been replaced by Play Integrity. See this thread. Even so, it is possible to pass Play Integrity BASIC and DEVICE attestation using the Universal SafetyNet Fix Magisk module.
I'm rooted with Magisk 25.2 on my Pixel 5. I use AdAway to manage my hosts file, and USNF 2.3.1 MOD 2, and I have zero issues with Play Integrity.
Click to expand...
Click to collapse
I see.
But SafetyNet/Play Integrity is only one of the consequences of rooting. In Xiaomi devices, the warranty remains intact even after unlocking bootloader unless the device is rooted.
I am happy with flashing Custom ROM with edited hosts file without rooting.
I can always root my device later if this doesn't work.
Unless there is some other drawback which I am not aware of. If there is, please inform me so I don't end up in a mess.

parker_04 said:
I see.
But SafetyNet/Play Integrity is only one of the consequences of rooting. In Xiaomi devices, the warranty remains intact even after unlocking bootloader unless the device is rooted.
Click to expand...
Click to collapse
How would they know whether you rooted the device?
I can see how flashing custom firmware could void the warranty, like Samsung...So I suppose I've answered my own question as rooting would ostensibly involve either patching the boot image or installing SU to system. But, if you're editing a hosts file, you're also changing the system image, so I would assume that this would do the same thing.
parker_04 said:
I am happy with flashing Custom ROM with edited hosts file without rooting.
I can always root my device later if this doesn't work.
Unless there is some other drawback which I am not aware of. If there is, please inform me so I don't end up in a mess.
Click to expand...
Click to collapse
Well, as I pointed out above, you're making modifications to the software. If you're concerned about the warranty, don't use ANY modified software on your device, and keep your bootloader locked. You can't have your cake and eat it too.

Related

Root system mode

Hi guys,
My Pixel are systemlessly rooted with Magisk since many months now, but for some reasons I'm tired by the method of Magisk: I want to touch at the /system partition, move or delete or edit system files and apps, and with Magisk I can't do it.
Okay, Magisk was pretty useful for keeping Safetynet pass, but with Xposed this ability becomes useless for me. Only things I'm still using is Magisk Hide for using Netflix or NFC paiment app, and Sony Framework module for using PS4 Remote Play.
Before I'm using Magisk and his systemless mode I was using SuperSU, and with it I had no problem with the system partition or with différents things like flashing Viper4android (didn't works whatever the way I use, magisk module or old system mode, it says the drivers need to be reinstalled), mouting partition/making file partition in Linux Deploy, stop background app, modifying the booting apps...
So I'm here now: are they exist a method for having system mode root and still using magisk modules ? Or maybe I've using the wrong way with Magisk and I've missed something for properly having root access ?
Thanks for your help ?
billiepreks said:
So I'm here now: are they exist a method for having system mode root and still using magisk modules ? Or maybe I've using the wrong way with Magisk and I've missed something for properly having root access ?
Thanks for your help ?
Click to expand...
Click to collapse
the whole point of magisk is to systemless modifications. I'm not sure that I follow all of the modifications that you want to make to the system partition?? or rather the specific apps that you want to use... but I can tell you that your /system partition (and others) are just mirrored with magisk and are tmpfs file systems...
I think the real /system lives in /dev/magisk/mirror/system, unless I'm mistaken....
question though; if you prefer SuperSU and only use magisk for safetynet, then why not just use a custom kernel that passes safetynet + SuperSU + suhide?. ... and then use that xposed or whatever....
anyhoo, you definitely have root access. but the intention with magisk and it's modules is to modify the system without actually modifying it directly....
nine7nine said:
the whole point of magisk is to systemless modifications. I'm not sure that I follow all of the modifications that you want to make to the system partition?? or rather the specific apps that you want to use... but I can tell you that your /system partition (and others) are just mirrored with magisk and are tmpfs file systems...
I think the real /system lives in /dev/magisk/mirror/system, unless I'm mistaken....
question though; if you prefer SuperSU and only use magisk for safetynet, then why not just use a custom kernel that passes safetynet + SuperSU + suhide?. ... and then use that xposed or whatever....
anyhoo, you definitely have root access. but the intention with magisk and it's modules is to modify the system without actually modifying it directly....
Click to expand...
Click to collapse
Thanks for your help ?
If Magisk create a mirror of /system as your said, this explain many things that I didn't knew since now.
This night I've made a clean installation of my Pixel, on stock 7.1.2 NJH47F with ElementalX 1.15 for hiding the unlocked bootloader, then I've flashed SuperSU 2.82 SR5. On xda I've seen that suhide 0.55 are discontinued since one year, and suhide-lite 1.09 who works with SuperSU 2.89 are uncompatible with Xposed, so I didn't flash it. There is a way to hide SuperSU with Xposed ?
For my needs with the /system partition, I'll try to explain better myself, I give you some examples:
- Uninstalling system app in ES Explorer or TiBu, it works but after reboot those apps are still here.
- Editing files like build.prop, unable to save the edited file or to replace original file by a modified one
- installing Viper4android drivers, it says "drivers needs to be reinstalled" everytime I launch it
- Linux Deploy, an app for running GNU/Linux distrib on your device, works the first time I launch it, but after reboot he said he didn't get root permission or found busybox, it's very strange.
Many things who worked before with SuperSU 2.79.
Edit : and what about SuperSU and CCMT ?
billiepreks said:
If Magisk create a mirror of /system as your said, this explain many things that I didn't knew since now.
This night I've made a clean installation of my Pixel, on stock 7.1.2 NJH47F with ElementalX 1.15 for hiding the unlocked bootloader, then I've flashed SuperSU 2.82 SR5. On xda I've seen that suhide 0.55 are discontinued since one year, and suhide-lite 1.09 who works with SuperSU 2.89 are uncompatible with Xposed, so I didn't flash it. There is a way to hide SuperSU with Xposed ?
Click to expand...
Click to collapse
You should look in Magisk's log to get a better idea of how it changes your system. trting to modify /system is pointless since it is a tmpfs mount (temperary)...
unfortunately, i can't help much with xposed. i don't use it. after it didn't work with Nougat, i ported a couple of it's modules to my rom (at the time) and then i got the pixel and i run Oreo + my own custom kernel + magisk...
xposed isn't providing any 'suhide' tyype functionality?
billiepreks said:
For my needs with the /system partition, I'll try to explain better myself, I give you some examples:
- Uninstalling system app in ES Explorer or TiBu, it works but after reboot those apps are still here.
- Editing files like build.prop, unable to save the edited file or to replace original file by a modified one
Click to expand...
Click to collapse
again, no point in editing your /system partition, it's a tmpfs mount, of course - any modifications will disappear on reboot.... you probably need to edit the real /system partition to make any change stick.
as far as the other apps, they obviously are trying to modify your aystem partition, which is why they don't work.... i think that you could install soumd mods via magisk modules?
i would recommend.consulting relevant forum threads on specific topics/apps though. u are bound to get better solutions&.
@billiepreks
Did you find the solution?
I'm in the same situation.
Did you try using TWRP's filemanager? I think it has true system access. You just need to mount the partition.

[GUIDE] How to root any Pie-based GSI

I think anyone who tried flashing Magisk on any of the latest phh GSI discovered that wifi, mobile data and calls suddenly get their teeth kicked in.
Since nobody appears to care about that issue much, we have to make do with a workaround.
Credits go to @xJovs for being the one to actually provide proper steps in this post, but since not many people will be lucky enough to stumble upon it while desperately searching through threads, I decided to make a thread here for all the lost souls.
Although the custom kernel part is supposedly optional, one can't say no to a functional custom kernel on Pie.
1. Download the ab superuser and the superuser apk from HERE and the SmurfKernel
2. Get your hands on a TWRP image
3. Boot into it with fastboot ( at the moment we can only boot into TWRP since Magisk is a no go )
4. Flash the SmurfKernel
5. Reboot into the OS
6. Boot into TWRP again
7. Flash the superuser ab zip
8. Boot into the OS and install the Superuser apk
9. Enjoy raw root permissions ( without all the Magisk goodies but still better than nothing )
Niiiiiiice
Also no one cares that substratum still won't work with this root method anyone found also a workaround for that ?
CroW_D said:
Also no one cares that substratum still won't work with this root method anyone found also a workaround for that ?
Click to expand...
Click to collapse
Yeah, I don't know why it won't work. Root permission should be root permission, after all.
The Marionette said:
Yeah, I don't know why it won't work. Root permission should be root permission, after all.
Click to expand...
Click to collapse
I thinks since it needs vendor 9.0 and not 8.1 could be
CroW_D said:
I thinks since it needs vendor 9.0 and not 8.1 could be
Click to expand...
Click to collapse
Vendor should have no effect on root permission.
And we can't use the 9.0 vendor on any phh GSI due to incompatibility.
The Marionette said:
Vendor should have no effect on root permission.
And we can't use the 9.0 vendor on any phh GSI due to incompatibility.
Click to expand...
Click to collapse
I tried with coming from h2os last time and magisk and subs was working but breaking other things. So I guess it should be vendor
This method kinda roots the phone. You can't use system root. Things like moving files through root explorer won't work cause you can't access system root. Things like substratum won't work cause of that
Nice Work and thanks for sharing!
romen288 said:
This method kinda roots the phone. You can't use system root. Things like moving files through root explorer won't work cause you can't access system root. Things like substratum won't work cause of that
Click to expand...
Click to collapse
I guessed that but didn't get to confirm it since I switched back to OOS Beta 1.

Converting a user app to system app corrupts phone on 9.0

Does anyone have experience with turning a user app into a system app on 9.0?
I tried using terminal emulator + app systemizer on magisk and Link2DS both ways have corrupted the phone.
kittygotwet said:
Does anyone have experience with turning a user app into a system app on 9.0?
I tried using terminal emulator + app systemizer on magisk and Link2DS both ways have corrupted the phone.
Click to expand...
Click to collapse
Are you able to recover? If so, you may have to settle without it. I know Systemizer works on 8.1, but I didn't try it on 9.0 before I downgraded. I'm not aware of any other options besides manually moving it, but that would break your systemless root, and would also need to be done after every update.
If you can't recover but can get into fastboot, you can boot into TWRP and flash "Magisk Mount". That will allow you to remove the Systemizer module manually from the Magisk image and boot back into the OS. As for Link2SD, I've never used it, so I'm not sure what changes it made that would have to be undone in order to recover.
jallenhayslett said:
Are you able to recover? If so, you may have to settle without it. I know Systemizer works on 8.1, but I didn't try it on 9.0 before I downgraded. I'm not aware of any other options besides manually moving it, but that would break your systemless root, and would also need to be done after every update.
If you can't recover but can get into fastboot, you can boot into TWRP and flash "Magisk Mount". That will allow you to remove the Systemizer module manually from the Magisk image and boot back into the OS. As for Link2SD, I've never used it, so I'm not sure what changes it made that would have to be undone in order to recover.
Click to expand...
Click to collapse
I just flash-all to fix it then reroot with Magisk. How do I convert an app to system through recovery (in twrp)?
kittygotwet said:
I just flash-all to fix it then reroot with Magisk. How do I convert an app to system through recovery (in twrp)?
Click to expand...
Click to collapse
As long as you dont care about remaining systemless and passing SafetyNet, you could simply move the apk folder into the system app folder manually. You could do it either through TWRP's built in file manager, or do it live with a root capable file manager. Either way should work.
Again, it's not ideal as it will trip SafetyNet and must be done after every ROM update/flash. So, if you have anything that depends on SafetyNet, that's not an option for you.
Another possibility would be to look at the Magisk documentation for module building and make your own module which would inject whatever apk you need systemlessly. You could accelerate the learning process by downloading one that already does something similar and reverse engineering it to fit your needs.
jallenhayslett said:
As long as you dont care about remaining systemless and passing SafetyNet, you could simply move the apk folder into the system app folder manually. You could do it either through TWRP's built in file manager, or do it live with a root capable file manager. Either way should work.
Again, it's not ideal as it will trip SafetyNet and must be done after every ROM update/flash. So, if you have anything that depends on SafetyNet, that's not an option for you.
Another possibility would be to look at the Magisk documentation for module building and make your own module which would inject whatever apk you need systemlessly. You could accelerate the learning process by downloading one that already does something similar and reverse engineering it to fit your needs.
Click to expand...
Click to collapse
damn, i need safetynet for google pay. crap hopefully the apps update for 9.0 and fixes itself.

System file modification

I've been using Pixel 3 only for two weeks, and haven't understood its security mechanism fully yet.
Usually on other phones, I simply run TWRP and modify hosts to avoid ads. After doing the same on Pixel 3 and booting into system, ads are still there, which means hosts modification didn't work properly.
So I installed Magisk from TWRP, and did the same modification on Android, and I confirmed ads were all gone as usual. Then, I uninstalled Magisk with the modified hosts left in /system/etc, and reboot the system to find ads were all back...
It looks like you need Magisk installed on Pixel 3 to keep system file modifications working. I haven't tried font modifications, but I assume the result would be the same.
Could someone explain to me what causes this system file modifications fail without Magisk installed? A new Pixel-unique system security mechanism?? Thanks in advance!
QT
Does Pixel 3 checks whether system files are signed by Google or not??
qtotter said:
Does Pixel 3 checks whether system files are signed by Google or not??
Click to expand...
Click to collapse
It is my understanding that this mod requires root.
Yes, system files have checks. That's why when you edit system files you use the original signature.
Tulsadiver said:
Yes, system files have checks. That's why when you edit system files you use the original signature.
Click to expand...
Click to collapse
Thanks for your info. Google's security policy is getting tighter...

FlashFire "Root was found, but access couldn't be acquired!"

I was about to put this in the main discussion thread of FlashFire, but it was closed so i decided to post it here.
So this is what happened, i rooted my Xiaomi Redmi Go with Magisk, the latest one, and when i opened FlashFire, it basically said that i have root, but access couldn't be acquired. It added "Found root: 19.4:MAGISKSU".
It was said in the Supported roots that Magisk is included so can't i use this app? I also tried to change my SELinux to permissive mode by going to the terminal and putting "setenforce 0", and the app still won't let me.
Any solutions to this? I was about to do perform a live backup through this app because the current TWRP version for this device is defective for my phone, the Backup option doesn't work and I've been looking for ways to backup my phone without custom recovery, but still with root of course.
Any help would be appreciated, thankyou!
Flashfire is discontinued so it is no longer compatible with the latest versions of Magisk
You might try going back to a older Magisk. It's definitely going to be before 19.3 but it may need to be older than that. There are two ways of doing this.
Set a custom channel in Magisk manager (install the older manager first).
Download the older release. If you're not familiar with github, expand the assets link under the release you want. The zip files will be listed there.
Make sure to remove the newer Magisk first.
spider1163 said:
Flashfire is discontinued so it is no longer compatible with the latest versions of Magisk
Click to expand...
Click to collapse
So is there solution that i can bypass that error ?

Categories

Resources