[Q] How to create a symlink on every reboot? - Xoom Q&A, Help & Troubleshooting

Hi!
I'm using the Tiamat Custom ROM and am facing the problem, that the external SDcard is mounted on /mnt/external1 and symlinked to /MicroSD. But I'm using an app that needs it mounted on /sdcard-ext.
Now I have remounted / and symlinked /mnt/external1 to /sdcard-ext and that works until my next reboot (the symlink isn't reboot-proof ;-) ). Now I'm searching for a way to automatically create that symlink on each reboot.
Can anyone help me?
Thanks guys!
McDV

Create a script in /etc/init.d to do it.
You'll need to remount / to read+write first though.

PM me if you need help setting this up -- its really easy to do. You need to name your script with a specific run level (I believe).
I've done this on my phone to set up swap partitions and the like. Its really easy!!!

Thanks for your help! I'm quite firm in shell-operations, I just didn't think I could just put a script to /etc/init.d!
I'v created a shell-script named 07sdcard and with the content:
Code:
#!/system/bin/sh
rootrw
ln -s /mnt/external1 /sdcard-ext
rootro
Works geat!

You've got it now -- awesome.

HI,
Could this be a way to mount the external1 as rw at boot ?
See here: http://forum.xda-developers.com/showthread.php?t=1173195

Related

Read-Only Filesystem?

Hello, all!
I'm trying edit a file in /etc/ and adb says 'Failed to copy: Read-only filesystem'
Now, is this actually true? Or is this simply a permissions issue? I'm doing this on a non-rooted phone, so I can't 'touch' anything without permission errors, but is it a futile task if the filesystem is read only anyway?
I'm trying to do this from a non-rooted environment as I had intended on making this into an application, but I imagine that if I can't touch or push these files from an adb shell then I won't be able to from the application space either.
It's frustrating not to be able to edit the filesystem of my own phone, I'll be rooting if this is just a permissions problem and not an issue of a non-writable filesystem. Perhaps I could still make an application for rooted-only phones.. hrm..
Any thoughts on this?
/etc is an alias for /system/etc, and /system is a partition mounted as ro (you can confirm this yourself by running mount)
Ah, bugger. So this is hopeless (without modifying and then reflashing)?
Thanks very much.
you need to mount it read write,
mount -oremount,rw /dev/block/mtdblock3 /system
then it will be read/write
try adb remount. if it failes you need root sorry.
Hello, i have the same error and I have root. i have tried adb remount and the mount -oremount,rw /dev/block/mtdblock3 /system
still dotn work. I want to move a script to /
so i only have to type sh debian.sh
nvm I figured it out. i just put it on system and then just type sh debian.sh on the terminal and it works
Rafase282 said:
Hello, i have the same error and I have root. i have tried adb remount and the mount -oremount,rw /dev/block/mtdblock3 /system
still dotn work. I want to move a script to /
so i only have to type sh debian.sh
Click to expand...
Click to collapse
what is the error message? saying it dont work doesnt provide enough info for us to help....
it says sh: cant open aw.sh
so i still have to put the path or cd to where the file is. Is there a way to make /system my home?
no you cant make system your home, system is system, home is home. you can make a symlink if you are familiar with linux - might want to read up about shell commands
korndub said:
you need to mount it read write,
mount -oremount,rw /dev/block/mtdblock3 /system
then it will be read/write
Click to expand...
Click to collapse
Thanks it really worked!! for me i had the same problem as the other guy.
Rafase282 said:
Hello, i have the same error and I have root. i have tried adb remount and the mount -oremount,rw /dev/block/mtdblock3 /system
still dotn work. I want to move a script to /
so i only have to type sh debian.sh
nvm I figured it out. i just put it on system and then just type sh debian.sh on the terminal and it works
Click to expand...
Click to collapse
You *CAN'T* modify the / filesystem. It is part of your BOOT partition, which CANNOT be remounted rw. You would have to read, modify, and write the boot partition.
Rafase282 said:
Hello, i have the same error and I have root. i have tried adb remount and the mount -oremount,rw /dev/block/mtdblock3 /system
still dotn work. I want to move a script to /
so i only have to type sh debian.sh
nvm I figured it out. i just put it on system and then just type sh debian.sh on the terminal and it works
Click to expand...
Click to collapse
Maybe you're typing it in too literally. It should actually read like this:
mount -o remount,rw /dev/block/mtdblock3 /system
There was a typo with -oremount, there should be a space after -o.
Hope that helps.
PS. That command worked for me on a device where everything else failed.
dhkr123 said:
You *CAN'T* modify the / filesystem. It is part of your BOOT partition, which CANNOT be remounted rw. You would have to read, modify, and write the boot partition.
Click to expand...
Click to collapse
actually, / can be mounted rw, but changes are lost on reboot
new user
Firerat said:
actually, / can be mounted rw, but changes are lost on reboot
Click to expand...
Click to collapse
Hi I have my Asus Prime rooted and installed a virtuous Rom and I tried to put a fonts on the System/ fonts folder using root explorer using a instructions to fix some error on some games that need that tis fonts exist on the tablet but it said it cant because file system is read only I'm new and I don't know how to do this commands any help on how to do in a easy (explained) form.
egalpr said:
Hi I have my Asus Prime rooted and installed a virtuous Rom and I tried to put a fonts on the System/ fonts folder using root explorer using a instructions to fix some error on some games that need that tis fonts exist on the tablet but it said it cant because file system is read only I'm new and I don't know how to do this commands any help on how to do in a easy (explained) form.
Click to expand...
Click to collapse
I would recommended not posting in the g1 section. The Asus forums would be a lot more helpful.
egalpr said:
Hi I have my Asus Prime rooted and installed a virtuous Rom and I tried to put a fonts on the System/ fonts folder using root explorer using a instructions to fix some error on some games that need that tis fonts exist on the tablet but it said it cant because file system is read only I'm new and I don't know how to do this commands any help on how to do in a easy (explained) form.
Click to expand...
Click to collapse
Download EStrong File Manager and within the settings of it, enable mounting of the system as read/write.
Or, download Terminal Emulator and type this in:
Code:
mount -o remount,rw /dev/block/mtdblock3 /system
Or, try typing this in terminal/cmd:
Code:
adb remount
Or, if you plan on doing it all from recovery you could do:
Code:
adb shell "mount system"
and then you could do it all from there.
Next time, please post in the proper forum.
Read-Only /system... i just deleted the file, tich push should update/replace and then it worked... only had this bug when i was trying to modify Trebuchet.apk (homescreen)
Hi guys
Not being a linux expert, i'm stuck with the following problem..
i'm using a program who uses low level adb commands to write on the phone extSdCard...
problem: this extSdcard is seen as a readonly filesystem.
What has to be done to make this FS RW instaed of RO ?
This does not happen under windows where I can write to the extSd without problems
thks in advance for the tip

Android init.rc Language

Hi XDA,
I havent found much on this topic on the forum. I wonder if anyone can elaborate or link me in the right direction regarding this issue.
Im working with Amon_Ra's latest 1.6.2 ROM. I unzipped it, took the boot.img, unpacked it, add a line in /etc/fstab and init.rc, repacked it, zipped the ROM, signed it, flashed it. But my changes dont seem to do the trick.
the following was added to init.rc
Code:
mount ext2 /dev/block/mmcblk0p2 /system/sd rw noatime nodiratime
and this was added to /etc/fstab
Code:
/dev/block/mmcblk0p2 /system/sd ext2 rw
Yes /system/sd exists, and Yes my microSD is partitioned correctly. I presume my line might be in wrong syntax? Or? Wiped before I flashed, didnt help.
If I've missed a thread on init.rc syntax I pardon that
Any help is appreciated!
altso tried,
Code:
mount ext2 [email protected] /system/sd
any suggestions at all?
bump, bump!
im running a motorola cliq, but i do know that the init.rc has the ability to start services.
You may want to try adding your lines into a script (shell script), and put that script into /system/bin
THEN add a command to open console and start that particular script, in init.rc
works for me with apps2sd for cliq.

Fix fix_permissions

Apparentely fix_permissions doesn't work in stock roms (or at least in XKPU + XDA_bam kernel v11).
In order to fix permissions, /sbin/fix_permissions reads /data/system/packages.xml. However that file is not there, but in /dbdata/system/.
I temporarily solved the problem creating a symbolinc link to the file, but in this way "fix_permissions" will not work from CWM (it doesn't mount /dbdata).
The only way to successfully run "fix_permissions" is to run it from from adb or terminal emulator, when /dbdata is already mounted.
(I suggest you not to simply copy the file from /data to /dbata. The one in /dbdata is continuously updated)
The only way to completely solve the problem is to edit /sbin/fix_permissions, but apparently the file is regenerated after every reboot and I don't know how to permanently change it (I think we need to change boot.img, that's why I specified rom and kernel), but I really don't care that much since the command works from adb/terminal emulator.
Anyway, here the commands to create the symbolic link. You need to run them only once from adb/terminal emulator:
Code:
su
mount -o remount rw /system
ln -s /dbdata/system/packages.xml /data/system/packages.xml
mount -o remount ro /system
After that, whenever you need to fix permissions, you simply need to run this from adb/terminal emulator:
Code:
su
fix_permissions
Before you create the symbolic link, you can check if the problem exists in your rom/kernel by running "fix_permissions". The error is:
Code:
cat: can't open '/data/system/packages.xml': No such file or directory
Thanks! Gonna fix that in the next release
loSconosciuto said:
Apparentely fix_permissions doesn't work in stock roms (or at least in XKPU + XDA_bam kernel v11).
In order to fix permissions, /sbin/fix_permissions reads /data/system/packages.xml. However that file is not there, but in /dbdata/system/.
I temporarily solved the problem creating a symbolinc link to the file, but in this way "fix_permissions" will not work from CWM (it doesn't mount /dbdata).
The only way to successfully run "fix_permissions" is to run it from from adb or terminal emulator, when /dbdata is already mounted.
(I suggest you not to simply copy the file from /data to /dbata. The one in /dbdata is continuously updated)
The only way to completely solve the problem is to edit /sbin/fix_permissions, but apparently the file is regenerated after every reboot and I don't know how to permanently change it (I think we need to change boot.img, that's why I specified rom and kernel), but I really don't care that much since the command works from adb/terminal emulator.
Anyway, here the commands to create the symbolic link. You need to run them only once from adb/terminal emulator:
Code:
su
mount -o remount rw /system
ln -s /dbdata/system/packages.xml /data/system/packages.xml
mount -o remount ro /system
After that, whenever you need to fix permissions, you simply need to run this from adb/terminal emulator:
Code:
su
fix_permissions
Before you create the symbolic link, you can check if the problem exists in your rom/kernel by running "fix_permissions". The error is:
Code:
cat: can't open '/data/system/packages.xml': No such file or directory
Click to expand...
Click to collapse
This should have been included in the specific ROM's thread not creating another thread. Closing this since XDA_Bam has stated the fix will be implemented.

[Q] Mount external sd without -noexec flag

Hey Guys,
I'm interested in lots of stuff, regarding my phone and so i began writing a skript, which moves files from sdcard0 to sdcard1.
This Skript calls another skript and this Skript calls another one.
Well long story short, of course it doesnt work, because i cant change the permissions of the skript-files to rwx.
How can i change the mount type of my sdcard to -exec, so that i can execute stuff from my sdcard...
Thanks for your help in advance, greetz Esok
AFAIK only linux filesystems "accept" linux permissions,
means format your sd card with ext3 or ext4, than you can change file permissions, but I do not know whether your moto remembers the card
hmmm gotta try this one day.
have read in some forum, that there is some kind of an -noexec flag, which is always set unter android.
Well nevermind, the question i asked is stupid, because it doesnt 100% relate to my problem, as i see right now....
So here is what is wrong:
The scripts are lying on the INTERNAL-sd
The internal Sd doesnt have -noexec flag. This is the external, as i found out using .
Code:
mount | grep sdcard0
mount | grep sdcard1
but within the output of
Code:
mount | grep sdcard0
i found the line:
default_permission,allow_other 0 0
Click to expand...
Click to collapse
, i think this is why i cant change the permissions, isnt it?
I also found, that the filesystem on the internal seems to be "fuse". Anyone knows what this means?
so new question: how to solve this problem? oO
is remounting an option or is there any other way?
As it seems, the sdcard1 doesnt have this "default_permission" line, but it has the -noexec flag set...
Maybe i can do something via external sdcard...
i'll give it a try
esok44 said:
hmmm gotta try this one day.
have read in some forum, that there is some kind of an -noexec flag, which is always set unter android.
Well nevermind, the question i asked is stupid, because it doesnt 100% relate to my problem, as i see right now....
So here is what is wrong:
The scripts are lying on the INTERNAL-sd
The internal Sd doesnt have -noexec flag. This is the external, as i found out using .
Code:
mount | grep sdcard0
mount | grep sdcard1
but within the output of
Code:
mount | grep sdcard0
i found the line: , i think this is why i cant change the permissions, isnt it?
I also found, that the filesystem on the internal seems to be "fuse". Anyone knows what this means?
so new question: how to solve this problem? oO
is remounting an option or is there any other way?
As it seems, the sdcard1 doesnt have this "default_permission" line, but it has the -noexec flag set...
Maybe i can do something via external sdcard...
i'll give it a try
Click to expand...
Click to collapse
Although its been a long time since I had to dive into it, I'm really leaning toward FAT filesytems always being mounted noexec in Linux. Either way though, you can still point the interpreter at the script and it will run; for example if you script is at /storage/sdcard0/script.sh you can run it by doing /system/bin/sh /storage/sdcard0/script.sh or possibly even just sh /storage/sdcard0/script.sh and the same would apply to the external sdcard.
I use an app called smanager to run scripts via shortcuts and theres a plugin for widgets if you use a launcer that doesn't like to do shortcuts. It has selections to run things as root as well but I end up just calling root explicitly, running the script as a normal user and I do the same thing you're talking about where a scripts calls another script.
So for example I have Maps and Facebook frozen and I have a script for both of them but only part of it needs root access. So my Maps script, for example, unfreezes maps using root, starts it using the same user as smanager, then it calls another script that checks every couple of seconds if maps is still open. When I've closed it, the second script ends and the rest of the first script executes which kills maps and freezes it again.
So it looks roughly like this from memory:
Code:
/system/bin/sh /system/xbin/su -c "pm enable com.google.maps"
am start com.google.maps/com.whatever.starts.maps.up
/system/bin/sh /system/xbin/su -c "/script/that/stays/open/till/maps/closes/which/makes/this/script/pause/.sh"
/system/bin/sh /system/xbin/su -c "whatever.I.used.to.kill.all.instances.of.maps"
/system/bin/sh /system/xbin/su -c "pm disable com.google.maps.or.something.like.that"
Note that in the above, if I call the script with /system/bin/sh /location/of/script or even possibly sh /location/of/script , that I probably don't need all the paths that follow; most notably the /system/bin/sh since its already established when we call the script in the first place. It could look more like this (I just happened to write it along the lines of the above when I went about making my scripts):
Code:
/system/xbin/su -c "pm enable com.google.maps"
am start com.google.maps/com.whatever.starts.maps.up
/system/xbin/su -c "/script/that/stays/open/till/maps/closes/which/makes/this/script/pause/.sh"
/system/xbin/su -c "whatever.I.used.to.kill.all.instances.of.maps"
/system/xbin/su -c "pm disable com.google.maps.or.something.like.that"
note that the am start didn't need to be called by its path, for example.
I think, but can't remember, that I needed to call su by abosolute path, though. Also, I used a shebang #!/system/bin/sh at the begining of my scripts but don't know if thats necissary or not if you're going to call it by the interpreter in the first place.
If this was a some other script, like python, then it stands to reason that you can put the shebang as the first line as the path to your python and still call it from the shell and it would work; so if your script was:
Code:
#!/path/to/a/python/interpreter
import something
while this:
do this
print "I'm awesome"
and the script was called pythonscript.py then /system/bin/sh /path/to/pythonscript.py and possibly sh /path/to/pythonscript.py would most likely work and is worth a try.
Try it out and see how you go.
One last thing; if you call root explicity in a script every time you need it then you'lle get a popup for permissions every time it asks for root in the script the first time you run it, but if you use an app to launch that script then once the app has root permissions you won't get hassled at every instance. You'lle want to turn toasts off for the app though, or you'lle see one every time root is called in a script.
Hi again.
I just got execute permissions on my external sdcard. It didn't work on the internal one.
It looked like this after playing with a lot of various things
mount -o remount,rw,noatime,exec /storage/sdcard1
though most likely rw and noatime were not needed, probably just needed
mount -o remount,exec /storage/sdcard1
but would have to restart the phone to be sure.
This was using adb. some apps, for example my titanium backup, have problems in JB writing to the external card and I had it remounting properly to work around this at one point, but left the computer and came back, closed out windows, then forgot what I had done without saving any work and wasn't able to figure it out again. It was an fmask, dmask, or umask.
In any case, assuming you want to run scripts on your internal card (which is mounted using fuse by the way, instead of just vfat, which may be intentional to keep permissions from being messed around with), you can also write one to the external card and then after remounting it (you can create a command in tasker for this that runs on boot) just use it as a helper script, so it would look like this:
Code:
#!/system/bin/sh
/system/bin/sh [email protected]
or you might need to use quotes around [email protected] ... "[email protected]" ... its been a long time and I forget how I did this
So [email protected] is just the arguments you give to a script and if your script is called helper.sh and you say ./helper.sh /sdcard/myscript.sh then it should run the script.
[email protected] is like saying $1 $2 $3... and so on; getting the arguments except getting all of them in one string.
Also, one last thing; with my last phone, Samsung SGS2, I made a tiny fat partition on my external sd and then made the rest ext4. The tiny fat partition got mounted at boot and an extra device file was created along with the files created for sdcard0 and sdcard1, and that enabled me to mount the ext4 partition how I wanted to. It wasn't usable for much because it didn't play well with apps such as media players and ... well alll of them, but if you make a small ext4 partition after the larger fat partition then it may do the same as my Samsung did and provide you with a device file to mount and to put your scripts on. I think its easier to just mount the external drive with the execute option and use a helper script, or use smanager as described in my above post, or use tasker to create an app for your scripts but thats going to make a simple command into a really big app.

FIX: extsd2internalsd broken after Verizon 4.1.2 OTA

Loong time lurker, first time poster. I couldn't post a reply in the development forum, obviously. Maybe someone can link to this in relevant threads over in development.
This is a guide for those who are/were using the extsd2internal to swap storage which no longer works after the 4.1.2 OTA or want to do take advantage of this mod: http://forum.xda-developers.com/showthread.php?t=1849860 OR it MIGHT work for other ROMs which want to use this method for the Galaxy S3.
After the OTA, and getting back up and running, I could not get the script to work correctly with this error: "no such file or directory" and doing some sleuthing, it seems Verizon (in their infinite wisdom) changed the mounts, or maybe it did this because gremlins/gnomes, maybe because Vzw/Samsung knows about the swapping method, who knows. Anyways, here is the fix that worked for me:
PreReqs:
Stock ROM 4.1.2 OTA
Rooted (duh)
BusyBox
SManager ads
Terminal Emulator
Root Explorer in R/W mode
extsd2internalsd mod installed/script in the correct place!
BACKUPS!! Make a nandroid backup before you do ANY tinkering people, and copy it to a safe place like your computer.
Let me be clear, for the love of bits and bytes, do not just keep one copy on the sdcard in the phone!!
1) To find the /dev/block/vold for the external sd card, open Terminal Emulator and run this command. Grant it root access when prompted:
Code:
su ls /dev/block/vold
Write down or make a note of the numbers. (For me there were only 2, 179:32 and 179:33) Now run these commands:
Code:
adb shell
cat /proc/mounts
There will be a whole lot of text that shows up, you are looking for "/dev/block/vold/179:xx" and in the same line there is "/storage/extSDCard"
Alternate method, after you are in shell run command and look for mmcblk1p1:
Code:
cat /proc/partitions
The number in the "minor" column, that's the new number!
Double-check that the blocks are right for the sd card's partition size.
Note: I tried using mmcblk1 and it didn't work, then tried mmcblk1p1 and VIOLA! Yay, trial and error.
2) In SManager, edit the extsd2internal script, and replace the 179:97 to 179:*new number* (again, for me it was 179:33)
3) Reboot or just "run" the script in SManger and wait a few moments, then check Settings>Storage.
Here is what my script looks like:
Code:
#!/system/bin/sh
#extsd2internalsd is a modification that allows to switch internal sd to external sd and viceversa. With this you can use default internal sd only for app storage #and the external sd to store all apps resource and all others stuff. The resut is a very big increase of installable apps on gs3
#All credits to Mattiadj of xda forum for the idea and script and to mike1986 for the cmw zip.
#xda thread url at http://forum.xda-developers.com/showthread.php?t=1772234
#Script Modified for U.S. Galaxy S3s by Zedomax at GalaxyS3Root.com to be compatible when sdcard is not inserted.
busybox mount -o remount,rw /
busybox mount -t vfat -o umask=0000 /dev/block/vold/179:33 /mnt/sdcard
busybox mount -t exfat -o umask=0000 /dev/block/vold/179:33 /mnt/sdcard
if busybox mount | busybox grep vold/179:33; then
busybox mount -o bind /data/media /mnt/extSdCard
fi
If this didn't work for you, I am a complete n00b, so I will do my best, but don't expect much.
Things to double check:
Permissions on the extsd2interal script in Root Explorer should have all the boxes checked EXCEPT the last 3 at the bottom.
SManager script should be set to "Su" and "Boot"
OTA Headaches? Use this guide to keep root and boot unlocked worked PERFECTLY: http://forum.xda-developers.com/showthread.php?t=2186574#8 I did a nandroid restore to pre-OTA since it borked the first go-around, and then used this method.
Take home message: MAKE BACKUPS!
Credits / Current Build of this mod:
http://forum.xda-developers.com/showthread.php?t=1772234
This mod does work, and just replacing the old with the new (still have to add it in SManager) will get the job done. The new script is significantly different, and I am sure there are reasons, but without a changelog...
Forum Community: Created the thread here because I couldn't find another thread specific to this environment with all the relevant information in one place. If anyone has seen any errors of my ways, please, please reply with what's up.

Categories

Resources