Setting system root as RW default - Android Q&A, Help & Troubleshooting

Hey there?
I've got a question which I can't seem to find anywhere else and YES I have searched this forum and google. However, I may miss it.
Anyway, I've mapped my android phone as a network drive using Samba and changed the smb.conf file to show the System Root directory as well. However, system root is default set as R/O so to mange files USING my computer I need to change the permission to R/W using a file manager (such as root explorer). This is annoying, as I have to keep doing this in order to write to certail directories.
What I wish to do is create a massive guide on all of this to help out the community, however I need one little bit of information.
I would like the / directory (root) to be mounted as R/W as default so that I can quickly edit files on my PC without having to constantly change it to R/O.
If this has been answered before, I do apologize.
Thanks in advance.
Regards,
xxSHABSxx
EDIT:
To make things a bit clearer.
I want something that will automatically mount my phone's root dir into rw upon boot, without custom apps/having to manually mount as rw everytime it reboots. And yes I understand there are apps that do this.

Yes, the root file system is read-only, but it's also volatile. It's restored from the initramfs in the boot image each time you reboot the phone, so only mounting it writeable, doesn't do you very much anyway.
In /init.rc you find a line:
Code:
mount rootfs rootfs / ro remount
This remounts your root read-only. Remove this, and it'll stay writeable. But again, all edits to the root file system are volatile. To change this, you must flash a new boot.img
An easier way would be a root-app remounting it writable again after boot.

kuisma said:
Yes, the root file system is read-only, but it's also volatile. It's restored from the initramfs in the boot image each time you reboot the phone, so only mounting it writeable, doesn't do you very much anyway.
In /init.rc you find a line:
Code:
mount rootfs rootfs / ro remount
This remounts your root read-only. Remove this, and it's stay writeable. But again, all edits to the root file system are volatile. To change this, you must flash a new boot.img
An easier way would be a root-app remounting it writable again after boot.
Click to expand...
Click to collapse
Ahh I figured as much, since Google didn't offer any solutions to me. And flashing is way much more effort than simply having an app that does it for you.
Anyway thanks for the reply!

xxshabsxx said:
Ahh I figured as much, since Google didn't offer any solutions to me. And flashing is way much more effort than simply having an app that does it for you.
Click to expand...
Click to collapse
Or do like I did, move the root to a real ext3 non-volatile file system instead.

Related

write permission on / (not /system)

Hi all, probably mine is a noob question, since in android I'm quite a noob. I've been using gentoo for years though so I'm somehow confident with the shell and I'd love it to work on it on my rooted sgs2
So, basically, I searched but I didn't find (/me fool). When asking for write permission everyone is talking about /system, but not / in general. Is there a reason? If I need to copy&paste or just create a file directly in / how can I do?
Giving a #mount command shows me only this about "/" :
rootfs on / type rootfs (ro,relatime)
so there is no indication about a /dev/block adress or a "real fs" information (which for what I know is ext4). Also those informations looks like a "pseudo-filesystem" partition, like sysfs or fusefs for instance.
Looking at the rest of the "#mount" output (aka "cat /proc/mounts") I see the only other partition mounted in ro is /system, but it has a block device association and I can remount it in rw easily. Not the same with /
Can anyone clarify me please? Is there a way to mount / in rw?
This is because that's where we want to use. The system area is where modifications of the device (done by people who should know exactly what they are doing; e.g changing build.prop codes) is made. It can easily be made r/w but only if your device is rooted and in many cases S-OFF'ed. If you have root (and for some devices S-OFF), then you can just use a file explorer (which supports root functions e.g Root Explorer) to mount it as r/w (this is the easiest way).
Yes, my phone is rooted and S-OFF'd and everything's fine, I have no particular problem to fix, just wondering.
So what if anything goes corrupted in / (outside /system, /data or any other separate partition) and we need to restore it or just create a script or anything changing permissions or writing data on the / partition? Btw: for what I know about linux, the root partition (I mean "/" not "/root") must be a "real partition" with a proper fs and mount point, and not anything cached somewhere. Guess it must be the same in android too. So, where is it?
johnnystuff said:
Yes, my phone is rooted and S-OFF'd and everything's fine, I have no particular problem to fix, just wondering.
So what if anything goes corrupted in / (outside /system, /data or any other separate partition) and we need to restore it or just create a script or anything changing permissions or writing data on the / partition? Btw: for what I know about linux, the root partition (I mean "/" not "/root") must be a "real partition" with a proper fs and mount point, and not anything cached somewhere. Guess it must be the same in android too. So, where is it?
Click to expand...
Click to collapse
For Android (about corruption for the first question), people usually just reflash the rom since you wouldn't be able to boot the phone (at least fully) to be able to replace a missing file(s). Where is "/" you ask, if you open Root Explorer that's where you'll be.
I know where is "/" in that sense, I meant where is the partition or the mount point
anyway..... not a big issue. I must deduce in android, in any present past and future device, the /efs directory is mounted on a separate partition. All my guessing came mostly from that point, since I wanted to backup and most of all _restore_ that dir using the shell. Again, I don't need it now, I did my backup and I hopefully will never need a restore. Most of all in my sgs2 /efs is on a rw partition, so no issue at all even in case of deep trouble (/efs deletion).
And yep, I know about EFS Pro and similar tools, but wanted to try the sh way and to understand something more of android in general
why is the trouble EFS deletion? what is EFS partition for?
Sent from my Nexus S using XDA App
Speaking on this subject, I have tried but cannot remove the file "/sys/devices/virtual/sec/ts/touchkey_led" (trying to turn off lights behind capacitive buttons).
Does anyone know how to move/delete this?
No, led hack doesn't work on my device if you are wondering.
why is the trouble EFS deletion? what is EFS partition for?
Click to expand...
Click to collapse
/efs is where your IMEI and other critical (and legal) information of your device are stored. You should backup it as soon as you root your phone, before any other mod. Hence comes the troubles, since if you delete it for any reason, you are in deep troubles, expecially if you didn't backup it.
I have tried but cannot remove the file "/sys/devices/virtual/sec/ts/touchkey_led"
Click to expand...
Click to collapse
I'm not totally sure about what I'm saying on android, but on linux /sys is an in-memory filesystem, meaning it is generated by the system after (at) boot and it's where all your device are linked in for the kernel, so it basically manged by the kernel itself. That could be the reason why you cannot delete anything in there. But again, I'm somehow guessing so, wait for someone else to confirm (or deny)
johnnystuff said:
That could be the reason why you cannot delete anything in there. But again, I'm somehow guessing so, wait for someone else to confirm (or deny)
Click to expand...
Click to collapse
Actually you can delete items in there... but they will just be re-created .

Why does my /system & /etc mount as R/W on boot? How to fix?

Of the 20+ Android phones I have had, and each being rooted and ROM'd, this is the first that I have seen.
On the TPC ROM, when my phone boots, my /system & /etc are mounted by default as Read/Write rather than Read Only. I have no such problem when I flash SAUROM.
I can set it to R/O, reboot, it becomes R/W again.
I asked the question in the ROM thread but got no help. It seems that others don't have this problem.
Why is this and how do I fix it?
Thanks.
Edit: The mount point is /dev/block/mmcblk0p24 for /system and /etc. There are some remount commands in a file located in init.d. Could that be the cause?
I'm no dev, but have you looked at the superuser logs to see what app might be changing r/rw modes? You say when you reboot it changes back. So that makes me think an app you have auto starting is mounting the system rw to make a change and failing to mount back to R.
Go in SuperUser.. clear the logs, set it to R, make note that it saved that change in the log using whatever program you use it to set with... Reboot, check Superuser logs to see what gained root and changed it back.
snovvman said:
Of the 20+ Android phones I have had, and each being rooted and ROM'd, this is the first that I have seen.
On the TPC ROM, when my phone boots, my /system partition is mounted by default as Read/Write rather than Read Only. I have no such problem when I flash SAUROM.
I can set it to R/O, reboot, it becomes R/W again.
I asked the question in the ROM thread but got no help. It seems that others don't have this problem.
Why is this and how do I fix it?
Thanks.
Click to expand...
Click to collapse
jb0nd38372 said:
I'm no dev, but have you looked at the superuser logs to see what app might be changing r/rw modes? You say when you reboot it changes back. So that makes me think an app you have auto starting is mounting the system rw to make a change and failing to mount back to R.
Go in SuperUser.. clear the logs, set it to R, make note that it saved that change in the log using whatever program you use it to set with... Reboot, check Superuser logs to see what gained root and changed it back.
Click to expand...
Click to collapse
Thanks for the suggestion. I removed all the apps that requested SU on boot, but the ROM still had /system as R/W. I don't think it's an app doing it.
Is there a way for me to add something into a boot script to set it as R/O?
Thanks.
I'm still trying to track down this problem.
I noticed that /etc also mounts as R/W by default. I see that both /system and /etc share the same mount point: /dev/block/mmcblk0p24.
I look in init.d and found one file which contained these lines:
#mount fs for faster IO speeds
mount -o remount,nodev,noatime,nodiratime /dev/block/mmcblk0p24 /system
mount -o remount,noauto_da_alloc,nodev,noatime,nodiratime /dev/block/mmcblk0p25 /data
mount -o remount,noauto_da_alloc /dev/block/mmcblk0p26 /cache
Would the first line cause this?
Is there something I can add to init.d to re-mount as R/O?
I'm still curious as to what is causing this. Thanks for any help.
Through trial and error, I found this command works to set /system and /etc to RO:
mount -o remount,ro /dev/block/mmcblk0p24 /system
I added it to init.d, and it works. Once the phone completes the boot, those directories are RO. It's just a patch.
But nevermind that--I am still very interested in the "why" and if there is some other script/boot command somewhere that is causing this.
I'd appreciate some guidance. Thanks.

[Q] Unable to change file permission on rooted Samsung Galaxy S III

Hi,
I tried changing file permission on one of the folders where I saved my photos to read-only using "Root Browser Lite".
The following error message came up: "Changing permission was not successful. Please note that some file systems do not allow permission changes".
I tried using ES file explorer but it also failed.
Could someone please tell me how I could change the file or folder permission. I wanted to prevent the photos from being accidentally deleted by my children when I let them browse their photos..
My phone I9300 was rooted using CF Auto Root.
Thanks
Get root explorer, it's much better.
Simply long press on a folder and the permissions option is there.
Sent from my GT-I9300 using xda premium
Don't forget to set to rw at the top of root explorer before attempting to change permissions
If you're talking about the internal memory, you can do chattr +i /data/media/[name of folder] to set the immutable bit. EDIT: You need BusyBox installed for the chattr command
This works because /storage/sdcard0 (JB's usual mountpoint for the internal eMMC) is a fake FAT32 file system Google created for compatibility; the internal eMMC can really be found at /data/media, which is of the ext4 filesystem.
For the external memory, you can try SGS3 Easy UMS and set the read only property on the folder using your computer. (I can't find mattrib for Android.) There is no guarantee that Android/Linux programs will obey the RO attribute, however.
The reason why Root Browser Lite & ES File Explorer didn't work is because they work on UNIX file permissions, while a file system formatted using FAT obviously doesn't understand them - it would expect DOS/FAT attributes. That said, though, have you already backed up the data you consider to be important?
100% work
Try this.....
http://forum.xda-developers.com/showthread.php?t=2038243
this will help you 100%..
qwerty12 said:
If you're talking about the internal memory, you can do chattr +i /data/media/[name of folder] to set the immutable bit. EDIT: You need BusyBox installed for the chattr command
This works because /storage/sdcard0 (JB's usual mountpoint for the internal eMMC) is a fake FAT32 file system Google created for compatibility; the internal eMMC can really be found at /data/media, which is of the ext4 filesystem.
For the external memory, you can try SGS3 Easy UMS and set the read only property on the folder using your computer. (I can't find mattrib for Android.) There is no guarantee that Android/Linux programs will obey the RO attribute, however.
The reason why Root Browser Lite & ES File Explorer didn't work is because they work on UNIX file permissions, while a file system formatted using FAT obviously doesn't understand them - it would expect DOS/FAT attributes. That said, though, have you already backed up the data you consider to be important?
Click to expand...
Click to collapse
=============
Thank you all for your advice. The file system explanation betw FAT and ext4 fs makes sense. I have BusyBox installed.
Via Terminal Emulator, when I did "chattr -i /data/media/DCIM/Camera", I got a "permission denied".
Is there something that prevented me from this?
I'm running ICS.
Thanks
Did you type su before the command..
Just asking..
sent from here, there, somewhere!!
zoot1 said:
Did you type su before the command..
Just asking..
sent from here, there, somewhere!!
Click to expand...
Click to collapse
Thanks Zoot1.
I did that.
Image Gallary is still showing /mnt/sdcard/DCIM/Camera as "writeable".
What is the difference between two folders /data/media/DCIM/Camera and /mnt/sdcard/DCIM/Camera?
Thanks,
Note that I used +i in my example invocation of chattr. - removes the attribute; + sets it, which is what you want
Sent from my GT-I9300 using Tapatalk 2
Thanks qwerty12, after 'chattr +i folder name' , I return to root browser lite to change permission on mnt/sdcard/DCIM/Camera, I still get permission denied. What did I do wrong?
Sent from my GT-I9300 using xda app-developers app
Mount System RW
The problem is that your system is currently in RO (Read-Only) mode.
Even if you are root, can't mess with system files if the setup is like that.
ES File Explorer works because it has an option (that DOES work) to mount the system in RW (Read-write) mode.
On my ES File Explorer Version 3.0.0 it goes like this:
Android menú button--->Tools---->Root Explorer--->Mount R/W.
Set: /system (or all of the options) to: RW----->OK.
Now, explore your files using the ES File Explorer interface on your phone and you should be able to erase every file and apk you want even if they are system files.
Vanyna said:
The problem is that your system is currently in RO (Read-Only) mode.
Even if you are root, can't mess with system files if the setup is like that.
ES File Explorer works because it has an option (that DOES work) to mount the system in RW (Read-write) mode.
On my ES File Explorer Version 3.0.0 it goes like this:
Android menú button--->Tools---->Root Explorer--->Mount R/W.
Set: /system (or all of the options) to: RW----->OK.
Now, explore your files using the ES File Explorer interface on your phone and you should be able to erase every file and apk you want even if they are system files.
Click to expand...
Click to collapse
finally its worked for me thx very much dude:laugh::good:

[Q] 4.0.3 HTC Temp Root Question

Hello everybody,
i have gained root access to my phone via backup/restore method through adb where local.prop is stored in /data/. So when i log onto my phone with adb i have root access. I copied busybox, su and the superuser.apk to the right place and removed the local.prop file again. After a reboot I was hoping to remove some crapware off my phone but to my surprise the binaries i copied vanished from the filesystem. So the phone reverted the changes by itself. I did this process several times copying busybox and su to various places referred to by $PATH, but it´s everytime the same after i reboot. The files are gone.
After the first attempts failed i tried to make changes to my phone while logged in as root. I wanted to uninstall unnecessary packages with "pm uninstall" but that failed also. The command just responds "failed". Even when /system is mounted rw (it remounts itself to ro after a while though). I´ve also made changes to /init.rc but they are also gone after a reboot as other changes i´ve made. Basically i wasn´t able to accomplish anything with root access no matter what i did.
So what i want to know is how this black magic works andy why i cant do anything with root. I know how to achieve real root through htc dev and various other methods.
Thanks for reading!
nasenstueber said:
Hello everybody,
i have gained root access to my phone via backup/restore method through adb where local.prop is stored in /data/. So when i log onto my phone with adb i have root access. I copied busybox, su and the superuser.apk to the right place and removed the local.prop file again. After a reboot I was hoping to remove some crapware off my phone but to my surprise the binaries i copied vanished from the filesystem. So the phone reverted the changes by itself. I did this process several times copying busybox and su to various places referred to by $PATH, but it´s everytime the same after i reboot. The files are gone.
After the first attempts failed i tried to make changes to my phone while logged in as root. I wanted to uninstall unnecessary packages with "pm uninstall" but that failed also. The command just responds "failed". Even when /system is mounted rw (it remounts itself to ro after a while though). I´ve also made changes to /init.rc but they are also gone after a reboot as other changes i´ve made. Basically i wasn´t able to accomplish anything with root access no matter what i did.
So what i want to know is how this black magic works andy why i cant do anything with root. I know how to achieve real root through htc dev and various other methods.
Thanks for reading!
Click to expand...
Click to collapse
is your RECOVERY.img
and beside i dont really think your /system is fully mounted rw
mauricio.valladolid said:
is your RECOVERY.img
and beside i dont really think your /system is fully mounted rw
Click to expand...
Click to collapse
Thanks for the reply. i use mount -o remount,rw /system as mount command to get read/write permission on /system. If there is something more to do please let me know. And if the behavior i ve seen is caused by the recovery.img is there something i can do about it?
nasenstueber said:
Thanks for the reply. i use mount -o remount,rw /system as mount command to get read/write permission on /system. If there is something more to do please let me know. And if the behavior i ve seen is caused by the recovery.img is there something i can do about it?
Click to expand...
Click to collapse
why dont you just install ext4 recovery and flash supersu.zip?
I really dont get it why are you trying to do it the hard way

Strange behavior of the system folder

Hello everyone,
I’ve a problem with my system folder as I can’t write to it anymore.
Phone: HTC Desire with Android 4.1.1;
rom: https://forum.xda-developers.com/showthread.php?t=2183281
My story: I wanted to try a model specific soft and I made a change of model in the build.prop in the system folder. Everything was ok, but when I edited back the build.prop with ES file editor, it saved the file as a blank file. I then moved the blank file to the SD card with success and tried to copy the build.prop from a backup I’ve done; and I get permission denied…
So far I’ve tried:
- Re-mounting the system folder
- Clearing ES file explorer data to give a SU access again
- Trying the same thing with Terminal Emulator but I’m not familiar with android command line
So now I’ve a phone without build.prop in the system and I suppose it will not be happy about it the next reboot.
My question: How I lost the capacity to write to the system folder, from a theoretical point of view, and how I can clean this mess as a personal matter. As the phone is still up I hope that it’s still possible to solve the problem without having to re-install everything.
If someone is interested by this, I will welcome any help.
Kuroneko
Try
mount -o remount rw system
In terminal.....And then try to copy with terminal itself...Use CP command
Thank for the help but sadly it didn’t make the trick.
I use Terminal Emulator
After several trials with the command I think that I’ve found the correct syntax but at the end it didn’t worked.
Working in the root folder where I put a copy of build.prop:
su
mount –o remount,rw /system
cp build.prop /system/build.prop
>can’t create “/system/build.prop”: Out of memory
I also tried to create a text file in the system folder with Total Commander without success.
I fear that there is a serious **** up in the system, probably with the file handling. Under windows (and dos) I could find my way but I’m not familiar with Linux system, and even less with Android. Under normal circumstance I would reboot the system but without a build.prop in the system directory I fear that it will go even worse.
Any other suggestion?
Kuroneko
PS: I’ve nothing again command line but with a 3.7” touch panel it’s far from fun…
This is due to HTC's read/write protection that is built into the boot.img. You might see if there is a custom kernel for your device that has this flag disabled.
Thank for your answer,
But I’m not sure that I follow you.
If the problem was due to an r/w protection of the boot image, how I was able to modify my build.prop, and later erase it?
If you could explain this it would help greatly as it means that I could re-boot without worry.

Categories

Resources