MX Player Ready to Rock on Lollipop

A good video player should be reliable and free. One of the XDA Community Apps, MX Player, meets both of … more

How to Disable Data Encryption on Nexus 6

In late September, Google decided to step on NSA’s toes and turn on encryption by default in … more

DJI Phantom 2 Vision+ Review – XDA TV

The holidays will be here in no time, so why not start thinking about gifts now? Youll be ahead … more

Mozilla Ditches Google, Makes Yahoo Default Search Engine

Mozilla and Google have had a long-standing relationship of about 10 years. Google … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[Q] lost etc/hosts file

OP Bdvs

9th January 2014, 12:36 AM   |  #1  
OP Junior Member
Thanks Meter: 0
 
3 posts
Join Date:Joined: Sep 2012
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.
9th January 2014, 01:15 AM   |  #2  
Senior Member
Thanks Meter: 235
 
476 posts
Join Date:Joined: Oct 2012
More
Quote:
Originally Posted by Bdvs

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.

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.
Last edited by ciphercodes; 9th January 2014 at 01:26 AM.
9th January 2014, 07:55 AM   |  #3  
OP Junior Member
Thanks Meter: 0
 
3 posts
Join Date:Joined: Sep 2012
Quote:
Originally Posted by ciphercodes

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.

I have adb access how would i do it with adb
root explorer wont let me make a text file
9th January 2014, 03:14 PM   |  #4  
Senior Member
Thanks Meter: 235
 
476 posts
Join Date:Joined: Oct 2012
More
Quote:
Originally Posted by Bdvs

I have adb access how would i do it with adb
root explorer wont let me make a text file

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.
11th January 2014, 06:02 PM   |  #5  
OP Junior Member
Thanks Meter: 0
 
3 posts
Join Date:Joined: Sep 2012
Prompt play store
Quote:
Originally Posted by ciphercodes

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.

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
11th January 2014, 07:19 PM   |  #6  
Senior Member
Thanks Meter: 235
 
476 posts
Join Date:Joined: Oct 2012
More
Did you delete dalvik cache ?

Sent from my SGH-T889 using xda app-developers app
Last edited by ciphercodes; 11th January 2014 at 10:28 PM.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes