Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Some background:

My HTC Desire HD has several issues. The first issue being that I can not connect to it using a USB cable.

So I found that I can tell ADB to work over wifi and I was using this method for some time. I am using VISIONary to temproot the device, then I run a terminal on the device and execute:

$ su
#setprop service.adb.tcp.port 5555
#stop adbd
#start adbd

I then use netcfg to find my device's IP and finally on my pc I use

adb connect {device IP}:5555

I am then able to run on my pc

adb shell

and use this shell to do the following:

cd /etc
echo 127.0.0.1 localhost >hosts
echo {my pc's IP} some.dnsname.com >>hosts

This is when the second issue comes into play: once in a while (seems related to killing and clearing cache of an app that uses some.dnsname.com - but not always) the hosts file just reverts to an empty file :(

Not having the deep knowledge to handle those problems (yet) I just "learned to live with them"...

A few moments ago, when I went through this process for for maybe the 30th time or so, A new issue decided to make my day more interesting. I tried to modify (overwrite) the hosts file and I get the following message:

cannot create hosts: read-only file system

I tried to read some about it and it seems I need to remount the system in read/write mode.

running

mount | grep system

returns

/dev/block/mmcblk0p25 /system ext3 ro,relatime,errors=continue,data=ordered 0 0
none /system/xbin tmpfs rw,relatime,gid=10132 0 0

I need help with:
1) Making my system read write again (what mount/remount command do I need to run?)
2) Understanding what could have caused this new issue.
3) Any ideas on how I can handle the two background issues is also most welcome.

thank you for reading...

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

/system is almost always read-only by default. Just remount it as R/W:

# mount -t ext3 -o rw,remount /dev/block/mmcblk0p25 /system

There's also at least one app that will attempt to do this for you, but it may not work on all devices.

Another option is to use adb root (if your ROM will allow it) to restart adbd as root, then simply issue adb remount. On ROMs where adbd is already running as root, the first command is unnecessary and adb remount will work right off the bat. From a PC:

C:> adb root
* Some response about success *
C:> adb remount
Remount succeeded

As to why it's getting blown away, is your device NAND unlocked? Many HTC devices will attempt to restore their /system partition to a stock state if they are NAND locked, making changes to /system fleeting at best. That's something of an educated guess, but the fact that you noted that you are using VISIONary to temproot seems to support that hypothesis.

share|improve this answer
    
adb root says: adbd cannot run as root in production builds –  epeleg Apr 9 '12 at 13:05
    
@epeleg: You'll have to do it with mount then. –  eldarerathis Apr 9 '12 at 13:15
    
could you guess what has changed suddenly? I did this many many times and the system was never read-only. –  epeleg Apr 9 '12 at 13:36
    
@epeleg: I'm not entirely sure why it wasn't read-only to begin with, unless you're using a ROM that was modified to mount it as r/w on boot. –  eldarerathis Apr 9 '12 at 13:44
    
@epeleg: Actually, I thought of one possibility: VISIONary may have been mounting your system partition as r/w for you during the temproot process. If some system process then came along later and saw that the permissions were wrong, it could feasibly remount it read-only (which could be related to the NAND lock). –  eldarerathis Apr 9 '12 at 14:24
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.