Problem with hosts file - Desire Q&A, Help & Troubleshooting

Hi,
I'm s-on and would like to block ads on my Desire.
So I downloaded the MVPS hosts file on my pc, booted my phone into recovery, mounted /system/ and push the hosts file to /system/etc/ via adb.
Now it's in there (i can see and open the file in root explorer) but the ads aren't blocked. I can still navigate to domains that should be redirected to 127.0.0.1
What am I missing?

OK fixed it. Not sure what caused the problem.
But here is what I did to remove all ads on my HTC Desire:
1. Install AdAway from Market
2. Go to app preferences and check Target hosts file -> /data/data/hosts
3. Boot phone in recovery, mount /system and /data (in Clockwork recovery it's in "Mounts and Storage")
4. Use your PCs adb and type:
adb shell
cd /system/etc
mv hosts /data/data
ln -s /data/data/hosts hosts
exit
5. reboot phone and update the hosts file in AdAway. Done.

x01a4 said:
OK fixed it. Not sure what caused the problem.
But here is what I did to remove all ads on my HTC Desire:
1. Install AdAway from Market
2. Go to app preferences and check Target hosts file -> /data/data/hosts
3. Boot phone in recovery, mount /system and /data (in Clockwork recovery it's in "Mounts and Storage")
4. Use your PCs adb and type:
adb shell
cd /system/etc
mv hosts /data/data
ln -s /data/data/hosts hosts
exit
5. reboot phone and update the hosts file in AdAway. Done.
Click to expand...
Click to collapse
I'm fairly sure you don't need adaway if you're pushing the file to the right location from your pc.

erklat said:
I'm fairly sure you don't need adaway if you're pushing the file to the right location from your pc.
Click to expand...
Click to collapse
Yes I know. But with AdAway you always have a new hosts file.

x01a4 said:
Yes I know. But with AdAway you always have a new hosts file.
Click to expand...
Click to collapse
I guess you have a point...

x01a4 said:
OK fixed it. Not sure what caused the problem.
But here is what I did to remove all ads on my HTC Desire:
1. Install AdAway from Market
2. Go to app preferences and check Target hosts file -> /data/data/hosts
3. Boot phone in recovery, mount /system and /data (in Clockwork recovery it's in "Mounts and Storage")
4. Use your PCs adb and type:
adb shell
cd /system/etc
mv hosts /data/data
ln -s /data/data/hosts hosts
exit
5. reboot phone and update the hosts file in AdAway. Done.
Click to expand...
Click to collapse
Super. Good idea. Thank you

Related

[Q] Install busybox

Anyone knows how to install busybox?
I've tried to follow some guides but ends up with:
Code:
215:Desktop ricardo$ adb push busybox /data/local
580 KB/s (1083568 bytes in 1.823s)
215:Desktop ricardo$ adb shell
$ su
# cd /system/xbin
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
# cat /data/local/busybox > busybox
cannot create busybox: not enough memory
or
$ su
# cd /data/local
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
# dd if=/data/local/busybox of=/system/xbin/busybox
/system/xbin/busybox: cannot open for write: Out of memory
or
$ su
# cd /data/local
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
# ./busybox cp /data/local/busybox /system/xbin
cp: can't create '/system/xbin/busybox': Cannot allocate memory
same here. cannot write to rw-mounted /system.
sucks
Try my zip file. Woked for me
The only thing that I want to change and I can't is the init.rc file. I tried to mount the / (rootfs) with rw, but every time I restart my device the file is copied, again, from the ramdisk image.
I have the same problem
ricardoft said:
Try my zip file. Woked for me
The only thing that I want to change and I can't is the init.rc file. I tried to mount the / (rootfs) with rw, but every time I restart my device the file is copied, again, from the ramdisk image.
Click to expand...
Click to collapse
What should I do with your files?
Nobody has a solution to this?
I don't think this is a memory issue though, .. added 512mb swap and still it claimed to be out of memory, ..
also I figured maybe hd space .. however when i ln /data/local/tmp/busybox to /system/xbin it had the same error.
I both tried ln from the system and ln from busybox both had same result.
It's not a memory problem! In order to install it you have to be in recovery mode.
Try:
While in recovery mode use adb to connect to our phone. Now transfer the zip file (busybox.zip) to your phone and install it via clockwork recovery -> install zip file -> select my zip file.
can anyone post the proper busybox file cause for some reason the file signature verification failed.
adb push busybox-signed.zip /sdcard/busybox-signed.zip
rebooted phone held down volume button while booting ..
choose recovery, ..
choose install zip from sdcard..
then i see a lot of no and one yes .. so i choose yes but the installation is aborted.
Just install titanium backup and click on 'problems?' at the bottom. It will install BusyBox for you.
it has error during installation at line 4 with your busybox.zip
somethinf like can not chmod
(rooted buzz with stock rom)
Elibongo said:
Just install titanium backup and click on 'problems?' at the bottom. It will install BusyBox for you.
Click to expand...
Click to collapse
Do what this guy said.
titanium install in /sdcard busybox, not in /system/bin (xbin) , so it is not usuable by other apps
i have installed it in during recovery mode in /system/xbin
how now to specify PATH for using commands from it?
kevin2516 said:
Do what this guy said.
Click to expand...
Click to collapse
you have read my mind especially since that isn't free software.
hellysmile said:
i have installed it in during recovery mode in /system/xbin
how now to specify PATH for using commands from it?
Click to expand...
Click to collapse
i think you need to create aliases however why install it in xbin anyways then, .. if you need to create aliases or links in bin.. ?
example
$ ln -s /data/local/tmp/busybox ls
$ ./ls
if it is in a path that is included in PATH executing a command will auto look for it in all directories defined in PATH env so basicly you could just create all the directories under /data/local/tmp/bin
and just then append that to PATH env echo $PATH then append :/data/local/tmp/bin to it and busybox should work as well.
Ofloo said:
you have read my mind especially since that isn't free software.
Click to expand...
Click to collapse
titanium backup is free software... look on the market, there's a free version and a donate version.
i have aliases in /system/xbin
they was created after busybox --instal -s
but in system allready exists some commands like ls => i want to use ls from busbox, not from system
and terminal emulator dont anderstand ^[ likes bindings
is there a definitive way to do this. There seems to be no clear way of doing it.
matpol said:
is there a definitive way to do this. There seems to be no clear way of doing it.
Click to expand...
Click to collapse
Maybe this helps:
fang0654 said:
To install:
1) extract and push busybox to your sdcard, reboot into recovery
2) mount /system
3) if you don't have /system/xbin (you should), create it
adb shell:
# mkdir /system/xbin (if necessary)
dd if=/sdcard/busybox of=/system/xbin/busybox
cd /system/xbin
chmod 755 busybox
./busybox --install .
4) reboot and done
OPTIONAL - before rebooting replace the busybox installed by the root process in /system/bin
1) mv /system/bin/busybox /system/bin/busybox.bak
2) cp /system/xbin/busybox /system/bin/busybox
Click to expand...
Click to collapse
from this site: http://forum.xda-developers.com/showthread.php?t=702634
The above is pretty straightforward. The only thing is you need to download the zip in the other thread and 'busybox' refers to the binary in the zip rather than the whole directory - as I understand it. Correct me if I am wrong but trying the dd command on the dir will not work.
matpol said:
The above is pretty straightforward. The only thing is you need to download the zip in the other thread and 'busybox' refers to the binary in the zip rather than the whole directory - as I understand it. Correct me if I am wrong but trying the dd command on the dir will not work.
Click to expand...
Click to collapse
You dont have to extract the binary into a folder, just extract the busybox file direct on your sdcard. Than the dd command should work, on my phone it works fine.
But if not, does the command cat in the adb shell work?
If so, try istead of the dd comand:
Code:
mount /sdcard
cat /sdcard/busybox > /system/xbin/busybox
And remember to start your wildfire in the recovery mode, that was the mistake I had done...

[Q] I/O Error on /etc/hosts after permroot (VISIONary r14; Adfree)

After permroot with VISIONary r14 I am getting an I/O Error on /etc/hosts and /system/etc/hosts. This is sad as my purpose in permrooting is to have a custom hosts file.
This is the sequence of events as I recall it:
1) Performed a temproot using VISIONary r14
2) ADB pushed my hosts file to /data/data/hosts
3) Set up my hosts file as the one to be consulted (as root)
Code:
mount -o remount,rw /dev/block/mmcblk0p25 /system
rm /etc/hosts
ln -s /data/data/hosts /system/etc/hosts
mount -o remount,ro /dev/block/mmcblk0p25 /system
4) Installed AdFree (granted rights, hosts file downloaded to /data/data/hosts; did not check symlink creation)
5) Removed AdFree and pushed my own hosts file again (as I need some entries for local network)
6) Performed a permroot
At this point I noticed some ads had appeared on a web page I normally have ad-free. So I thought that to be odd. I also did find /etc/hosts again. Not to worry, I will just do step 3 above again now that permroot is done (successfully). At least, that's what I thought. Remounting the filesystem is not a problem. The filesystem is indeed mounted as writable when I check cat /proc/mounts. But then I get the error:
Code:
# rm /etc/hosts
rm /etc/hosts
[B]rm failed for /etc/hosts, I/O error[/B]
This is the same for /system/etc/hosts.
The result is that my custom hosts file is not used
All commands are run through ADB shell, not a terminal emulator on the phone.
Please let me know if you have any suggestions.
e2fsck_recvy is not an option on a device mounted as /system. I suppose I could run it from some recovery mode...no knowledge about that.
HTC Desire HD
Android 2.2
Software version 1.32.405.6
PS: this thread is not to discuss the philosophical position one may have on blocking advertising and the like.
you cant do this with temp root..... without s-off the nand protection will stop you writing to /system even when logged in as su
This error occurs with permroot, not temproot.
But if I understand you correcty my only option is to go for a custom ROM. This may be a little too much hassle just to turn off the ads.
Update: performed S-OFF as described here: [TOOL][VIDEO] One click Radio S-OFF, SimUnlock (Easy Root & S-OFF Guide). Unfortunately still get /system/etc/hosts: I/O error.
Vic_E said:
4) Installed AdFree (granted rights, hosts file downloaded to /data/data/hosts; did not check symlink creation)
Click to expand...
Click to collapse
I've been thinking about making this more explicit, the symlink box isn't just to create a symlink, it's also to use the symlink, regardless if you made a symlink manually or not.
I'd suggest ticking this, at least then adfree should work, although it's weird that you can't even cat the /system/etc/hosts file.

Howto apply manually update to 4.0.4 with encrypted flash and minor changes

OK i'm posting this since it was a bit complex and i think others could benefit.
I was on 4.0.2 stock HSPA (yakju-icl53f). But i had made some minor changes, and worse, had encrypted the flash. How to update to 4.0.4 without a wipe? Turns out it is possible.
First, get CWM and 4.0.4 image.
Clockworkmod from here.
OTA image from 4.0.2 to 4.0.4 from here.
Steps needed:
1. adb reboot bootloader
2. fastboot cwm.img
3. adb shell
4. mount -t tmpfs -o size=330M,mode=0777 tmpfs /sdcard
5. adb push 7f97fbc19417.signed-yakju-IMM76D-from-ICL53F.7f97fbc1.zip /sdcard/update.zip
6. unzip 7f97fbc19417.signed-yakju-IMM76D-from-ICL53F.7f97fbc1.zip META-INF/com/google/android/updater-script
7. unzip 7f97fbc19417.signed-yakju-IMM76D-from-ICL53F.7f97fbc1.zip META-INF/com/google/android/update-binary
8. adb push META-INF/com/google/android/updater-script /sdcard/
9. adb push META-INF/com/google/android/update-binary /sdcard/
10. Fix all the changes you made in the past <more below>. You can try the below steps and just see which assert fail, and then fix them one by one
11. adb shell
12. cd /sdcard/
13. chmod a+rx *
14. ./update-binary 2 stdout update.zip
15. reboot and enjoy.
The changes i had made were to build.prop (adding ro.config.vc_call_vol_steps=10 from volume+) and to remove GenieWidget.apk via TitaniumBackup.
To fix these, i got the 4.0.2 stock image from here.
1. tar zxvf yakju-icl53f-factory-89fccaac.tgz
2. cd yakju-icl53f
3. unzip image-yakju-icl53f.zip
4. Get the ext4_utils file from here. Build it.
5. run simg2img system.img x.img
6. mkdir ./x; sudo mount -o loop -t ext4 ./x.img x
7. adb push x/app/GenieWidget.apk /system/app/
8. adb push x/app/GenieWidget.odex /system/app/
9. adb push x/build.prop /system/
[i just kept running the update-binary 2 stdout update.zip and watching the assert until i knew what all i had changed].
After all this, i rebooted, and it worked. Despite my being encrypted. Despite my changes. Despite my not being eligible for OTA yet. Once i rebooted, i entered my decryption key, it chewed on the upgrade for a bit, and i'm on 4.0.4
Enjoy. The above instructions are for Linux obviously, and may have some minor typos as i did them afterwards.
Thank you for this howto!
Since you are "just updating" I assume you lost root?
Did the boot duration change? With crypted SGN 4.0.2 it takes an eternity and a half to boot.
yes, lost root, had to re-apply (you can use the above instructions but put the super-user zip in for cwm).
no change in boot time
Mmm, you can also do a 'mount -a; chmod 4755 /system/bin/su' if you previously had root, @ step 3 (after rebooting w/ all the changes, redo 1/2/3).
For interest (to open an old thread), this worked to move to Jelly Bean as well. I took the clockworkmod version of the JB from here.
I used the same basic steps as above, but w/ the change of:
1. make ram disk (using 390M instead of 330M)
2. unzip jb-takju.zip (on pc)
3. adb push boot.img /sdcard/
4. adb shell; cat /sdcard/boot.img > /dev/block/platform/omap/omap_hsmmc.0/by-name/boot
5. adb push system.tar /sdcard
6. adb shell; mount /system; cd /system; rm -rf *; cd /; tar xvf /sdcard/system
7. reboot. enjoy.
This kept all my settings, apps, everything... its seamless.

[Q] lost etc/hosts file

hello everyone
I have a t-mobile note 2 rooted and i was having problems with my play store and deleted my hosts file by mistake i tried making a new one with root explorer but it fails is there anything els that i can do to get it back when i reset my phone the play store is gone and i don't know what to do any help would be great.
Bdvs said:
hello everyone
I have a t-mobile note 2 rooted and i was having problems with my play store and deleted my hosts file by mistake i tried making a new one with root explorer but it fails is there anything els that i can do to get it back when i reset my phone the play store is gone and i don't know what to do any help would be great.
Click to expand...
Click to collapse
Do you have access to a system with adb or heimdall ?
If not
You can create a new file(text) named hosts under /etc/system/ with the following line
127.0.0.0 localhost
You can set the permissions of this file to 0644 via root explorer or using Terminal Emulator:
----
cd /system/etc
chmod 644 hosts
---
Never used root explorer but there has to be a GUI option somewhere in it.
You will have to mount the /system to read-write mode in root explorer in order to make any changes.
Once you have created the file, reboot the phone and see if it works, if not then manually delete all files under /system/data/dalvick-cache.
Be careful before deleting any file, make sure you browse to /system/data/-dalvick-cache directory and select all files and then delete them.
ciphercodes said:
Do you have access to a system with adb or heimdall ?
If not
You can create a new file(text) named hosts under /etc/system/ with the following line
127.0.0.0 localhost
You can set the permissions of this file to 0644 via root explorer or using Terminal Emulator:
----
cd /system/etc
chmod 644 hosts
---
Never used root explorer but there has to be a GUI option somewhere in it.
You will have to mount the /system to read-write mode in root explorer in order to make any changes.
Once you have created the file, reboot the phone and see if it works, if not then manually delete all files under /system/data/dalvick-cache.
Be careful before deleting any file, make sure you browse to /system/data/-dalvick-cache directory and select all files and then delete them.
Click to expand...
Click to collapse
I have adb access how would i do it with adb
root explorer wont let me make a text file
Bdvs said:
I have adb access how would i do it with adb
root explorer wont let me make a text file
Click to expand...
Click to collapse
1) Using text editor create a text file named "hosts" with the following contents:
---
127.0.0.1 localhost
---
If you are on windows make sure you remove the file extension.
2) Connect phone via USB and open command prompt or shell. Make sure USB Debugging is checked under developers options.
3) Check if adb detects your device by typing: adb devices , you should see your device listed, if not please check if your phone has correct USB drivers.
4) Now push the file you created to your phone with this command : adb push /path/to/file/hosts /sdcard/hosts
example: adb push C:\tmp\hosts /sdcard/hosts
5) Now log in to your phone by typing adb shell
6) Switch to super user by typing: su , grant permissions when asked by SuperSU.
7) Mount system in read-write mode by typing: mount -o remount,rw -t yaffsw /dev/block/mtdblk3 /system
8) Move the hosts file to /system/etc by typing: mv /sdcard/hosts /system/etc
9) Browse to /system/etc by typing: cd /system/etc
10) Change file owner and group by typing: chown root:root hosts
11) Change file permissions by typing: chmod 644 hosts
12) Mount system back to read only by typing: mount -o remount,ro -t yaffsw /dev/block/mtdblk3 /system
13) Delete dalvik cache by browsing to cd /data/dalvik-cache and then type rm -f *.dex
14) type exit two times to exit.
15) Reboot phone and it should work.
I believe there might be an easy way or an apk which does this but I haven't tried it.
play store
ciphercodes said:
1) Using text editor create a text file named "hosts" with the following contents:
---
127.0.0.1 localhost
---
If you are on windows make sure you remove the file extension.
2) Connect phone via USB and open command prompt or shell. Make sure USB Debugging is checked under developers options.
3) Check if adb detects your device by typing: adb devices , you should see your device listed, if not please check if your phone has correct USB drivers.
4) Now push the file you created to your phone with this command : adb push /path/to/file/hosts /sdcard/hosts
example: adb push C:\tmp\hosts /sdcard/hosts
5) Now log in to your phone by typing adb shell
6) Switch to super user by typing: su , grant permissions when asked by SuperSU.
7) Mount system in read-write mode by typing: mount -o remount,rw -t yaffsw /dev/block/mtdblk3 /system
8) Move the hosts file to /system/etc by typing: mv /sdcard/hosts /system/etc
9) Browse to /system/etc by typing: cd /system/etc
10) Change file owner and group by typing: chown root:root hosts
11) Change file permissions by typing: chmod 644 hosts
12) Mount system back to read only by typing: mount -o remount,ro -t yaffsw /dev/block/mtdblk3 /system
13) Delete dalvik cache by browsing to cd /data/dalvik-cache and then type rm -f *.dex
14) type exit two times to exit.
15) Reboot phone and it should work.
I believe there might be an easy way or an apk which does this but I haven't tried it.
Click to expand...
Click to collapse
Thanks for all your help i got the hosts file in to system/etc folder but my play store is still not working i get a pop up that play store has stop working so i cleared cache for play store, play services and google framework and its still not working
any ideas thanks again
Did you delete dalvik cache ?
Sent from my SGH-T889 using xda app-developers app

ADAway and Desire 820n a51_ul Lollipop 5.0.2

Anyone try to install adaway on stock rooted Lollipop ? I think Lollipop ignoring entires in hosts. I've moved hosts file to /data and linked /system/etc/hosts to /data/hosts cuz S-ON and does not block. Why? Entires are corrcet in hosts.
Its about the write protection from the stock kernel. We need a custom kernel, than we can write to the system. With Tomals rom adaway works great. Tomal modified the kernel, so adaway works. And you need to flash busybox from the development section.
Think You write protection in kernel causes ignoring entires in hosts? Every Linux use hosts file. Lollipop does not?
Temporary solution for advanced users only.
CAUTION: I am not responsible if You delete and/or brick Your device!!!
1. Let AdAway create hosts file on /data/ (Preferences->Target hosts file->/data/hosts)
2. Enter recovery, mount /system and /data
3. Plug in your usb cord and open a command line on your pc.
4. Enter adb shell from HTC Sync
5. Type rm /system/etc/hosts
6. Type cp /data/hosts /system/etc/hosts
7. Exit from adb shell, unmount /data and /system
Reboot
To update AdAway hosts file You need to repeat all steps eg. one per week.
Lollipop ignoring symlink to hosts file, I don't know why atm.
Tested on my own 820n.

Categories

Resources