[MOD] ro / rw scripts to remount your /system - Verizon Droid Charge

I did not write these scripts. I claim zero credit for them. I pulled them from somewhere (another ROM or a mod for another phone, I can't remember.) I am simply passing on the information.
Here is a way you can add two scripts to change your /system from read-only to read-write and visa-versa. I am not going to hold your hand through this one. If you don't understand it, then don't do it. This is only for those that want a command line script to set their system filesystem to RW and back to RO in a simple way. This is only for people that are comfortable with the command prompt and adb shell to begin with. I am not responsible if you brick your phone.
I'll say it again. I am not responsible if you brick your phone.
Save a text file called: ro that contains:
Code:
#!/system/bin/sh
fs=`mount | grep system | awk '{print $5}'`
mount -t $fs -o remount,ro /dev/block/stl9 /system
Save a text file called: rw that contains:
Code:
#!/system/bin/sh
fs=`mount | grep system | awk '{print $5}'`
mount -t $fs -o remount,rw /dev/block/stl9 /system
Then open a command prompt and change directory to where you have the ro and rw files located. Notice that the ro and rw files DO NOT have any file extension on them. These should NOT show up as text files with Notepad icons when using Windows Explorer. If they do, then you need to take the .txt off the end of the filename. If you can't see it, then you have to be sure to show the hidden extensions.
The following steps assumes that you either have adb.exe and related files in the same directory as your rw and ro scripts OR you have added adb.exe to the PATH environment variable on your computer system.
When you are ready do this:
Code:
adb push rw /data/local/tmp/rw
adb push ro /data/local/tmp/ro
adb shell chmod 0755 /data/local/tmp/rw
adb shell
/data/local/tmp/rw
cp /data/local/tmp/rw /system/xbin/rw
cp /data/local/tmp/ro /system/xbin/ro
chmod 0755 /system/xbin/ro
chmod 0755 /system/xbin/rw
/system/xbin/ro
reboot
Notice that the last command will reboot your phone. This is only necessary if you want these scripts to be usable immediately. When you have rebooted, you should be able to type the command: rw to set your /system to read-write and ro to set your /system to read-only
Personally, I skip that last "reboot" command and I just run /system/xbin/ro manually until the next time I reboot my phone anyway.
These two scripts should be compatible with what ever file system you have on /system since if you read the script it actually checks the file system type first and then uses that response in the next line.
Use at your own risk, though.
EDIT: On Gingerbread, I had to use /dev/block/stl10 instead of /dev/block/stl9 above.

Related

something up with my shell scripts.

I seem to be frequently flashing or messing up my G1 so I decided to write some shell scripts to help out but they seem to only half work if at all. Actually I'm not sure what they did because they displayed no output.
This script is supposed to backup the default init.rc and mountd.conf files then replace the existing ones with the modified ones.
Though it does not work.
Code:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
mkdir /system/sd
busybox cp -a /system/etc/mountd.conf /sdcard/recovery/mountd.conf.bak
busybox cp -a /system/init.rc /sdcard/recovery/init.rc.bak
busybox cp -a /sdcard/recovery/mountd.conf /system/etc/mountd.conf
busybox cp -a /sdcard/recovery/init.rc /system/init.rc
then this is the next set to move the apks and the program caches which doesn't work.
Code:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
busybox cp -a /data/app /system/sd
rm -r /data/app
ln -s /system/sd/app /data/app
busybox cp -a /data/app-private /system/sd/app-private
rm -r /data/app-private
ln -s /system/sd/app-private /data/app-private
rm -R /data/data/com.android.browser/cache/webviewCache
ln -s /sdcard/cache/webviewCache /data/data/com.android.browser/cache/webviewCache
rm -R /data/data/com.android.vending/cache
ln -s /sdcard/cache/marketCache /data/data/com.android.vending/cache
rm -R /data/data/com.google.android.street/cache
ln -s /sdcard/cache/streetCache /data/data/com.google.android.street/cache
reboot
Plus both run and output no errors either. Who knows what problems I'll run into because I have no idea what they actually did.
Anyone see anything wrong here?
Well I'll help you.
1-) After you back up the mount and stuff and put the other back, you MUST reboot before keep going.
2-)After boot then you can copy the files or make the symlink. I suggest you dont copy the app to the sdcard on teh scrip since they should be there already. so do that manually once then the script just delete the folders and then crate the symlinmks.
I have a menu that does that and I have got some experience as why it works one day and not the other.
Rafase282 said:
Well I'll help you.
1-) After you back up the mount and stuff and put the other back, you MUST reboot before keep going.
Click to expand...
Click to collapse
I took the reboot out after the mountd.conf and init.rc did not appear to copy due to the lack of /dev/mmcblk0p2 hoping to see some sort of output why it did not run. Unfortunately it runs and backs up the files but does not replace them with the modded ones.
Rafase282 said:
2-)After boot then you can copy the files or make the symlink. I suggest you dont copy the app to the sdcard on teh scrip since they should be there already. so do that manually once then the script just delete the folders and then crate the symlinmks.
Click to expand...
Click to collapse
Not copying the apps is a good idea, modified the script to not do so.
Rafase282 said:
I have a menu that does that and I have got some experience as why it works one day and not the other.
Click to expand...
Click to collapse
Does Android require that you do a chmod on all shell scripts first?
On Debian I usually just use sudo sh ./ and it runs the script w/o changing anything on the file permissions so I figured Android would be similar if I just ran them as root. Still I see a lot of people requiring a chmod 777 on any guide referring to running shell scripts.
I will try that and report back with my findings. Thanks for replying.
Does Android require that you do a chmod on all shell scripts first? I just have to type m oon anywhere in the androud shell and my scripts run, for that i put it on /system/bin and do a chmod 4755 to the file. it is still needed to type su before you run the script.
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
mkdir /system/sd
cp /sdcard/media/Data/mountd.conf /system/etc/mountd.conf
cp /sdcard/media/Data/init.rc /system/init.rc
Thats my code for copying the modified files to the right place. So maybe you should try that.
Oh for androoid you dont unless you put it on /system/bin then you will have to use sude and sometiems it still wont run due to lack or permisions so is better to do a chmod 4755
Well I made the changes suggested and did a chmod on all the files prior to running but with no luck.
The odd thing is if I use the shell scripts as a guide list it works perfectly but if I try to launch them as a shell script all sorts of strange undesirable things happen to my phone.
The time consumed trying to use the scripts and recover from what happens from what they do out weight the effects of typing everything in.
joshtheitguy said:
Well I made the changes suggested and did a chmod on all the files prior to running but with no luck.
The odd thing is if I use the shell scripts as a guide list it works perfectly but if I try to launch them as a shell script all sorts of strange undesirable things happen to my phone.
The time consumed trying to use the scripts and recover from what happens from what they do out weight the effects of typing everything in.
Click to expand...
Click to collapse
you can only run the script once .. when the "ln -s" has already been done it has to be undone before trying to run the script again .. otherwise you would be copying the files onto themselves .. not sure if you've tried running it more than once
LucidREM said:
you can only run the script once .. when the "ln -s" has already been done it has to be undone before trying to run the script again .. otherwise you would be copying the files onto themselves .. not sure if you've tried running it more than once
Click to expand...
Click to collapse
These scripts were intended for my usage after a system restore from a update.zip file which wipes /system in the process.
My intentions were to:
1. remount the fs rw
2. copy the original init and mountd files to the sd then copy the modified to their respective places in the system folders then reboot
3. reboot then create the sym links appropriately then move my caches too
Well unfortunately the only thing that works is the backing up of the original init and mountd files.
joshtheitguy said:
These scripts were intended for my usage after a system restore from a update.zip file which wipes /system in the process.
My intentions were to:
1. remount the fs rw
2. copy the original init and mountd files to the sd then copy the modified to their respective places in the system folders then reboot
3. reboot then create the sym links appropriately then move my caches too
Well unfortunately the only thing that works is the backing up of the original init and mountd files.
Click to expand...
Click to collapse
yes .. but you can't create the sym links when they already exist .. running the update.zip only wipes the /system .. not /data .. if the links were there before the update.zip they will be there after

[Q] Problem pushing files to phone

I tried copying files to the system folder but I keep getting "failed to copy, out of memory". Any idea why? I also tried using Root Explorer but despite the pasting animation being displayed, the files were not copied.
I've tried both the terminal emulator
Code:
$ su
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
# cp /sdcard/libt9.so /system/lib
and adb
Code:
adb remount
adb push lib/libt9.so /system/lib/libt9.so
It seems the file has been moved successfully through recovery mode, but I still can't see the file when the phone is booted.

how do i move a file to /system/bin ?

i rooted my verizon galaxy tab and i can run Root apps, but i cant move a wpa_supplicant file to my /system/root using Astro.
Is this a root issue or do i need something better than Astro? I also tried OI file manager but it just says "cannot move file here".
By default, /system is (usually) mounted read-only. You probably need to remount it read-write.
Code:
adb remount /system
adb push [path-to-file] /system/bin
If remount doesn't work, try
Code:
adb shell mount -t yaffs2 -o rw,remount /dev/block/mtdblock3 /system

Mac Terminal system remount syntax

I have an Atrix on AT&T. Which means there's a bootloader encryption, and the carrier prevents non-market apk installations, which I have resolved since my phone is rooted and I have changed the boot animation already.
In order to do these things, I found Ghost Commander that would let me chmod my system directories...which is fine, but I feel kind of gimped that I can't do it on terminal.
Basically, what I want to be able to do is remount /system as rw using terminal.
This method doesn't work on both terminal and emulator on my phone. I have done:
Terminal:
Code:
sudo su
cd [sdk directory]
./adb devices
./adb shell
su
mount -o remount,rw -t ext3 /dev/block/mmcblk0p12 /system
and this is where I get stuck because I just get an Invalid argument error.
Here is some info about my sytem -
Usage: mount [-r] [-w] [-o options] [-t type] device directory
/dev/block/mmcblk0p12 /system ext3 ro,noatime,nodiratime, data=ordered 0 0
Been searching for the answers for a while now and tried all kinds of syntax, and now I'm here. What am I doing wrong? Thanks
Try:
mount -o remount,rw /system
The remount option automatically looks up the info for /system so you shouldn't have to bother with the details.
Hmm, I tried that thanks, and I still got 'Usage: mount [-r] [-w] [-o options] [-t type] device directory'
Hmm, I can't think of any reason that wouldn't work but it sounds like your phone is locked down pretty tight. Do you know if others have been able to remount /system?
What version of busybox do you have? Maybe you could try updating it. There are one or two free busybox updater apps on the market, if you can use them.
Have you tried just 'adb remount'?
Does the mount command require busybox? Do you have that properly installed?
That requires adbd itself to be run in root mode (this is different from being rooted on the phone) & you could do that only on insecure boot image. mount/unmount both happen to come from the busybox package. It would be hard to contemplate that Motorola actually changed that but nothing would stop them from. You could try updating the busybox utility onboard your phone. There is nothing with your usage of the command - it would work the same way on my Nexus S
I do have Busybox in /system/xbin. Thinking that maybe the xbin directory may need to have the rewrite permissions, I changed its permissions to 777 using the chmod command in phone Terminal. I did the remount command 'mount -o remount,rw -t ext3 /dev/block/mmcblk0p12 /system' in shell on the phone, and I THOUGHT I BRICKED! Haha, but it just turned off, and I rebooted to find that my button backlights were turned off...which I fixed with the brightness file.
Anyhow, I think I'll just use the chmod command because that seems to work. NeoA, I think you are right about the adbd to run in root mode, because I've seen discussions about that before.
Thanks for the feedback guys! At least I know I wasn't having syntax errors to say the least
So did it remount it as rw? The mount command was running before, just giving errors, but if it's running that should mean the permissions were ok.
try
Code:
busybox mount -o remount,rw /system
Fr4gg0r said:
try
busybox mount -o remount,rw /system
Click to expand...
Click to collapse
"mount: can't find /system/app in /proc/mounts"
but
Code:
busybox chmod 777 /system
is good enough for me, for now
marlasinger said:
Code:
busybox chmod 777 /system
is good enough for me, for now
Click to expand...
Click to collapse
Using chmod to change permissions won't actually give you rw access to the system partition since it won't change whether it's mounted as read-only or r/w. To be able to run the chmod command, the system must already have been mounted as r/w or you would have received a "Read-only file system" error. It must have gotten mounted as read/write when the remount command caused a reboot. You can see how /system is mounted by just typing "mount" in adb shell which will list all of the mounted partitions.

[Q] How to mount with bind/rbind under ICS

I want to make a script which will allow me to mount (mount bind) one folder to another folder.
I need this way to work with my navigation and to switch maps folder.
When I try with adb shell this commands - everything is fine:
Code:
mount -o rbind /mnt/sdcard/Sygic/Maps.NT /mnt/sdcard/Sygic/Maps
Next I made a script:
Code:
#!/system/bin/sh
#umount -l /sdcard/Sygic/Maps
mount -rw -o rbind /mnt/sdcard/Sygic/Maps.NT /mnt/sdcard/Sygic/Maps
am start -a com.sygic.aura -n com.sygic.aura/com.sygic.aura.SygicNaviActivity
exit 0
That point forward started problems - can't start this script, never mind if it's on SDCard or /system/app or where else (perm. rw-r-r-)
After that tried SManger - won't work neither like executable as root or script as root
Last try was to make brand new script within SManger, made it simplest like only one row:
Code:
mount -o rbind /mnt/sdcard/Sygic/Maps.NT /mnt/sdcard/Sygic/Maps
or
Code:
/sbin/mount -o rbind /sdcard/Sygic/Maps.NT /sdcard/Sygic/Maps
but w/o success
I need help, how to make this mount within script, will prefer SM Widget to start one or another mount.
Need advice, thanks to anyone !

Categories

Resources