Greetings, I've been attempting for several days to execute "su" from adb shell. Essentially, Magisk 24.3 is properly installed within Android 12 on a Google Pixel 6. My primary purpose for rooting is to add my LAN entries to /system/etc/hosts.
An androidforums.com thread details the steps taken several times.
I would very much appreciate your help in getting "su" to work in Android 12 on a Pixel 6. No such problem occurred in Android 8.2 on a Nexus 6P.
Magisk is now uninstalled from the phone, and doesn't appear in the list of apps on the Pixel 6.
On the laptop:
$ adb install Magisk-v24.3.apk
Performing Streamed Install
Success
Invoking Magisk on the phone indicates that the App 24.3 (24300)(27) is installed, Magisk "Installed: NA"
From the factory image, unzipping image-oriole-sp2a.220305.013.a3.zip into a tmp directory:
$ adb push boot.img /storage/emulated/0/Download/boot.img
boot.img: 1 file pushed, 0 skipped. 51.4 MB/s (67108864 bytes in 1.246s)
In Magisk Install "Select and Patch a file", the boot.img is selected. "LET'S GO" results in a sequence ending with the name of the patched file and "All done!"
On the laptop:
adb pull /storage/emulated/0/Download/magisk_patched-24300_jdnPc.img magisk_patched.img
/storage/emulated/0/Download/magisk_patched-24300_jdnP...ulled, 0 skipped. 35.6 MB/s (67108864 bytes in 1.796s)
$ adb reboot bootloader
$ fastboot flash boot magisk_patched.img
Sending 'boot_a' (65536 KB) OKAY [ 1.683s]
Writing 'boot_a' OKAY [ 0.100s]
Finished. Total time: 1.785s
Android reboots normally. The Magisk app reports "Installed: 24.3 (24300)
On the laptop:
$ adb shell
oriole:/ $ su
Permission denied
13|oriole:/ $ exit
$
Please tell me where was my rooting error.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I assure you that the correct factory boot.img was transferred to Magisk, and the correct patched *.img file was uploaded and flashed to the phone.
hstroph said:
Greetings, I've been attempting for several days to execute "su" from adb shell. Essentially, Magisk 24.3 is properly installed within Android 12 on a Google Pixel 6. My primary purpose for rooting is to add my LAN entries to /system/etc/hosts.
I would very much appreciate your help in getting "su" to work in Android 12 on a Pixel 6. No such problem occurred in Android 8.2 on a Nexus 6P.
Click to expand...
Click to collapse
I think what you are facing is less about su rights and privileges and more about modern versus legacy partitioning and file systems. See this StackExchange Q&A, in particular the second answer about a hosts file solution.
But instead of mounting /system in Android 12, which is more hardened than 10 and 11, a safer method would involve systemless hosts courtesy of Magisk. One issue with that, though, is that most people use systemless hosts for block lists that redirect in bulk to 127.0.0.0 or 0.0.0.0. Adding friendly host names and IPs gets tricky because ad blocking apps like Adaway tend to overwrite when updating, although Adaway's whitelisting option may do the trick. I've never tried it.
I'm in a similar boat since jumping from Android 9 to 12 when I bought a Pixel 6. Eventually I'd like to use my Pixel for accessing a localhost web server. Until a better idea comes along I'll either use my old Pie phone for local browsing or simply publish to the www server (for testing layouts and responsiveness, etc.). I haven't gotten serious about it yet but I'm interested in any method that doesn't involve /system modifications or reconfiguring my router.
manjaroid said:
I think what you are facing is less about su rights and privileges and more about modern versus legacy partitioning and file systems. See this StackExhange Q&A, in particular the second answer about a hosts file solution. ...
Click to expand...
Click to collapse
Thank you, that got me excited as termux allowed a root prompt. "mount -o rw,remount /" executed, the vi alias was created, but "vi /system/etc/hosts" informed me that the file was read-only.
Not sure what to do next, but again, thank you.
hstroph said:
Thank you, that got me excited as termux allowed a root prompt. "mount -o rw,remount /" executed, the vi alias was created, but "vi /system/etc/hosts" informed me that the file was read-only.
Not sure what to do next, but again, thank you.
Click to expand...
Click to collapse
We need to approach our hosts files differently than was possible with Oreo or Pie. The path with least resistance will be Magisk's built-in systemless hosts module. Mounting /system as rw may have worked for Android 10 or 11, but 12 is stricter and messing with anything on /system could cause a cascade of problems.
Also, the /system partition dynamically stays full despite usage reported in Settings/Storage, so there's no elbow room for even the smallest change and you might even see out of space errors if not read-only errors.
What to try? I don't have a good answer yet, only ideas. I will be looking into it and am happy to report back. Hopefully somebody smarter than me will chime in.
Thank you for your interest and efforts.
This XDA thread was revisited today and it reminded me to take a stab at my Pixel's hosts file. With little effort I'm now browsing web server hosts on a Windows laptop from Android 12. All I did was edit its hosts file same way I've always done. Obviously I didn't have have a good grasp of the Magisk overlay and how it symlinks Android's native hosts file.
/system in Android 10+ may be off limits to many legacy operations but not the hosts file as long as Magisk's systemless hosts module is enabled. For su access it's just a matter of granting it to a root capable file manager with a text editor, such as MiXplorer or Solid Explorer.
Here's an example of what's needed for Android 12 browsers to connect to Apache virtualhosts on Windows:
Windows 10 laptop (192.168.1.234) - c:\Windows\System32\drivers\etc\hosts
127.0.0.1 site1.local
127.0.0.1 site2.local
Android 12 Pixel - /system/etc/hosts
192.168.1.234 site1.local
192.168.1.234 site2.local
Hope this is pertinent to what you're trying. Sorry for making it sound impossible earlier.
manjaroid said:
This XDA thread was revisited today and it reminded me to take a stab at my Pixel's hosts file. With little effort I'm now browsing web server hosts on a Windows laptop from Android 12. All I did was edit its hosts file same way I've always done. Obviously I didn't have have a good grasp of the Magisk overlay and how it symlinks Android's native hosts file.
/system in Android 10+ may be off limits to many legacy operations but not the hosts file as long as Magisk's systemless hosts module is enabled. For su access it's just a matter of granting it to a root capable file manager with a text editor, such as MiXplorer or Solid Explorer.
...
Click to expand...
Click to collapse
I'd very much like to know what "little effort" it took, please.
Magisk has the systemless module enabled, both MIXplorer and Solid Explorer have root privileges, but neither can copy my downloaded hosts file to /system/etc/hosts ... no success using the MIXplorer text editor either as per your suggestion
hstroph said:
I'd very much like to know what "little effort" it took, please.
Click to expand...
Click to collapse
I edited the hosts file directly by tapping it in MiXplorer and picking an editor. Then I just added a few lines, saved, and that was it. If you have lots of tedious entries try copy/pasting your text instead of trying to replace the file.
I know it doesn't quite make sense since your file managers have root. But overwriting a file on read-only /system is something completely different than opening and editing the hosts file like an ad blocker would do, which is only possible because of the systemless hosts module.
manjaroid said:
... But overwriting a file on read-only /system is something completely different than opening and editing the hosts file like an ad blocker would do, which is only possible because of the systemless hosts module.
Click to expand...
Click to collapse
Which hosts file are you successfully editing, please? Android 12 absolute pathname, if you would be so kind.
hstroph said:
Which hosts file are you successfully editing, please? Android 12 absolute pathname, if you would be so kind.
Click to expand...
Click to collapse
Edit /system/etc/hosts just as you would have done before Android 10, which didn't require the systemless hosts module.
I don't understand most of how systemless root works. But as far as I know, Magisk's systemless hosts module 'hijacks' (for lack of better discription) the hosts file from the system and makes it systemless, similar to a system app converting to a user app.
manjaroid said:
Edit /system/etc/hosts just as you would have done before Android 10, which didn't require the systemless hosts module.
Click to expand...
Click to collapse
I have attempted that many times:
$ adb shell
oriole:/ $ su
Permission denied
13|oriole:/ $
This was in anticipation of a "mount -o rw,remount /system" command in Android 8.2 on a Nexus 6P phone. It no longer works on Android 12 on a Pixel 6. Even a successful su in Termux fails to edit the /system/etc/hosts, or to make either / or /system rw.
Are you actually using Android 12, or are you reciting from memory? Your screen shots are appreciated.
hstroph said:
Are you actually using Android 12, or are you reciting from memory? Your screen shots are appreciated.
Click to expand...
Click to collapse
My Pixel runs Android 12 build SPA2A.220405.004 and Magisk 24.3. Screen shots won't show anything useful.
The su command in adb shell or Termux aren't needed even if mounting /system with write permission was possible. You're chasing your tail going about it this way.
A root file manager used as described is all that's needed to edit the hosts file. If you're being denied write access there must be something wrong with Magisk, systemless hosts, interference from other Magisk modules or something else.
To trouble shoot Magisk,
- try disabling systemless hosts in Magisk, reboot, re-enable it again & reboot again
- if using Magisk Canary try the more stable 24.3
A simple way to test systemless hosts is to install Adaway, choose the root option and grant su access. If the module is working Adaway will build a large hosts file from preset lists.
- a storage full error on the first run isn't unusual, but it should write to the hosts file next run
- if there's constant errors something isn't right, probably with Magisk or systemless hosts
- if it does write to the hosts file you should be able to edit it manually
- disable all block lists before uninstalling Adaway to empty the hosts file
manjaroid said:
My Pixel runs Android 12 build SPA2A.220405.004 and Magisk 24.3. ...
Click to expand...
Click to collapse
My Pixel 6 runs Android 12 build SPA2A.220305.013.A3 with Magisk 24.3
manjaroid said:
A root file manager used as described is all that's needed to edit the hosts file. If you're being denied write access there must be something wrong with Magisk, systemless hosts, interference from other Magisk modules or something else.
...
A simple way to test systemless hosts is to install Adaway, choose the root option and grant su access. If the module is working Adaway will build a large hosts file from preset lists.
Click to expand...
Click to collapse
Before Adaway (from adb shell):
oriole:/ $ wc -l /system/etc/hosts
2 /system/etc/hosts
After Adaway:
oriole:/ $ wc -l /system/etc/hosts
110315 /system/etc/hosts
manjaroid said:
- if it does write to the hosts file you should be able to edit it manually
Click to expand...
Click to collapse
I can add a LAN line before all the 127.0.0.1 entries using the rooted MIXplorer text editor, but the file still won't save.
manjaroid said:
- disable all block lists before uninstalling Adaway to empty the hosts file
Click to expand...
Click to collapse
There were no previous block lists of any kind. I have simply been trying to add a couple dozen LAN entries on this new phone.
I think I've followed instructions as carefully as possible, but still no luck.
hstroph said:
My Pixel 6 runs Android 12 build SPA2A.220305.013.A3 with Magisk 24.3
Before Adaway (from adb shell):
oriole:/ $ wc -l /system/etc/hosts
2 /system/etc/hosts
After Adaway:
oriole:/ $ wc -l /system/etc/hosts
110315 /system/etc/hosts
I can add a LAN line before all the 127.0.0.1 entries using the rooted MIXplorer text editor, but the file still won't save.
There were no previous block lists of any kind. I have simply been trying to add a couple dozen LAN entries on this new phone.
I think I've followed instructions as carefully as possible, but still no luck.
Click to expand...
Click to collapse
Systemless hosts appears to be working if there were no errors and 110315 entries were written to hosts.
In MiXplorer's Settings/More Settings, is the first item for Allow Root checked? I don't remember if the default is checked or not but it needs to be checked. The equivalent setting in Solid Explorer is off by default.
My two screenshots show before and after enabling/disabling Adaway's block lists. The second image shows Adaway's leftovers along with my own lines added manually and the file is saved (save button being greyed out). If you're unable to get the same results I'm stumped and need to think about what's going wrong.
manjaroid said:
..
In MiXplorer's Settings/More Settings, is the first item for Allow Root checked? I don't remember if the default is checked or not but it needs to be checked.
Click to expand...
Click to collapse
It is checked in MIXplorer.
manjaroid said:
The equivalent setting in Solid Explorer is off by default.
Click to expand...
Click to collapse
I'm unable to locate an equivalent setting in Solid Explorer (SE), but root usage was granted through Magisk 24.3 when I used SE for the first time.
manjaroid said:
My two screenshots show before and after enabling/disabling Adaway's block lists. The second image shows Adaway's leftovers along with my own lines added manually and the file is saved (save button being greyed out). If you're unable to get the same results I'm stumped and need to think about what's going wrong.
Click to expand...
Click to collapse
My attached image shows a failure to save in MIXplorer after adding a single "192.168.1.13 tncpi" line.
I've been stumped on the matter ever since Android 12 on this new Pixel 6.
Is Zygisk enabled in Magisk? I assume you followed this guide for rooting.
[GUIDE] Pixel 6 "oriole": Unlock Bootloader, Update, Root, Pass SafetyNet
⚠️⚠️⚠️WARNING! IF YOU ARE UPDATING TO ANDROID 13 FOR THE FIRST TIME, READ THIS FIRST! ⚠️⚠️⚠️ If you are looking for my guide on a different Pixel, find it here: Pixel 3 Pixel 3XL Pixel 3a Pixel 3aXL Pixel 4 Pixel 4XL Pixel 4a Pixel 4a (5G)...
forum.xda-developers.com
Appending a line using Termux works for me also. Are you denied when you try?
Code:
$ su
# echo 192.186.1.234 site3.local >> /system/etc/hosts
If that works there's no reason a root file manager shouldn't work. (To enable root in Solid Explorer tap the hamburger icon upper left then the sprocket icon and scroll down.)
If nothing works I'm thinking either 1) root isn't complete or 2) attempts at /system mounting had a negative effect. Options to consider:
- remove Magisk and repeat the root process
- remove Magisk, install the April OTA update, then root
- factory reset or flash the April factory zip, then root
My suggestion: Might as well go the full route and factory reset or clean flash. Particularly if there's any chance something went wrong in the root file system.
manjaroid said:
Is Zygisk enabled in Magisk?
Click to expand...
Click to collapse
It is now, so I have more to learn what Zygisk enables.
manjaroid said:
I assume you followed this guide for rooting.
[GUIDE] Pixel 6 "oriole": Unlock Bootloader, Update, Root, Pass SafetyNet
⚠️⚠️⚠️WARNING! IF YOU ARE UPDATING TO ANDROID 13 FOR THE FIRST TIME, READ THIS FIRST! ⚠️⚠️⚠️ If you are looking for my guide on a different Pixel, find it here: Pixel 3 Pixel 3XL Pixel 3a Pixel 3aXL Pixel 4 Pixel 4XL Pixel 4a Pixel 4a (5G)...
forum.xda-developers.com
Click to expand...
Click to collapse
Correct ... re-flashed factory image, then rooted with Magisk. Process repeated several times carefully, all with same results.
manjaroid said:
Appending a line using Termux works for me also. Are you denied when you try?
Click to expand...
Click to collapse
Appending a line works with Termux. Saving /system/etc/hosts after editing within Termux or Solid Explorer fails.
manjaroid said:
Code:
$ su
# echo 192.186.1.234 site3.local >> /system/etc/hosts
Click to expand...
Click to collapse
Success.
manjaroid said:
If that works there's no reason a root file manager shouldn't work. (To enable root in Solid Explorer tap the hamburger icon upper left then the sprocket icon and scroll down.)
Click to expand...
Click to collapse
Well, neither root file explorer works to save the file, but appending other text to /system/etc/hosts works, so I'll just write a simple shell script that I can run as needed.
I want to thank you so much for your patient help. I never thought Google would make things so difficult for those of us who need the use of a pocket Linux computer.
Please consider this thread closed.
Related
Hey there,
this is my first thread ever created by me in a development forum.
I wanted to share my sollution for a adfree Android system, without unlocking the boatloader to get R/W access to /system.
I did try it on my device, everything went fine, but i will not take any kind of reponsibility for your devices. Also your warranty may be void!
What you need:
- rooted XTZ (i tried it on the 16GB Wifi only version)
- busybox installed
- Android SDK or adb.exe
- patched hosts file, I took mine from my HTC ONE with adaway installed (unzip first)
Click to expand...
Click to collapse
How to do it:
- get a patched hosts file from another device, or use mine (attached)
- put the file on the root of your sd card (so it will be /sdcard/hosts)
- connect your tablet to your PC, make sure usb debuggig is turned on
- launch cmd window, where your adb.exe is located
- entering following commands:
Code:
0. adb shell
1. su
2. stop ric
3. busybox pkill -f /sbin/ric
4. mount -ro remount,rw /system
5. busybox cp -af /sdcard/hosts /system/etc/hosts
- if everything went ok, you should now be able to see all the entries in your /system/etc/hosts file
- sadly you have to update the file if there some new adhosts, but it will remove a lot of annoying ads from all apps and the browser
- the changes are permanent, even at a reboot
Click to expand...
Click to collapse
Just let me know, if you have some kind of questions!
thanks @juanyunis for the [TEMPORAL-FIX] Remount RW /system reboot thread, from which i got some ideas.
Greetings from Germany
I have been using the AdAway app continuously since Google decided to eliminate all ad blocking apps from its Play Store and from my experience, AdAway does not require an unlocked boot loader to work, it only requires root access, and AdAway has no problem installing a hosts file in the /system/etc directory, so I am curious about why you have to go through all that.
The problem is, that if you using vroot like i did, and you doing nothing else, you don't have read write access to /system. So adaway, adfree and whatever can't edit the hosts file. Therefore is my little mod to get it done manually
Havoc2k said:
The problem is, that if you using vroot like i did, and you doing nothing else, you don't have read write access to /system. So adaway, adfree and whatever can't edit the hosts file. Therefore is my little mod to get it done manually
Click to expand...
Click to collapse
after vroot, install SuperSU and then all app ad-blocking apps are working good.
nope sorry, i did it, installed vroot, switched to normal superSU and installed busybox. But there is no RW access, so the ad blocking apps will work, but only to the next systemreboot / userswitch
tried all of them, and tried to manually edit the host file, but without access it will not happen
greetings
Havoc2k said:
But there is no RW access
Click to expand...
Click to collapse
strange thing that with root there is no RW access.
Havoc2k said:
nope sorry, i did it, installed vroot, switched to normal superSU and installed busybox. But there is no RW access, so the ad blocking apps will work, but only to the next systemreboot / userswitch
tried all of them, and tried to manually edit the host file, but without access it will not happen
greetings
Click to expand...
Click to collapse
I have tested and have for several months ran AdAway on my XTZ, on which Vroot was used to gain root access and SuperSU is installed, and AdAway has no problem writing a hosts file to the /system/etc directory even though the permissions for the /system and /system/etc directories are set to read-only. So, because I have no problem with AdAway and you apparently have a problem with AdAway, I believe it is likely there is a flaw in your root access setup. But hey, I could be wrong.
This mod has since been discontinued in favor of Adaway. Read on for information on how to use Unified Hosts with Adaway
What are Unified Host Files?
Unified host files combine many reputable sources into a single hosts file (with duplicates removed). Some examples include adaway, mvps, yoyo.org, and malware domain list (see Steven Black's page here for a complete list).
Adaway Installation for Magisk:
Adaway version 4.x now works properly with magisk systemless hosts. To enable it, just install the latest version from here (the main xda thread for it hasn't been updated for it yet). Then go to Preferences -> Enable systemless mode. This automatically enables the Systemless hosts option in magisk manager so no need to bother with that. Then use the app as normal.
How to Add Unified Hosts to Adaway:
In the adaway app, go to Preferences -> Redirection IP (NOT Allow Redirects). Change the value to 0.0.0.0. Read the readme on Steven Black's GitHub linked above for why.
Then go to Hosts Sources. Then add the url of the unified hosts you want (ONLY CHOOSE 1):
Master: https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
Master+FakeNews: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews/hosts
Master+Gambling: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling/hosts
Master+Porn: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn/hosts
Master+Social: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/social/hosts
Master+FakeNews+Gambling: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling/hosts
Master+FakeNews+Porn: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-porn/hosts
Master+FakeNews+Social: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-social/hosts
Master+Gambling+Porn: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn/hosts
Master+Gambling+Social https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-social/hosts
Master+Porn+Social: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn-social/hosts
Master+Fakenews+Gambling+Porn (This is the one I use): https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn/hosts
Master+Fakenews+Gambling+Social: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-social/hosts
Master+Fakenews+Porn+Social: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-porn-social/hosts
Master+Gambling+Porn+Social: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn-social/hosts
Master+Fakenews+Gambling+Porn+social: https://raw.githubusercontent.com/S...lternates/fakenews-gambling-porn-social/hosts
You can then uncheck the host sources already added by default to adaway since they're included in unified hosts sources already
**Note that the 'Social' filter does exactly what you think: blocks social networks. So if you use any kind of social networking, DO NOT CHOOSE THIS ANY SOURCE WITH THIS IN IT**
Using a APN that uses a proxy server or a subsidiary provider and unable to get adblocking working? See here for a fix
Original Mod Information:
Description
Blocks ads by using Steven Black's Unified Hosts
Comes with a small utility based off of LarappsOfDongle's RP modular host module that allows you to choose which kind of host file you want (adware/malware, fakenews, gambling, porn, social, or any combination)
Installation
Go to Settings in Magisk Manager and enable 'Systemless Hosts'
Flash module
Open terminal and type:
Code:
su
hosts
Then follow the prompts to install the host file of your choice.
OR
- Open terminal and type:
Code:
su -c hosts arg1 arg2 arg3
- The script will apply your arguments all at once and close. Useful for automation purposes
- For example: `su -c hosts m wr b`
- Script will apply the master filter, then your regex whitelist, then your blacklist
Updating Hosts:
Just run the hosts file again in terminal and it'll overwrite the old one
Note: The script will now notify you to say if you need to update or not at the top of it
Disabling Host Mod:
Just toggle the enable systemless hosts option in magisk manager
Whitelist Instructions:
Create an empty file on sdcard card called "whitelist"
Either add exact lines you want remove to it -> Run hosts script and choose whitelist option
For example:
Code:
0.0.0.0 facebook.com
Will unblock facebook.com
Or add regex for lines you want removed -> Run hosts script and choose whitelist regex option
For example:
Code:
.*facebook.*
Will unblock all domains with "facebook" in them
Blacklist Instructions:
Create an empty file on sdcard card called "blacklist"
Add exact lines you want to remove it (do not include the 0.0.0.0 -> so for example: "facebook.com")
Run hosts script and choose blacklist option
For example:
Code:
google-analytics.com
Will block the google-analytics.com domain (it will add the entry "0.0.0.0 google-analytics.com" to the hosts file - note the lack of the 0's here. The script takes care of it automatically for the blacklist feature)
To Remove Whitelist:
Just run hosts script and reinstall host file of choice
Latest Magisk Version Compatibility:
15.x
Source
Can't Boot?
Try rebooting into the bootloader, then boot into system. Thanks @rignfool for the tip
Bonus!
I made a quick automate flow to update the hosts file. Just import it, add a shortcut to your home screen, and you can update it in one click
Just change the 2nd block to whatever options you want
@Didgeridoohan made a tasker profile here for any who use tasker: https://forum.xda-developers.com/showpost.php?p=73369050&postcount=451
Download
How does this differ from AdAway?
serubin323 said:
How does this differ from AdAway?
Click to expand...
Click to collapse
The unified hosts file combine many sources including AdAway, mvps, malware domains, and more. Check out steve black's page in the op for a full list.
Also, for some reason, adaway wouldn't detect the systemless hosts file for me so i had to set a custom path and symlink it
Updated module for latest magisk manager update (required changes to the readme). Doesn't change the functionality of the module at all so if you're in 1.1, there's no need to upgrade since these readme changes will only be reflected in magisk manager once this module is approved into the repo.
Damnit... Wrong thread...
OK...
Syntax...
su -c hosts ______
Please fill in the blank...
rignfool said:
Damnit... Wrong thread...
OK...
Syntax...
su -c hosts ______
Please fill in the blank...
Click to expand...
Click to collapse
Code:
su
Give root permissions
Code:
hosts
Program will prompt for input. For example, if you want malware/adware (master) + fakenews + gambling, you're input would be:
Code:
fg
The reason for not including the master (adware/malware) in the arguments is that it's already included by default in each host file. So the fakenews host file is actually master + fakenews. It's how steven set it up so I have no control over it (and who wouldn't want the malware block anyways)
Found a typo in the directions for the host file. Once again doesn't effect functionality at all but does eliminate confusion so uploaded fixed version (sorry)
Zackptg5 said:
Give root permissions
Program will prompt for input. For example, if you want malware/adware (master) + fakenews + gambling, you're input would be:
Click to expand...
Click to collapse
I'm looking to execute as a one line shell command with tasker...
So I'm using 'su -c' cuz SU detection in tasker with magisksu is broken...
Then hosts... But I want to run with an argument so I don't need to interact with the script... Just have it update the hosts file...
rignfool said:
I'm looking to execute as a one line shell command with tasker...
So I'm using 'su -c' cuz SU detection in tasker with magisksu is broken...
Then hosts... But I want to run with an argument so I don't need to interact with the script... Just have it update the hosts file...
Click to expand...
Click to collapse
I've never used tasker (use automate instead). Perhaps
su -c; hosts; sleep 1; fgps; sleep 2; q
Not sure if the sleep command works for tasker (linux thing) but if there's a way to have it wait a half a second or so before inputting the next command, and then waiting 2 seconds or so to quit after the hosts is applied (not sure on the time, just guessing).
Edit, just saw you didn't want to deal with the script. The 'hosts' command is the script. If you look my source for the hosts script, it lists each url for the file and what it does. So all of the terminal code for fgps would be:
Code:
su -c
cd /magisk/.core
wget -O hosts --no-check-certificate https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts
This will replace the systemless hosts file with the one you want. Note you will at least need the wget portion of the module (system/bin) since it's not included in most roms
v1.3 update: Noticed that the disable option was broken so I removed it since it's not needed (see OP for disable instructions)
Using ze551ml, after rebooting, module disappeared. I can't find hosts command anywhere.
danzel said:
Using ze551ml, after rebooting, module disappeared. I can't find hosts command anywhere.
Click to expand...
Click to collapse
Does magisk manager say root is enabled? There's been an ongoing issue where root will disappear and so all modules will disappear as well. This isn't a module issue but a magisk issue
Automating hosts update?
Hi Zack!
Love your module, thank you!
Is there a way I can update with FG running a shell command from Tasker?
When I try
Code:
echo fg|hosts
it does download the fg file, but then it infinitely loops and never quits, until I send a CTRL-C to the terminal.
Could you please make it so hosts accepts arguments from the command line, instead of a menu?
Thank you!
Yom said:
Hi Zack!
Love your module, thank you!
Is there a way I can update with FG running a shell command from Tasker?
When I try
Code:
echo fg|hosts
it does download the fg file, but then it infinitely loops and never quits, until I send a CTRL-C to the terminal.
Could you please make it so hosts accepts arguments from the command line, instead of a menu?
Thank you!
Click to expand...
Click to collapse
The menu is part of the command line. I don't have tasker however, maybe this post will help: https://forum.xda-developers.com/showpost.php?p=71117156&postcount=9
You can circumvent running the script completely and just wget your host of choice. In that post, I have a link to the source for the hosts file with all of the urls. For fg for example, it would be: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling/hosts
Yom said:
Hi Zack!
Love your module, thank you!
Is there a way I can update with FG running a shell command from Tasker?
When I try
Code:
echo fg|hosts
it does download the fg file, but then it infinitely loops and never quits, until I send a CTRL-C to the terminal.
Could you please make it so hosts accepts arguments from the command line, instead of a menu?
Thank you!
Click to expand...
Click to collapse
As @Zackptg5 says, to automate with Tasker it's easier to just circumvent the script altogether...
I have a Tasker profile set up to fetch the hosts file directly from Steven Blacks GitHub and save it to /magisk/.core/hosts. I couldn't get wget to work properly with Taskers Run Shell, so I used the HTTP Get instead to fetch it to /sdcard and then Run Shell to move it to /magisk/.core/hosts (and to remove it from /sdcard afterwards).
Is there a possibility of whitelists?
ChronoReverse said:
Is there a possibility of whitelists?
Click to expand...
Click to collapse
In theory, you shouldn't need a white list with these hosts files. I chose them because they are gone over with a fine tooth comb so you shouldn't have any issues. However, when I get on spring break, I could attempt to add a whitelist option to the script. I was thinking the easiest way to do this would be to read a text file (would be a blank one in the module folder by default but is editable the uses to add whatever) and remove any matches from the host file. Have any better ideas to implement this? I have no experience with GUI development and that would add unnecessary overhead anyways
Does this module work currently? I disabled adaway and enabled this but it's not blocking ads that adaway blocks.
Testcase: root check by Jrummy
Adaway blocks the in app ads. This module does not
EDIT: apparently I can't read... Lol. Followed the Op and now it works great!
Neat module. It's working great! Thanks for sharing it!
Yom said:
Hi Zack!
Love your module, thank you!
Is there a way I can update with FG running a shell command from Tasker?
When I try
Code:
echo fg|hosts
it does download the fg file, but then it infinitely loops and never quits, until I send a CTRL-C to the terminal.
Could you please make it so hosts accepts arguments from the command line, instead of a menu?
Thank you!
Click to expand...
Click to collapse
I have a profile set up to do this every 12 hours. If you still need it, I updated it to use your preferred settings and exported it. All you need to do is import it in Tasker (long-press Profiles header) and turn it on.
Hi, Forgive me as I've been off the android scene for a while, at least to the point I have had to keep up with developments.
I want to replace /etc/hosts on my device to save using a vpn, etc. to block ads. On my Nexus 6P this was easy, remount rw, replace, or adfreezip.
On my S10 this is not so easy. I am unable to remount system as rw, I presume as this is 'systemless', I am also unable to remount the entire filesystem '/' as rw.
Does anyone know how I achieve this or how I replace a hosts file?
I am rooted with magisk but not with TWRP (I did flash TWRP before but could not install zips to the filesystem from twrp so just did not bother this time).
Comedy- said:
Hi, Forgive me as I've been off the android scene for a while, at least to the point I have had to keep up with developments.
I want to replace /etc/hosts on my device to save using a vpn, etc. to block ads. On my Nexus 6P this was easy, remount rw, replace, or adfreezip.
On my S10 this is not so easy. I am unable to remount system as rw, I presume as this is 'systemless', I am also unable to remount the entire filesystem '/' as rw.
Does anyone know how I achieve this or how I replace a hosts file?
I am rooted with magisk but not with TWRP (I did flash TWRP before but could not install zips to the filesystem from twrp so just did not bother this time).
Click to expand...
Click to collapse
AdAway works if you want a much easier solution.
Joe333x said:
AdAway works if you want a much easier solution.
Click to expand...
Click to collapse
Thanks. I actually realised though that Magisk has an option to generate a systemless hosts file so I've turned that on and it has done what I need.
I run a pihole at home that has a script which generates a standard hosts file from the blocklist. I can just on occasion save it to /sdcard/ and then cat /sdcard/hosts > /etc/hosts
When I get around to it I will probably just add this as a cron job
Hello there!
I'm running Android 13 an my pixel 5, i can't get adaway to write to the Hosts file.
The systemless Hosts module is there, I've take a look at the Hosts file permission but still.... Can't get adaway to overwrite his Hosts fil.
Any ideas of what's going on?
ShadowJP88 said:
Hello there!
I'm running Android 13 an my pixel 5, i can't get adaway to write to the Hosts file.
The systemless Hosts module is there, I've take a look at the Hosts file permission but still.... Can't get adaway to overwrite his Hosts fil.
Any ideas of what's going on?
Click to expand...
Click to collapse
This happens on my Pixel sometimes if I reinstall Magisk after an update. Adaway always manages to snap out of it after repeating a couple steps. I usually clear its storage too for a clean slate but that may not be necessary.
First I disable the systemless hosts module and reboot. Then in Magisk settings tap it again as if enabling for the first time. I'll reboot again for extra measure and Adaway usually starts writing to the hosts file.
well... nope.
I still have the problem.
Guess there's a change in Android 13 that Magisk haven't take a look at yet
Yeah there's an issue open on the github for this. Has a bit more information
Unable to copy hosts file on Android 13 Beta 1 · Issue #3183 · AdAway/AdAway
Attempting to use the root based ad blocker with Magisk (24.3)'s Systemless Hosts results in the following error on Android 13 beta 1 on Pixel 6: Logcat: 04-27 22:59:55.809 I/RootModel(10323): Remo...
github.com
Same here , I suppose we'll have to wait
Hello!
I am on LOS GSI 19.1, S20 FE LTE Exynos (with TWRP) - when starting Magisk have this msg:
Abnormal State
A "su" binary not from Magisk has been
detected. Please remove any competing
root solution and/or reinstall Magisk.
What could be reason of that and how to fix it. :/ Maybe someone can help...
Found your thread while searching for a solution of the same problem.
I thought I will share a solution as finding useful info novadays gets harder every day.
Not to get into detailed description, generally it's caused by su existing in /system/xbin path, and in most cases shell is started with su privileges due to an entry in /system/build.prop
Just rename the /system/xbin/su under adb shell or terminal to for example ssu/zu/subackup whatever the name is and after reboot magisk shouldn't yell with a popup.
btw. I haven't encountered any misbehaviour of magisk, but for the sake of not getting this popup I made the change by the way of working with shell on other things.
YoShake said:
Found your thread while searching for a solution of the same problem.
I thought I will share a solution as finding useful info novadays gets harder every day.
Not to get into detailed description, generally it's caused by su existing in /system/xbin path, and in most cases shell is started with su privileges due to an entry in /system/build.prop
Just rename the /system/xbin/su under adb shell or terminal to for example ssu/zu/subackup whatever the name is and after reboot magisk shouldn't yell with a popup.
btw. I haven't encountered any misbehaviour of magisk, but for the sake of not getting this popup I made the change by the way of working with shell on other things.
Click to expand...
Click to collapse
Hi I found that for some reason downgrading to android 12 PE works for some reason but when I update to android 13 EvolutionX it shows the popup do you mind sharing the command for adb on how to do this because it denied access for me when I tried remounting from r/o to r/w.
AirForceNBA said:
do you mind sharing the command for adb on how to do this because it denied access for me when I tried remounting from r/o to r/w.
Click to expand...
Click to collapse
if rom you use is complied with adb root capabilites, then just use linux mv command after connecting to shell
Code:
adb root
adb shell
mv /system/xbin/su /system/xbin/zu
if not, then maybe under twrp commandline it could be possible?
AirForceNBA said:
Hi I found that for some reason downgrading to android 12 PE works for some reason but when I update to android 13 EvolutionX it shows the popup do you mind sharing the command for adb on how to do this because it denied access for me when I tried remounting from r/o to r/w.
Click to expand...
Click to collapse
I solve this issue in my gsi evolution X android 13 after flash overlyfs.zip in my magisk manager ... Click Download System Rw in this site
Magisk Modules - some Daily use Magisk Mods in 2022 | Use these Modules Daily ! » Tech Karan
Magisk Modules are here !
techkaran.co.in
and then flash overlyfs.zip using magisk manager...
Need telegram apps and account to download the file...
Hi I have the same issue. I tried to rename su in xbin but I got permission denied. Root explorer granted root and system is rw. In abd with the command above also permission denied. Xbin folder is not visible in recovery. Overlayfs module is not working with my kernel. Galaxy S21+, TWRP, Lineage 19.1, Hari GSI kernel. Any idea?
Did
K_a_m_i said:
Any idea?
Click to expand...
Click to collapse
Did you set rw on /system or /system/xbin?
Set rw on the top dir, not nested one in which you want to make changes, or you won't get permissions to change anything in any nested directory you set rw on.
Try to copy the file somewhere else and then delete it from its original path. But I bet you won't succeed. Maybe changing the owner/group and all permissions to 777 would do.
I'd also try in safe mode, or in native recovery mode (not twrp, assuming you still have access to it) using ADB
For me it disapeard by reinstalling magisk by the TWRP.
K_a_m_i said:
Hi I have the same issue. I tried to rename su in xbin but I got permission denied. Root explorer granted root and system is rw. In abd with the command above also permission denied. Xbin folder is not visible in recovery. Overlayfs module is not working with my kernel. Galaxy S21+, TWRP, Lineage 19.1, Hari GSI kernel. Any idea?
Click to expand...
Click to collapse
Are you try to flash Overlyfs first without any module in your magisk...
After you flash magisk manager in your phone and installed already, open it and then restart your phone.. then
First: flash only Overlyfs.zip in your magisk without any module installed.. then restart your phone
Second: download root explorer and grant root
Third: find su in system/xbin and rename it in ZU and save and delete zu then restart your phone
I hope I helped you with this post