Friday, August 4, 2017

Internal and external SD storage inaccessible as root


I'm having a bizarre issue where apps, adb, etc. can properly access my internal and external SD storage without issue unless they are running as root, in which case they are completely inaccessible. This is on my Oppo Find 7 running ColorOS 1.2.7i (Android 4.3), and I've verified that I am not suffering from this issue with WRITE_EXTERNAL_STORAGE. I am not sure when this started occurring but I think it was after an OS update quite a while back.


When I run mount in an unprivileged adb shell, it has these entries that do not appear when I run it as the superuser:


/dev/block/vold/179:65 /storage/sdcard1 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1023,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:29 /storage/sdcard0 ext4 rw,seclabel,nosuid,nodev,noexec,relatime,discard,nodelalloc,noauto_da_alloc,data=ordered 0 0
/dev/block/vold/179:29 /mnt/secure/asec ext4 rw,seclabel,nosuid,nodev,noexec,relatime,discard,nodelalloc,noauto_da_alloc,data=ordered 0 0
tmpfs /storage/sdcard0/.android_secure tmpfs ro,seclabel,relatime,size=0k,mode=000 0 0

I can remount those partitions elsewhere while root and access them just fine within the same shell, but the permissions are funky and no other root apps can access them:



$ su
# mkdir /storage/sd_test
# chmod 777 /storage/sd_test
# ls -al /storage | grep sd_test
# drwxrwxrwx root root 2015-05-28 15:17 sd_test

... good so far ...


# mount -o rw,user,umask=0000 -t vfat /dev/block/vold/179:65 /storage/sd_test
# ls -al /storage | grep sd_test
d---rwxr-x system media_rw 2015-05-28 15:00 sd_test

# chmod 777 /storage/sd_test
# ls -al /storage | grep sd_test
d---rwxr-x system media_rw 2015-05-28 15:00 sd_test

... different permissions, but I can see and read/write the files inside ...


screenshot from another app


... Root Explorer shows it with the "original" permissions but the folder is empty ...


# mount | grep sd_test
/dev/block/vold/179:65 /storage/sd_test vfat rw,dirsync,relatime,uid=1000,gid=1023,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0


... hmm.


My /etc/vold.fstab just has one line:


dev_mount sdcard /storage/sdcard1 auto /devices/msm_sdcc.2/mmc_host

And /fstab.qcom:


/dev/block/platform/msm_sdcc.1/by-name/system         /system      ext4    ro,barrier=1,discard                                wait
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check,encryptable=footer
/devices/msm_sdcc.2/mmc_host /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard:auto
/devices/msm_sdcc.1/mmc_host/mmc0/mmc0:0001/block/mmcblk0 /storage/sdcard0 ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,voldmanaged=sdcard:29


How can I fix this?



Answer



So, it turns out that SuperSU automatically checked off its "Mount namespace separation" setting without telling me! I had no idea it even had such a feature, much less that it was broken.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...