SD Card permissions trouble - Android Q&A, Help & Troubleshooting

This thing has been a thorn in modding my phone ever since I rooted it - root has no read access to sdcard0 at all.
Whenever the external sdcard is mounted, root can only access sdcard1 after adding media_rw group to android.permission.WRITE_EXTERNAL_STORAGE, which works OK most of the times but there are some apps that rely on working with an external sdcard and root together unfortunately. Whenever the external sdcard is unmounted, same things happen with it - no access as root whatsoever. (user has full access)
Something of particular interest is the output of ls -l:
Code:
[email protected]_M3:/storage $ ls -l
drwxrwx--x root sdcard_r 1970-01-01 01:00 sdcard0
drwxrwx--x root sdcard_r 2015-08-10 02:48 sdcard1
[email protected]_M3:/storage $ su
[email protected]_M3:/storage # ls -l
drwx------ root root 2015-08-10 02:47 sdcard0
drwxrwx--x root sdcard_r 2015-08-10 02:48 sdcard1
[email protected]_M3:/storage #
and I don't really know where to begin to fix it. The stock ROM is doomed from the start with this it seems...
For the record; I'm using SuperSU and I have tried formatting my (2GB) sdcard to FAT32 and it didn't work.

Just restore the file tonoriginal data and use an app to do this.
Foldermount will work best.
Try this with thd help of this app ypu can read both sd cards at same time and keep game heavy data on sdcard as well
Sent from my SM-G355H using XDA Free mobile app

lolwhat file are you even talking about? Nothing has been touched there and that output of ls -l shows the permissions aren't as they're supposed to be for root.
FolderMount isn't exactly the thing I'm looking for. I need to fix permissions for root's access to the sdcard0 folder, plain and simple. For instance - I can't install Viper4Android because of this (though oddly I did manage to do it earlier, some black magic I did and don't remember lol). It wouldn't bother me if the sdcard folder in the ramdisk wasn't linked to the sdcard0 folder or if the permissions weren't tampered with and they were it seems.
I feel like as if I would have an easier time porting Cyanogenmod to my device than figuring this out...

Related

[Q] apks from marketplace folder location

Hi, I am using tnt 4.4.0 on my g tablet and I see the system/apps directory with loads of apk's that came packaged with the tnt rom.
My question or issue is this.
When I download an app from the marketplace I can't seem to figure out where it goes.
Using file expert v3.1.0 I searched all over and still no luck.. using this same app I can make backups of my apps by clicking the apps tab and long clicking an app and selecting backup but I would assume the original Zip or APK that I downloaded is on my device somewhere?
Or is it just unzipping from the market and I then have to zip them into a new file with an apk extension?
Innerchaos said:
My question or issue is this.
When I download an app from the marketplace I can't seem to figure out where it goes.
Click to expand...
Click to collapse
To answer this part of your question:
Downloaded apps are either in /data/app or /mnt/asec (this, after much filesystem path-manipulation magic post system boot) for apps moved to SD card:
Code:
$ su
# find /data/ -name *.apk
/data/app/com.google.android.street-1.apk
/data/app/com.google.android.youtube-1.apk
/data/app/com.android.vending-2.apk
/data/app/com.curvefish.widgets.wifionoff.donate-1.apk
/data/app/com.jasoncalhoun.android.systeminfowidget-1.apk
/data/app/com.facebook.katana-1.apk
/data/app/com.dataviz.docstogoapp-1.apk
/data/app/org.zooper.acw-1.apk
/data/app/jackpal.androidterm-1.apk
/data/app/com.curvefish.apps.appremover-1.apk
/data/app/com.curvefish.widgets.bluetoothonoff-1.apk
/data/app/com.noshufou.android.su-1.apk
/data/app/org.adwfreak.launcher-1.apk
#
# find /mnt/asec/ -name *.apk
/mnt/asec/com.rovio.angrybirdsrio-2/pkg.apk
/mnt/asec/com.google.android.apps.maps-2/pkg.apk
/mnt/asec/com.alensw.PicFolder-1/pkg.apk
/mnt/asec/com.farproc.wifi.analyzer-2/pkg.apk
/mnt/asec/com.redirectin.rockplayer.android.unified-2/pkg.apk
/mnt/asec/com.speedsoftware.rootexplorer-2/pkg.apk
/mnt/asec/com.google.android.voicesearch-1/pkg.apk
/mnt/asec/com.dataviz.docstogo-2/pkg.apk
/mnt/asec/net.androidcomics.acv-1/pkg.apk
/mnt/asec/com.rovio.angrybirdsseasons-1/pkg.apk
/mnt/asec/com.seesmic-1/pkg.apk
/mnt/asec/com.rovio.angrybirds-1/pkg.apk
/mnt/asec/com.adobe.flashplayer-1/pkg.apk
/mnt/asec/com.google.android.gm-1/pkg.apk
/mnt/asec/com.google.android.stardroid-1/pkg.apk
As to your other questions, I don't have definitive answers, but, looking inside those 2 directories (/data, and, /mnt/sdcard after you've unmount it) might prove instructive.
My mnt/asec directory is empty as well
Innerchaos said:
My mnt/asec directory is empty as well
Click to expand...
Click to collapse
Did you run the find command as root? (Or, have root permissions when you looked inside /mnt/asec?)
/mnt/asec might also be empty simply because you haven't moved any apps to the SD card.
The actual .apk files are in /mnt/sdcard/.android_secure/, but with a .asec extension instead of .apk. You'll have to unmount /mnt/sdcard in Settings > Storage first, then mount it again manually for you to see the files in that directory:
Code:
$ su
# mount -r -t vfat /dev/block/mmcblk3p1 /mnt/sdcard
# ls -l /mnt/sdcard/.android_secure/
total 124216
-rwxr-xr-x 1 root root 13870592 Jun 8 23:17 com.adobe.flashplayer-2.asec
-rwxr-xr-x 1 root root 2161664 May 30 03:37 com.alensw.PicFolder-1.asec
-rwxr-xr-x 1 root root 7483904 May 20 08:44 com.dataviz.docstogo-2.asec
-rwxr-xr-x 1 root root 2161664 Jun 3 03:24 com.farproc.wifi.analyzer-2.asec
-rwxr-xr-x 1 root root 8548352 May 26 22:18 com.google.android.apps.maps-2.asec
-rwxr-xr-x 1 root root 4290560 May 17 10:22 com.google.android.gm-1.asec
-rwxr-xr-x 1 root root 4290560 May 17 10:21 com.google.android.stardroid-1.asec
-rwxr-xr-x 1 root root 4290560 May 17 10:22 com.google.android.voicesearch-1.asec
-rwxr-xr-x 1 root root 9612800 May 17 10:22 com.redirectin.rockplayer.android.unified-2.asec
-rwxr-xr-x 1 root root 21321728 May 17 10:21 com.rovio.angrybirds-1.asec
-rwxr-xr-x 1 root root 19192832 May 19 19:58 com.rovio.angrybirdsrio-2.asec
-rwxr-xr-x 1 root root 22386176 May 17 10:21 com.rovio.angrybirdsseasons-1.asec
-rwxr-xr-x 1 root root 3226112 May 17 10:22 com.seesmic-1.asec
-rwxr-xr-x 1 root root 2161664 May 24 20:11 com.speedsoftware.rootexplorer-2.asec
-rwxr-xr-x 1 root root 2161664 May 28 16:03 net.androidcomics.acv-1.asec
#
# umount /mnt/sdcard
You won't see those files when the SD card is mounted normally by Android. Then, the /mnt/sdcard/.android_secure directory will appear to be empty.
You might also have to use /dev/block/mmcblk2p1 instead of /dev/block/mmcblk3p1 in the mount command above, if you run a Gingerbread-based ROM.

[Q] How to rw remount extSD in bugged ROM [solved]

I have a strange Chinese tablet similar to Onda 812. Here is the problem:
[email protected]:/ $ id userid
uid=10087(u0_a87) gid=10087(u0_a87) groups=1015(sdcard_rw),1028(sdcard_r),3003(inet)
[email protected]:/mnt $ ls -al
drwxr-xr-x root system 2013-11-12 00:23 asec
d---rwxr-x system media_rw 2013-11-12 00:14 extsd
drwxr-xr-x root system 2013-11-12 00:23 obb
d---rwxr-x system sdcard_rw 1970-01-01 03:00 sdcard
drwx------ root root 2013-11-12 00:23 secure
d--------- system system 2013-11-12 00:23 usbhost1
extsd got mounted with system user and media_rw group. But android user does not belong to that group so there is only read-only access to the card.
Setting access rights directly to /mnt/extsd does not work. The best solution I have found so far is format card as NTFS and use Paragon NTFS to mount. It does not survive reboot and is ugly.
Any more elegant ways to fix this problem?
SOLVED: Editing plaftorm.xml as per here was the clue.

[Q] Internal sd not mounting after installed CM11

Hi,
since the installation of cynaogenmod 11 unofficial on my zte nubia z5s (nx503a) , my internal sdcard is not mounted anymore
I can't access to me sdcard0 from the pc or the phone, only from the recovery. Unfortunately my backup are on the pc and so i can't copy them to the phone (there is no external sd).
i run in terminal
su
ls -l /mnt/media_rw
and i got
drwxrwxr-x system system 1970-03-19 12:17 sdcard0
drwxrwxr-x system system 1970-03-19 12:17 usbdisk
i tried many codes but terminal failed because in system read-only
anyone so kind to help me?

[Q] Android L, external_SD no permissions, mounted

Running BarePOP rom, a lollipop, Android 5
My external sdcard is using ext4 filesystem, in BarRin rom I had no issues.
I think is a fuse problem, I've tried to unmount and remount card
I can access /mnt/media_rw/external_SD
I see it's mounted properly
Code:
/dev/block/vold/179:65 /mnt/media_rw/external_SD ext4 rw,dirsync,seclabel,relatime,data=ordered 0 0
/dev/fuse /storage/external_SD fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
I've tried messing with sdcard command. changed uid & gid to 1015,1023,1035
SDCARD_RW 1015 /* external storage write access */
MEDIA_RW 1023 /* internal media storage write access */
SDCARD_ALL 1035 /* access all users external storage */
Code:
[1]+ sdcard /mnt/media_rw/external_SD /storage/external_SD 1023 1023 &
tmp-mksh-4.3# ls -la /storage/
drwx------ root root 1970-01-18 21:43 USBstorage1
drwx------ root root 1970-01-18 21:43 USBstorage2
drwx------ root root 1970-01-18 21:43 USBstorage3
drwx------ root root 1970-01-18 21:43 USBstorage4
drwx------ root root 1970-01-18 21:43 USBstorage5
drwx------ root root 1970-01-18 21:43 USBstorage6
dr-xr-xr-x root root 1970-01-18 21:43 emulated
lstat '/storage//external_SD' failed: Permission denied
lrwxrwxrwx root root 1970-01-18 21:43 sdcard0 -> /storage/emulated/legacy
I'm surprised your sd even worked! We've all had to format on a computer fat32. No matter the size.
If you're on V1, install the sd card fix in the first 3 posts. Any other version it's already installed.
Selinux mode changer, also mentioned in those posts, is another option.
If neither of those work, then you may have corrupted one or both sd's.
engine95 said:
I'm surprised your sd even worked! We've all had to format on a computer fat32. No matter the size.
If you're on V1, install the sd card fix in the first 3 posts. Any other version it's already installed.
Selinux mode changer, also mentioned in those posts, is another option.
If neither of those work, then you may have corrupted one or both sd's.
Click to expand...
Click to collapse
Version TEv1, and if I didn't know to look at /mnt/media_rw/external_SD I would say it didn't work. /storage/external_SD only can be seen in terminal. All other apps don't even see it. Even root doesn't have permission to read. SElinux set to permissive. I'm wondering if it's a kernel issue. The mount looks correct. I really don't know.
Just connected to computer, sdcard show but not accessable
jcfunk said:
Just connected to computer, sdcard show but not accessable
Click to expand...
Click to collapse
Well, this is your answer. If the card doesn't work in two different devices, it is defective.
stopeject said:
Well, this is your answer. If the card doesn't work in two different devices, it is defective.
Click to expand...
Click to collapse
Lol, I connected usb to phone, mtp
sdcard is fine, if to blame the card it would be that it's formatted to ext4.
jcfunk said:
Lol, I connected usb to phone, mtp
sdcard is fine, if to blame the card it would be that it's formatted to ext4.
Click to expand...
Click to collapse
Sorry, I didn't notice that your card was formatted to ext4. However, when connected to a Windows PC you had to get a message that the card needs formatting. It shouldn't be identified as "not accessible".
stopeject said:
Sorry, I didn't notice that your card was formatted to ext4. However, when connected to a Windows PC you had to get a message that the card needs formatting. It shouldn't be identified as "not accessible".
Click to expand...
Click to collapse
Yes, so true, windows sucks. I use linux.
I binded /mnt/media_rw/external_SD to /data/media/0/sd-ext
Same thing, fuse issue. I thinking it might be selinux lable issue,
ls -Z shows unlabled. Going to look into labling, googled but didn't see any info on android
Ok, compiled stock kernel with configured with selinux user disable. Also boot disable, but if disabled at boot get security warring.
Selinux, no labels was the issue. Once diabled, the /storage/external_SD became readable
I am not familiar with a fair amount of what I've read in this thread (particularly the Linux commands and the mount points). That said, I'm in bliss pop ROM, and tried to get my podcast app o save my shows to external SD. No go. I got a toast that said android doesn't have permission to write to ext SD. Is anything listed here a fix for that?
TIA
scottspa74 said:
I am not familiar with a fair amount of what I've read in this thread (particularly the Linux commands and the mount points). That said, I'm in bliss pop ROM, and tried to get my podcast app o save my shows to external SD. No go. I got a toast that said android doesn't have permission to write to ext SD. Is anything listed here a fix for that?
TIA
Click to expand...
Click to collapse
Much of this is specific to ext4 filesystem on external sd. But is useful to understand, for the mount should be same, or at less for ex-fat.
I'm willing to help, I need some info.
What filedystem does your card have?
If you can, in terminal emulator run this command.
mount | grep SD
Then put output here. Could need to sdcard fix, depends on version of Barepop

mount NTFS file system on Venue 10 5050

HI, I have just picked up a Venue 10 5050. It comes with Lollipop but of course like all Venue's is missing support for NTFS file system. I have Rooted, and installed the ntfs-3g found here:
HTML:
http://forum.xda-developers.com/android/development/exfat-ntfs-fuse-drivers-easy-build-t3126413
It installs fine, and I am able to mount my portable NTFS drive using the USB port as root from adb shell.
Code:
ntfs-3g -o umask=0 /dev/block/sda1 /storage/usbcard1
Of course the problem is Applications can not see the device. I believe it is because the storage mount point looks like so:
Code:
[email protected]:/ # ls -al /storage
ls -al /storage
d---r-x--- root sdcard_r 2015-09-02 14:13 emulated
lrwxrwxrwx root root 2015-09-02 14:11 sdcard0 -> /storage/emulated/legacy
drwxrwx--x root sdcard_r 1969-12-31 18:00 sdcard1
drwxrwxrwx root root 2015-08-26 06:31 usbcard1
Note the group owner for /mnt/usbcard1 is root and needs to be sdcard_r to be viewable by applications.
Anyone have an idea on how this can be fixed?
Domenic
small update, I ran the /etc/install-recovery-2.sh which mounted the drive on /mnt/media_rw/sdcard1 which I can view with an ls -al which displays:
drwxrwxrwx media_rw media_rw 2015-08-26 06:31 sdcard1
which root can view, but again non of the applications can view the data? I am certain it is some type of lollipop type issue?
Domenic
So I have installed stickmount from the Playstore. It auto mounts the NTFS drive when I plug it in.
Domenic

Categories

Resources