HumberOS CM9 ROM SD Card Permissions Fix - Galaxy Tab General

For anyone using HumberOS's excellent CM9 build...
Although the sd card mount locations have been fixed in the latest build (CM9-SGT7-TE4M-20120127) I've noticed some applications still have issues with the sd card. One example being the Kindle app not being able to download books locally and just reporting the download status as interrupted. I think I've tracked this down to a permissions issue. The /mnt/emmc mount should have the same permissions as the /mnt/sdcard mount but currently doesn't in this build (and previous builds). I fixed this issue by running the following from a terminal:
Code:
su
chgrp sdcard_rw /mnt/emmc
chmod 075 /mnt/emmc
I'm not sure where this is set in the code to make this permanent but hopefully this helps.
I actually just joined XDA as I wanted to contribute this into the DEV thread but don't have the post count so hopefully others find this useful and if so could pass it on for me?
Thanks!
p.s. Huge thanks to The TE4M for bringing ICS to the SGT and thanks to XDA for a wealth of knowledge and help!

Related

Using B&N Storage normally

One of the biggest issues I had with my nook was the 16/1GB division between content I can load and content from B&N/etc. Not being able to use that 16GB how I wanted was something I set forth to fix. Here is my solution to make this usable to non-rooted apps.
1) Root if not already rooted.
2) Make a directory inside of /data. I chose /data/usrdata.
3) remount / as RW with the command mount -o remount,rw -t rootfs rootfs / (credit to whomever wrote the nook&zergy.bat 1 click root. Sorry, it's been a long night, just let me know who and I'll edit)
4) mkdir /mnt/internal . We need somewhere to mount /data/usrdata/ and /mnt is public enough.
5) busybox mount -o bind /data/usrdata /mnt/internal. Mounts /data/usrdata to /mnt/internal.
6) For good measure, chmod 777 /mnt/internal and chmod 777 /data/usrdata.
Now, /mnt/internal should have whatever free space /data has, and should be read/write accessible from any program. A quick test with touch+terminal emulator shows new files as being created with RW permissions for all.
Alternatives: When I was initially thinking about ways to do this, my first reaction was to just open up /data to be read only to all, then have my usrdata folder be read/write all. However, I know part of android's app security model depends on some of these permissions. While I can't think of anything breaking or sensitive data being leaked, I decided against it. If anyone has any thoughts as to that scenario, I am very interested in hearing about it.
USB support: This will *not* be mountable under USB. Unfortunately you are still limited to transfering the data from a computer to the B&N internal storage or SDcard first, then moving the data internally. The problem that I see with this is similar to my understanding of the galaxy nexus situation, where the system can't unmount its /data partition and let the USB host take over. Another alternative to this could be to write an image file and mount that over usb (I've done this on my Evo, it worked so-so). Problem with that is that it really wouldn't grow/shrink with the storage. I suppose you could do some shell trickery and pipe it through gzip somehow, but that wouldn't help very much.
Let me know what you think and if you have any ways to improve this.
UPDATE: Persistance:
To make this persistant across reboots, run these commands as root:
1) mount -o rw,remount -t ext4 /dev/block/platform/mmci-omap-hs.1/by-name/system /system
2) echo mount -o remount,rw -t rootfs rootfs / >> /system/bin/clrbootcount.sh
3) echo mkdir /mnt/internal >> /system/bin/clrbootcount.sh
4) echo busybox mount -o bind /data/usrdata /mnt/internal >> /system/bin/clrbootcount.sh
5) echo mount -o remount,ro -t rootfs rootfs / >> /system/bin/clrbootcount.sh
All this does is put the following at the end of clrbootcount.sh
mount -o remount,rw -t rootfs rootfs / #Remounts root as RW. Root is regenerated at each reboot, so /mnt/internal is never going exist on a fresh startup
mkdir /mnt/internal #make /mnt/internal, see above
busybox mount -o bind /data/usrdata /mnt/internal #Binds the directory
mount -o remount,ro -t rootfs rootfs / #remounts root as RO. Unsure if this is necessary, but since it runs as RO, its probably better safe than sorry.
Thanks to eded333 for mentioning a good place for the script.
Edit: Doh, can a mod please move this to the nook tablet general forum? I must have failed reading...
This file autostarts each time you boot:
/system/bin/clrbootcount.sh
Add what you want at the end, and it will autoexecute it.
Wouldn't it be easier to just make a symbolic link to any partition you want to use?
Edit:
XD, didn't read you'r edit, , anyway maybe this works also for you.
Out of curiosity, what would symlinking to /sdcard do exactly? I don't think I'm quite following what you're saying. If I'm linking a directory to /sdcard, that would just go to the microsd card slot, which isn't what I was intending to do. The Nook tablet (I accidently posted this in the wrong forum, that much helps too) has 16GB of storage that is internal on /data, and can't be used through normal means. My goal was to be able to use this 16GB of data outside of rooted apps. Maybe I'm not understanding completely as I am a bit sleep deprived at the moment.
Thanks for the recommendation for the startup script though! I will definitely give that a shot and see if that makes this persist across reboots.
Yeah, I though you were talking about the NST which only has 2gb of internal memory and 200 mb left to use if you dont repartition, dont really know how the partitioning is on the nook color but just symlinking (hardlinks) the folder you want on a partition to another folder on another partition which has more space would resolve the issue.
Edit:
If i'm not getting it wrong and you want more space than the nook gives you, to store content. This should work, hope I'm not wrong
Yeah sorry about that. I thought I was in the nook tablet section and when I went back because I got new email, it looked very different. Imagine what posting in the wrong forum can do...
By default the nook tablet has 16GB of NAND, with 14 or 15GB set as /data and 1GB as /media thats accessible over usb. I've read a lot of people disliking the idea of wasting all that space, myself included, so that's what spurred it. Initially I was going to have the remount command ignore FS permissions since it was public anyway, but I couldn't do that with bind.
gameman733 said:
Yeah sorry about that. I thought I was in the nook tablet section and when I went back because I got new email, it looked very different. Imagine what posting in the wrong forum can do...
By default the nook tablet has 16GB of NAND, with 14 or 15GB set as /data and 1GB as /media thats accessible over usb. I've read a lot of people disliking the idea of wasting all that space, myself included, so that's what spurred it. Initially I was going to have the remount command ignore FS permissions since it was public anyway, but I couldn't do that with bind.
Click to expand...
Click to collapse
Don't know if this sounds dumb, but you can try to mount as rw the partition you want to use, then use ln -s + the folders on the partitions you want to link and see if it works, add the commands at the end of the file I showed you and look if it works correctly. Make sure the folders you use have sufficient permissions and that the partition is mounted as rw.
Edit:
You could allways resize the partitions without any inherent problem, make a backup before trying this.
I found it
need help with /mnt/internal please
I have been troubleshooting this for several hours. I have rooted my NT with latest indirects n&Z .bat. Everything is fine with that. I followed the instructions from kenblat for mounting the reserved data space that is now accessible to me through Root Explorer and making it persist through reboot with the new clrbootcount.sh. Here is where things are falling apart for me....a directory called /internal is appearing as it should in /data/mnt, and I created an "audio" directory there, and I have been able to copy a few songs into it.....but, at some point, the whole system freezes, never finishes the "paste" part, and I have to force reboot in order to get anything running again. When reboot, any and all of the material that I did manage to copy/paste into the /mnt/internal directory is GONE. I have tried changing permissions, but so far I have gone through this at least 9 times (I am a very persistent person when it comes to this stuff) and always the system stops functioning in the middle of pasting. My /internal folder is set to RWall, /data is rwxrwx--x, usrdata is rwall. clbootcount.sh is set to ---rwxr-x. I can't imagine that it really is a permmissions problem because of the fact that i am able to copy SOME files, a few at a time, without a problem. Can anyone possibly help me? Thanks.
IT WAS NOT A PERMISSIONS ISSUE. DISCOVERED BUSYBOX WAS NOT INSTALLED. (DON'T KNOW HOW IT GOT UNINSTALLED) I OPENED NINJAMORPH AND IT DID ITS CHECKS AND THERE IT WAS, NO BUSYBOX INSTALLED. SO I REINSTALLED IT, NOW MOUNTS INTERNAL AND PERSISTS UPON REBOOT. NO WONDER I HAD PROBLEMS.
Need help.
I have been trying to everything step by step as it says here but it is not workign for me. I just recently rooted my nook tablet. I was wondering, maybe a video tutorial would more.

Updating SD install of CM7

In the discussion of the CM7.2-RC0 KANG builds in the development forum,
http://forum.xda-developers.com/showthread.php?t=1344873
someone has been having trouble installing the update to their SD install. I don't yet have enough posts to reply to that thread, so I'm posting this link here:
http://taosaur.blogspot.com/2011/10/updating-cm7-sd-install-for-nook-color.html
The usual procedure is to remove the SD card and use a computer to put the update .zip in the /boot partition, since the /boot partition isn't normally mounted while the NC is running. But it can be mounted from adb shell, for instance with
adb shell
# mkdir dev/boot
# busybox mount /dev/block/mmcblk1p1 dev/boot
and then you can adb push the update into /dev/boot.
jicama said:
In the discussion of the CM7.2-RC0 KANG builds in the development forum,
http://forum.xda-developers.com/showthread.php?t=1344873
someone has been having trouble installing the update to their SD install. I don't yet have enough posts to reply to that thread, so I'm posting this link here:
http://taosaur.blogspot.com/2011/10/updating-cm7-sd-install-for-nook-color.html
The usual procedure is to remove the SD card and use a computer to put the update .zip in the /boot partition, since the /boot partition isn't normally mounted while the NC is running. But it can be mounted from adb shell, for instance with
adb shell
# mkdir dev/boot
# busybox mount /dev/block/mmcblk1p1 dev/boot
and then you can adb push the update into /dev/boot.
Click to expand...
Click to collapse
Thanks for the link... that information was first posted by me in the SASD thread

Jelly Bean + Recompiled kernel - Internal memory symlink missing

Hi all,
I'm using Jelly Bean ROM on my i9100 with custom kernel.
Problem is that many apps are looking for internal memory using the path "/mnt/sdcard" (like address book export function, whatsapp for downloaded images, etc.), that should be a symbolic link to folder "/storage/sdcard0", new mount point of internal memory in JB.
I've tried SiyahKernel v4.0.1 and 4.1beta6, Dream-IRC 2.7.0 (I cannot try Dorimanx 5.65.1 cause it generates a boot loop with RootBox ROM) and all of them suffer same problem.
I've found that some init scripts (for example "fota.rc" or "init.goldfish.rc") are creating the folder "/mnt/sdcard" earlier than right init script could create symbolic link: those scripts cannot be changed cause they are part of initramfs, so kernel recompilation is needed.
I hope this thread could help kernel experts to solve problem.
Bye.
JediMaster said:
Hi all,
I'm using Jelly Bean ROM on my i9100 with custom kernel.
Problem is that many apps are looking for internal memory using the path "/mnt/sdcard" (like address book export function, whatsapp for downloaded images, etc.), that should be a symbolic link to folder "/storage/sdcard0", new mount point of internal memory in JB.
I've tried SiyahKernel v4.0.1 and 4.1beta6, Dream-IRC 2.7.0 (I cannot try Dorimanx 5.65.1 cause it generates a boot loop with RootBox ROM) and all of them suffer same problem.
I've found that some init scripts (for example "fota.rc" or "init.goldfish.rc") are creating the folder "/mnt/sdcard" earlier than right init script could create symbolic link: those scripts cannot be changed cause they are part of initramfs, so kernel recompilation is needed.
I hope this thread could help kernel experts to solve problem.
Bye.
Click to expand...
Click to collapse
._. I think this should be in the general forums?
Sent from my GT-I9100 using xda premium
MarioFan1998 said:
._. I think this should be in the general forums?
Sent from my GT-I9100 using xda premium
Click to expand...
Click to collapse
Hi MarioFan1998,
I've posted here cause problem is related to custom kernel recompilation, so I've thought that "Android development" was the right section: if it is not, I'll move thread to general forum, let me know.
Thank you.
Bye.
New kernels also affected...
I can confirm that also Dorimanx 5.65.1 kernel suffers same problem.
Now I've installed new Resurrection Remix 3.0.4 + Dorimanx 5.65.1 kernel and "/mnt/sdcard" is always an empty folder and not a symlink to "/storage/sdcard0" as it should be.
We need kernel Experts help!
Okay in the mean time try this I have used RemountSD app but edited the
directories likes so:
Original external SD location: /storage/sdcard0
Target external SD location: /mnt/sdcard
Now go to /mnt/sdcard you should now see your internal sdcard.
Note: the external SD location I actually put the directories of the internal SD card instead
so the internal SD will be mounted instead of external.
Press thanks if it works! Use this as a temporary solution!
EDIT: Noticed that after reboot it stops working. Recommend you remount on every boot for now.
MarioFan1998 said:
Okay in the mean time try this I have used RemountSD app but edited the
directories likes so:
Original external SD location: /storage/sdcard0
Target external SD location: /mnt/sdcard
Now go to /mnt/sdcard you should now see your internal sdcard.
Note: the external SD location I actually put the directories of the internal SD card instead
so the internal SD will be mounted instead of external.
Press thanks if it works! Use this as a temporary solution!
EDIT: Noticed that after reboot it stops working. Recommend you remount on every boot for now.
Click to expand...
Click to collapse
Thank you,
I've realized a different solution, an init.d script that, if folder /mnt/sdcard is empty, removes it at boot time and creates appropriate symlink.
I attach file to this post, it must be copied (extracted script, not tar.gz archive) to /etc/init.d, then "chown root.shell 00fixmount", then "chmod 0755 00fixmount".
It works for me in RR3.0.4 + Dorimanx Kernel 5.65.1, use it at your own risk: obviously it's a temporary workaround, until kernel developers will fix it in boot image.
Bye.
You know what you guys could do? Learn to decompile a kernel and modify initramfs yourselves! It's fun to learn.
Lack of time...
karendar said:
You know what you guys could do? Learn to decompile a kernel and modify initramfs yourselves! It's fun to learn.
Click to expand...
Click to collapse
Long ago one of my hobbies was update/configuration/recompilation of kernel on my customized Slackware distro to find best performances, today I'm using a notebook with Windoze 7...
Main problem is lack of time...
JediMaster said:
Thank you,
I've realized a different solution, an init.d script that, if folder /mnt/sdcard is empty, removes it at boot time and creates appropriate symlink.
I attach file to this post, it must be copied (extracted script, not tar.gz archive) to /etc/init.d, then "chown root.shell 00fixmount", then "chmod 0755 00fixmount".
It works for me in RR3.0.4 + Dorimanx Kernel 5.65.1, use it at your own risk: obviously it's a temporary workaround, until kernel developers will fix it in boot image.
Bye.
Click to expand...
Click to collapse
what about the external sd card.. any picture or music on it is not recognised by apps.. the builtin ones..even cwm manager.. i have to resort to quick pic and power amp
xinfinityoO said:
what about the external sd card.. any picture or music on it is not recognised by apps.. the builtin ones..even cwm manager.. i have to resort to quick pic and power amp
Click to expand...
Click to collapse
I don't use external SD card, but I see that symlink "/mnt/extSdCard" is correctly pointed to "/storage/sdcard1": which path are apps expecting to use?
Let me know.
Bye.
Whatever I try, it doesnt work. I need external_sd path for my Navigon Select and camera doesnt see sdcard.
brack11 said:
Whatever I try, it doesnt work. I need external_sd path for my Navigon Select and camera doesnt see sdcard.
Click to expand...
Click to collapse
If you want, I can try to make an init.d script to unmount internal and external sdcard devices and remount them in Gingerbread locations, but I will not be able to try, cause I don't use external sdcard...
Let me know if you wanna test.
Bye.
JediMaster said:
If you want, I can try to make an init.d script to unmount internal and external sdcard devices and remount them in Gingerbread locations, but I will not be able to try, cause I don't use external sdcard...
Let me know if you wanna test.
Bye.
Click to expand...
Click to collapse
I took the Init script from this thread and then installed ics binder from the market, configured binding from /mnt/extSdCard to /mnt/sdcard/external_sd and it did the trick, however, titanium wouldn't restore anything on sd, only on "system default"
Another thing is i don't see how jb more smooth than ics, feels the same to me and as i lose some settings for jb that i had on ics, I'm back to ics for now.
Sent from my GT-I9100 using Tapatalk 2

howto: mount external sdcard as sdcard0

So, the Note 8.0 is a nice, fast, expensive device that had a big shortcoming for me: as shipped, the SD card is not useful as a place where application data easily lands - it's only intended for storing music and video files, or those chunks of data you manually target to it.
I fixed it, after a fashion, by mounting the card at boot time as sdcard0, which Samsung normally assigns to the (very limited) internal storage. The internal /data/media pool is treated as the external sdcard and very little installation data defaults to it. Apps2SD is still broken, but quite a lot of things simply default to using /sdcard0 as their preferred storage, which I find helpful.
You have to mount it at start time (init.d), and you have to mount it correctly (bind)
I figured out and set my device up this way by setting init.d scripts I learned about from threads by Ryuinferno (init.d) and mattiadj (rebinding in the Note 2) for this. Translation: none of this is my work, I just sounded out how others had done it and am assembling it here, since I know it will help other Note 8 folks.
I think that the init.d script support is very interesting - there are a lot of ROM tweaks that rely on init.d. You do not need a custom kernel for init.d to work the note 8 - which is nice, since we have no custom kernel
The outcome of this mod is that with an sdcard inserted, I get:
/storage/sdcard0 29.7G 3.68G 26.0G 32768
and
/storage/extSdCard 9.87G 1.78G 8.09G 4096
If I remove the card at boot, I still have apps (installed at /data/data) and the media
pool reverts to normal:
/storage/sdcard0 9.78G 1.78G 7.99G 4096
I wrote none of the scripts I'm using and will be the first to admit that I may have set them up stupidly.
Doing this voids your warranty and gives you pimples and a moon tan. But it does mean your sd card expands your storage and I hope that if there are better ways to do any of this, folks will chime in.
tools needed:
- knowledge of ADB and working ADB
- helps if you know how Unix and windows terminate lines differently, and can get your copy of Notepad++ to help you with the script, if you're trying this from Windows
- a note 8 running the 4.1.2 software - this approach is only tested there
- Kies
- Possibly Odin as a replacement for Kies (untested)
- understanding of how to put your device into recovery mode and trigger the Samsung recovery
- the US stock firmware for your device, for use with Odin (unless waiting on 1+ gig downloads if you screw something up is ok by you - the Kies method works, slooooowly.)
- Framaroot, to root your Note 8 (see the thread by tweebee)
- Busybox installed
Steps:
Install Framaroot
Root your device
Install busybox
Easy part done.
Next, you need to be able to run init.d scripts. At first I thought this might require a custom kernel, until I ran into Ryuinferno's excellent tool for enabling init.d without a custom kernel.
the thread I learned this from is by Ryuinferno at http://forum.xda-developers.com/showthread.php?t=1933849
I used term-init.sh from an ADB command line, but the thread has an APK in it called Uni-Init.apk that I would expect to work.
What you're doing is creating an install-recovery.sh script and telling it to go read /etc/init.d and run scripts there at boot.
Next, you want to create a simple script and drop it into /etc/init.d You can do this with an adb push; if you create the file in windows, though, you need to deal with the line endings correctly. You need the script to be executable and to be owned by root.
The one I'm using is this, from Mattiadj of the Note 2 community
in this thread: http://forum.xda-developers.com/showthread.php?t=2036796:
I call the script 07mount on my device, and a copy is attached to this post.
-----------------------script starts next line
#!/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 gnote2 and note8
#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=2036796:
sleep 10
mount -o remount,rw /
mount -t vfat -o umask=0000 /dev/block/vold/179:17 /storage/sdcard0
sleep 30
mount -o bind /data/media /storage/extSdCard
chmod 777 /mnt/extSdCard
sleep 10
chown 1023:1023 /storage/extSdCard
chown 1000:1000 /storage/sdcard0
------------- end script on blank line above
You need /system remounted read/write, either in your favorite file explorer or via adb shell:
#mount -o rw,remount /system
to put the file in and
#chown root:root
the script itself
Now, put a fat32 formatted card into your sdcard, and reboot. When done, you should be able to see that your data storage has been remapped.
If you ever wanted to install a Samsung update, by the way, you'd need to completely unroot the device. I think the following would probably work:
- remove the su binary
- remove superuser from /system
- remove the busybox binaries
- remove install-recovery.sh from /etc and the /etc/init.d folder
If there was someting in an update you really wanted, you might do better to start by using the Samsung firmware downloaded from samfirmware.com, set your device all the way back to a clean install, then check for the OTA - Samsung does look at modifications and blocks updates to devices with changes to /system. My device is ineligible for OTA at this time.
That said, it appears that using Kies in emergency recovery mode can be used to reset your device to an as-shipped condition (I learned this when an early experiment resulted in my device being weirdly screwed up - bootable, but the network was down for the browser, etc. DNS and ping worked from an ADB prompt, though...)
You can download a copy of the script at http://www.mediafire.com/?2wbm439vlapb6om
I'm gonna try this when I have a full afternoon off as I tend to mess things up the first time I do them. But this will be super useful if I get it working. Hopefully when people start developing custom roms they can build this script in and save us all the trouble :highfive:
Haven't tried it yet, but it sounds like a custom recovery is very, very close. Once that happens, making this into a flashable modification will be trivial.
The very active Note II development is incredibly helpful, because our hardware and software are so similar to theirs.
I know this was something that users on the other Galaxy Note 2 threads were doing, and was wondering if at some point this will be an issue with say JB 4.2.2. I recall that Apps2SD would be an issue later on and wouldn't work, but I never got to that point. For me I am really in need of a 32GB tablet and just can't compromise even with a 64GB microSD card. I don't know why this tablet isn't supporting a 128GB microSD card, that would be awesome.
Upgrading internal storage by blending in sdcard
Just to be clear - this mod does not allow app2sd style migration of apps (in /data/app) to the sdcard.
Rather, it puts /data/media on the sdcard. A lot of apps use /data/media as their default for storage, though, so it's a helpful middle ground. Also, your apps are installed whether or not the sdcard is inserted, which is helpful.
I notice that the update includes a script called
install-recovery.sh - the same script that this method is using.
I have tested replacing a backed up copy of install-recovery and also
appending the command
run-parts /system/etc/init.d/ to the new file.
Using just a script to call run-parts or the stock install-recovery.sh works just fine.
I found a much easier way of doing this.
http://forum.xda-developers.com/showthread.php?t=2276193
hi friends & master
please help me
Is there any way to transfer games and apps to the internal storage with app2sd (moving apps & games in from system Rom to SD card(internal) no memory card)?
my system rom There is almost full
1.44 GB (148 MB free)
internal 12.6 GB (5.8 GB free)
SD card 12.5 GB (5.6 GB free)
I do not need to memory card

Broken /storage/sdcard1 on find7

I installed omni-5.1.1-20150822-find7-NIGHTLY on an Oppo Find 7 to avoid a Cyanogenmod radio bug. For some reason, /storage/sdcard1 does not work even through it reports as mounted. Anything looking at that path, root or not, gets a permissions error. Root can access /mnt/media_rw/sdcard1 without problems but apps can't. 'df' shows that the sdcard is mounted at both locations. Yes, I tried reformatting and changing permissions in TWRP without success. Any ideas on how to fix this? It's a 128GB card so I'm missing a lot of data.
kevinmcmurtrie said:
I installed omni-5.1.1-20150822-find7-NIGHTLY on an Oppo Find 7 to avoid a Cyanogenmod radio bug. For some reason, /storage/sdcard1 does not work even through it reports as mounted. Anything looking at that path, root or not, gets a permissions error. Root can access /mnt/media_rw/sdcard1 without problems but apps can't. 'df' shows that the sdcard is mounted at both locations. Yes, I tried reformatting and changing permissions in TWRP without success. Any ideas on how to fix this? It's a 128GB card so I'm missing a lot of data.
Click to expand...
Click to collapse
Hmm... That's external so I don't think the usual selinux issue would be the cause.
Check maxwen's find7 thread in Find7 Original Development, might be something useful there.

Categories

Resources