[Q] Does Android have a "hosts" file? - Samsung Galaxy S Relay 4G

I was wondering if Android has a file similar to a windows hosts - a file that manually maps IP addresses to domain names.
Thanks.

Yes. It's in /system/etc/hosts. -- You'll need to be rooted, and remount /system as read/write to be able to modifiy it.

Magamo said:
Yes. It's in /system/etc/hosts. -- You'll need to be rooted, and remount /system as read/write to be able to modifiy it.
Click to expand...
Click to collapse
I'm actually following the instructions here:
http://www.howtogeek.com/140576/how-to-edit-the-hosts-file-on-android-and-block-web-sites/
And it says "failed to copy to /system/etc/hosts: Read-only file system".
Any thoughts?

That howto foolishly leaves out two crucial steps.
adb root
adb remount
Before you try pushing the file back to the phone. As I said, this requires your phone to be rooted, and /system to be remounted as read/write.
Sent from my SGH-T699 using Tapatalk

It worked, but do I need to undo the changes? (ie, unmount, unroot before I disconnect the phone).

You shouldn't need to, however, remounting /system as readonly is not a bad idea, it would prevent malicious apps, unless designed in just such a way from writing there. Worse comes to worse, if you can't figure out how to remount it as ro, you can reboot the phone, and that will do so.

Related

[Q] Why can't I save in /sdcard/ but can save in /mnt/sdcard?

I am a new user, and just ROM'd my Motorola Milestone XT720 using the cinci Bell's 2.2 froyo update. The major problem that I am encountering is that market aps are not downloading files correctly. For example I try to add a podcast into my que using "google listen" and I get the following error:
"Error (/sdcard/com.google.andriod.apps.listen/downloads/f09cfbe (Permission Denied)"
Now I go into supermanger's filesystem, and I notice that /sdcard/ has no permissions at all. I try to add them, but nothing happens when I do. Itself, /sdcard/ is empty.
When I plug the phone into my PC, it can access the SDcard fine. In super manager however, it appears that the directory it is accessing is /mnt/sdcard.
It seems that programs assume that the SDcard is going to be located at /sdcard/ but it is really located at /mnt/sdcard. Is there any way to redirect them?
The normal mount location is /mnt/sdcard, /sdcard is just a symlink for convenience.
Apps should use the android api to determine the sdcard location
Environment.getExternalStorageDirectory();
See http://developer.android.com/reference/android/os/Environment.html
You could readding a symlink from /sdcard to /mnt/sdcard.
Regarding you changing the permissions, do you have root? If not you won't be able to change the permissions or create a symlink.
Do I have root?
Thanks for replying Dark3n.
I think I have root access, but in supermanager explorer, the root directory reads "/(r/o)" - does that "(r/o)" mean read only?
That would make sense of my problem - since I cannot delete, rename, or change the permissions on /sdcard/.
However, I'm pretty sure I have root access. I never rooted my phone after applying the ROM. I just ran superoneclick again, and it said the phone was rooted. Supermanager explorer has superuser permissions. Am I missing something?
I have root
I just installed Root Checker by Joeykrim - it verified root access and a busybox installation.
yes r/o means read only
So what do I do about it? Is this a limitation of the file explorer I'm using or my permissions? I'm not sure how to gain more permissions than superuser.
It would be a huge help if you let me know what steps I need to take. Sorry for being a noob!
ive the same problem but it's with gscript folder.
So I downloaded ES File Explorer, then went into the settings. I turned on the root function, and then used the option below it that said something like "mount root to enable write." I clicked that. ES File Explorer didn't have a change permission feature, so I held down the home button and switched over to supermanager explorer. Now the root directory read "/(r/w)." I was then able to change the permissions for /sdcard/.
The podcasts from google listen at the NPR app I was using were still not downloading properly. I rebooted the phone. Strangely, the permissions that I had just set in the root directory, and the test directory I created in root, were both gone. I don't know how that happens.
I tried using BeyondPod, which works for downloading to /mnt/sdcard/. I wonder if that means Google Listen and the NPR app (DroidShogun) were coded to save to /Sdcard/ rather than prompting the API for a path.

[Q] why can't i gain permission on root explorer?

when i try to copy files to /system/ nothing happens
i mounted as r/w so what could be the problem?
ripsta99 said:
when i try to copy files to /system/ nothing happens
i mounted as r/w so what could be the problem?
Click to expand...
Click to collapse
when paste or modifying a file in the root system, you need to tap the r/w to r/o in order to write or change permissions.
If you are doing a 3e mod, don't forget to change the permissions too.
....not working. if i change it to read only it Def not working.
ripsta99 said:
....not working. if i change it to read only it Def not working.
Click to expand...
Click to collapse
Check again to see what you are doing wrong. Its a toggle to read/write or read only.
If you're using root explorer, you have root.
Infuse n root explorer is not smart enough to pick out just you.
Edit.. Are you trying the 3e mod?
Three are easier way
ripsta99 said:
when i try to copy files to /system/ nothing happens
i mounted as r/w so what could be the problem?
Click to expand...
Click to collapse
bad su binary?
does super user show root explorer having super user permission? do you have super user installed? does it give a notification or toast that permissions were granted either when the app starts or on boot?
if that is all ok then open terminal emulator and type
su
(you should see $ change to # and a notification for superuser permissions granted.. if not you likely need to re root the phone)
if that goes OK then type
mount -o rw,remount /dev/block/stl9 /system
if it has any error like permission denied or invalid argument or can't remount folder exists or anything at all then there is something odd going on, could be something I'm overlooking, could be a bad su binary. try reflashing and don't update the binary if you are on a custom kernel.
edit: overlooking busy box. try installing it from a busybox installer from the market! that should fix it if su is OK.
Also, you may new to delete the app and reinstall, that happened to me and it thought I was trying to pirate the app. It would open but Wouldn't let me move/replace anything.
Then I went and verified I paid for it and everything worked after that.

[Q] flashing files without system r/w access? adb? cwm?

hellos, in trying to get some ad block host files installed but there's no conventional way to write the files... can i use cwm or adb to push the host files?
i understand this isn't practical in terms of keeping the host files up to date but once the files are there 90-99% should be blocked for at least a few months which is good enough for me.
i had the same problem on my a510. after you mount it as rw, use chmod to give yourself write permissions the correct dir (/etc i think?), put the host file in place, then change the permissions back.
i did this with adb.
i cant remember what the permissions are suppose to be for /system and /etc after i messed with them, so i set them both to 755, and now AdFree works as advertised. where before i tinkered with permissions, it couldn't write the host file. i tired a couple adblock apps, and they all had the same write permission issue.
Rusty_Gunn said:
i had the same problem on my a510. after you mount it as rw, use chmod to give yourself write permissions the correct dir (/etc i think?), put the host file in place, then change the permissions back.
i did this with adb.
i cant remember what the permissions are suppose to be for /system and /etc after i messed with them, so i set them both to 755, and now AdFree works as advertised. where before i tinkered with permissions, it couldn't write the host file. i tired a couple adblock apps, and they all had the same write permission issue.
Click to expand...
Click to collapse
I'm using A700 and I've already tried editing permissions, didn't work.

[Q] Unable to move apps on tablet

Alright I want to move my location spoofer app to /system/app so I can watch my hometown team on MLB.tv. This worked fine on my LG Nitro running CM10, but when I tried on my stock infinity (rooted, not updated), it won't let me. It just says "paste failed" when I try to move it. Anyone have any advice as to how to fix this?
Have y o u tried mounting the directory as rw so you can paste in there?
Sent from my ASUS Transformer Pad TF700T using xda premium
Sinker1345 said:
Have y o u tried mounting the directory as rw so you can paste in there?
Sent from my ASUS Transformer Pad TF700T using xda premium
Click to expand...
Click to collapse
No I haven't, but just to clarify the app is currently installed on the internal memory, not sd card. I am just trying to move it from one folder to a different folder. Is this still necessary?
It may be, if the directory is mounted as read only you won't be able to copy into it
Sent from my SCH-I535 using xda premium
mgoblueno1 said:
No I haven't, but just to clarify the app is currently installed on the internal memory, not sd card. I am just trying to move it from one folder to a different folder. Is this still necessary?
Click to expand...
Click to collapse
In normal operation, /system is mounted read-only, so you need to remount it as writable first. Root-enabled file managers usually have an option for that.
Thanks guys, will try this out tonight
Alright I tried editing permissions on the system folder, the app, and the root manager app, but they were already all checked (read, write, execute). I also tried just cut/pasting a picture i took to /system/app and I didn't work either...
EDIT: I just tried the remount app, and rewrote the /system folder as rw and it still didn't work
If anyone else has any suggestions on how to fix this let me know!
mgoblueno1 said:
If anyone else has any suggestions on how to fix this let me know!
Click to expand...
Click to collapse
mgoblueno1 said:
Alright I tried editing permissions on the system folder, the app, and the root manager app, but they were already all checked (read, write, execute). I also tried just cut/pasting a picture i took to /system/app and I didn't work either...
Click to expand...
Click to collapse
That's not how you do it. Those are chmod permissions for files and directories. That controls which user groups have rwx permissions for access; nothing to do with mounts. To allow for rw access to /system you need to either do it from within a root browser (ES file explorer, tools), the remount app, or type this into the terminal:
Code:
su
mount -o remount,rw /system
Copy your file or directory, then remount the system back as ro (so you don't accidentally delete something - that's why its mounted ro by default)
Code:
su
mount -o remount,ro /system
mgoblueno1 said:
EDIT: I just tried the remount app, and rewrote the /system folder as rw and it still didn't work
Click to expand...
Click to collapse
I just tried this and it works fine. After you made your selections for /system and rw, did you click the top "Remount" button and get a small pop-up "Success!..." notification that it completed its operation? I also verified that I could copy a test file into /system/app after toggling these settings. You are doing something wrong. Read this all again.
[Edit] The only reason I can think of that it might be failing is you are really not rooted or have a corrupt root. If all else fails, run the Root Checker app to see if you really have valid root. Open up your su app and see if it prompts you to update its binaries and let it if it does (superSU).
elfaure said:
That's not how you do it. Those are chmod permissions for files and directories. That controls which user groups have rwx permissions for access; nothing to do with mounts. To allow for rw access to /system you need to either do it from within a root browser (ES file explorer, tools), the remount app, or type this into the terminal:
Code:
su
mount -o remount,rw /system
Copy your file or directory, then remount the system back as ro (so you don't accidentally delete something - that's why its mounted ro by default)
Code:
su
mount -o remount,ro /system
I just tried this and it works fine. After you made your selections for /system and rw, did you click the top "Remount" button and get a small pop-up "Success!..." notification that it completed its operation? I also verified that I could copy a test file into /system/app after toggling these settings. You are doing something wrong. Read this all again.
[Edit] The only reason I can think of that it might be failing is you are really not rooted or have a corrupt root. If all else fails, run the Root Checker app to see if you really have valid root. Open up your su app and see if it prompts you to update its binaries and let it if it does (superSU).
Click to expand...
Click to collapse
Thanks this worked!
mgoblueno1 said:
Thanks this worked!
Click to expand...
Click to collapse
Glad you got it worked out. Which way worked for you?

[Q]Deleting preinstalled apps

I am trying to get rid of lots of bloatware that I don't want in my new unlocked Motorola Atrix hd phone. I have rooted the phone and got terminal emulator and su working. When I read around on the internet, there are posts describing to remount the /system/app for read/write, delete the apk and odex files and the remount again for read only.
My understanding is that root should be able to "rm" those files in "su" mode if you can see them. So why do we have to remount them before deleting and after? What does it do? What happens if I simply "rm" the apk and odex files in /system/app without remounting before or after, I mean if I am able to "rm"?
Thank you.
I believe the logic is that for security reasons the system/app partition is mounted in read-only mode by default. With root privileges, you can mount it as read/write and make changes such as removing apk files. When you're done editing, you should remount the /system/app partition as read-only, restoring it to its default state. If you don't, any process could theoretically make changes to the files in that partition which could damage your OS or apps.
So we remount the partition because we cannot delete them otherwise. That means if we are able to delete them without remounting, it is OK to do so. Correct?
I believe so. But just to be sure, I would strongly advice to make a nandroid backup before you delete any files.
skipperx said:
I am trying to get rid of lots of bloatware that I don't want in my new unlocked Motorola Atrix hd phone. I have rooted the phone and got terminal emulator and su working. When I read around on the internet, there are posts describing to remount the /system/app for read/write, delete the apk and odex files and the remount again for read only.
My understanding is that root should be able to "rm" those files in "su" mode if you can see them. So why do we have to remount them before deleting and after? What does it do? What happens if I simply "rm" the apk and odex files in /system/app without remounting before or after, I mean if I am able to "rm"?
Thank you.
Click to expand...
Click to collapse
Just use this app free from the Play Store: https://play.google.com/store/apps/details?id=com.jumobile.manager.systemapp
No messing around with Terminal and any commands.
I found out. I could not delete even as su and got a msg that it was read only. That's why we need to remount.
Or you can use Titanium Backup. TB has option to backup system app&data and then remove.
It's safer...
You can also freeze apps with TB. If something goes wrong, you can unfreeze it or do factory reset.

Categories

Resources