Why shell do not have media_rw group for access of writing data to external memory card on android device?

2,933 views
Skip to first unread message

Sandeep Nandal

unread,
Jun 26, 2013, 3:27:13 AM6/26/13
to android-...@googlegroups.com
Why adb shell do not have media_rw group for access of writing data to external memory card on android device?
 
Unable to write data to /storage/extSdCard in android device using adb shell.
Because shell user don't have permissions to do so,
 
Is it a bug? or is it done deliberately for some reason?
 
---------------------------------------------------------------------------------------------------------------------------
$id
uid=2000(shell) gid=2000(shell) groups=1003(graphics),1004(input),1007(log),1009
(mount),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt)
,3003(inet),3006(net_bw_stats)
---------------------------------------------------------------------------------------------------------------------------
 
contents of platform.xml which contains the permissions details:-
---------------------------------------------------------------------------------------------------------------------------

    <permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
        <group gid="sdcard_rw" />
        <group gid="media_rw" />
    </permission>
    <permission name="android.permission.WRITE_MEDIA_STORAGE" >
        <group gid="media_rw" />
    </permission>
                            -------------------------------------------------------

    <!-- Standard permissions granted to the shell. -->
    <assign-permission name="android.permission.WRITE_EXTERNAL_STORAGE" uid="shell" />
 
-----------------------------------------------------------------------------------------------------------------------------------------------
 
In platform.xml file we can see that media_rw group is responsible for the write access to external sd card. and shell has been given the permission to do so. still it doesn't work. in adb shell when we see the groups permissions of shell it doesn't show the media_rw group in shell user.
 
Need this access to copy and move data in external memory card using adb shell.

Jean-Baptiste Queru

unread,
Jun 26, 2013, 11:00:46 AM6/26/13
to android-...@googlegroups.com
That's probably just an oversight for a situation that nobody ran into during development.

JBQ


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-platfo...@googlegroups.com.
To post to this group, send email to android-...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Jean-Baptiste M. "JBQ" Queru
Technical Lead, Android Open Source Project, Google.

Questions sent directly to me that have no reason for being private will likely get ignored or forwarded to a public forum with no further warning.

Sandeep Nandal

unread,
Jun 27, 2013, 12:46:25 AM6/27/13
to android-...@googlegroups.com
Hi JBQ,
 
Thank you for your reply,
 
I have ran into this issue, could you suggest me how to work around for the situation where i need to transfer data between Internal Memory Card and External SD Card using ADB Shell. because the speed which i'm getting to replicate and copy files in internal sd card at shell level is remarkable. Is this permission issue at Android's end or is it a mobile manufacturer's brand specific issue. If it's on android's end where should i report the bug(In which category).
 
thank you

Rolf Schreiner

unread,
Jan 29, 2014, 2:59:00 PM1/29/14
to android-...@googlegroups.com
Hi Sandeep,

Here is my post again. Sorry, I forgot to attach the file with a screenshot of the platform.xml code for the Galaxy Note 3 and the GT-9100 (Galaxy S II)
Rolf
====================
I can no longer write to the Samsung 64GB external SD card of my Note 3, through WIFI, after installing the Android 4.2.2 update.

Here is the message that I sent to Samsung Nederland, but so far, no satisfactory answer. I also posted this question on the Android-platform forum.


Dear Samsung, 

I write to you again, because the previous answer from Samsung NL ("non compatible SD card"), does not seem right. 

I have the following problem with my Note 3: (but I may have found the problem, see below) 

I can no longer write files to the Samsung 64GB external SD card, through WIFI transfer. 

The problem seems to be in the external SD writing permissions in the latest Android 4.4.2. update for Note 3. Here is why: 

1. Before the 4.4.2. update WIFI file writing to the Ext SD was OK, now no more. 
2. I can still Read/Write to the Ext SD, using a USB cable. But not through WIFI. 
3. WIFI Read from the Ext SD is still OK. 
4. WIFI Read/write to the internal SD storage is still OK. 
5. WIFI Writing to a new 32GB Sandisk external SD in the Note 3, also no longer works with 4.4.2. So the Samsung Ext SD card is not the problem. 
6. Read/Write to 32GB Sandisk external SD on Galaxy S, Android 2.2.1., is OK. 
7. Read/Write to 32GB Sandisk external SD on Galaxy S II, Android 4.1.2., is OK 
8. Read/Write to internal SD on Nexus 7, running Android 4.4.2., is OK 

Doing some research, the problem may be in the Note 3 /system/etc/permissions/platform.xml file, lines 73-75: (here the WIFI write to Ext SD is NOT OK) 
73: <permission name="android.permission.WRITE_EXTERNAL_STORAGE" > 
74: <group gid="sdcard_r" /> 
75: <group gid="sdcard_rw" /> 
76: </permission> 

For the Galaxy S II (GT-I9100), the same platform.xml file shows the following code in  
lines 61-64: (here the WFI write to Ext SD is OK) 
61: <permission name=“android.permission.WRITE_EXTERNAL_STORAGE” > 
62: <group gid="sdcard_rw" /> 
63: <group gid="media_rw" /> 
64: </permission> 

I see a difference here in the platform.xml files. But I do not understand why the problem only affects the WIFI writing to the Ext SD card of the Note 3, and not the writing through a USB cable. 

Attached you will find a file with a screenshot, showing these differences. 

My Note 3 is not rooted, so I cannot modify its platform.xml file. 

So, please, I would appreciate your kind assistance, in fixing my problem, so that I can write and sync all my pictures to my Ext SD card of my Note 3, just like I could do it before the Android 4.4.2. update. 

Thank you for your help, 

Sincerely, 

Rolf Schreiner 
================================
Platform.xml-GT-I9100-vs-SM-N9005.pdf

Jeff Sharkey

unread,
Jan 29, 2014, 8:53:00 PM1/29/14
to android-...@googlegroups.com
Yep, looks like Shell.apk declares WRITE_MEDIA_STORAGE, but adbd doesn't include that GID when it setgroups().  I'll fix this in the next platform release.

j


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-platfo...@googlegroups.com.
To post to this group, send email to android-...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/groups/opt_out.



--
Jeff Sharkey
jsha...@android.com

Rolf Schreiner

unread,
Jan 30, 2014, 4:57:22 AM1/30/14
to android-...@googlegroups.com
Hi Jeff,

Thank you for your prompt reply.
I am not much of a programmer, so sorry if I do not exactly understand all the terms of your email, but if I understand it right, I may be able to write to my external SD through WIFI, after the next platform release, i.e. the next android update? Is that right?

I will be looking forward to it,

Many thanks,

Rolf

To unsubscribe from this group and stop receiving emails from it, send an email to android-platform+unsubscribe@googlegroups.com.
To post to this group, send email to android-platform@googlegroups.com.



--
Jeff Sharkey
jsha...@android.com
To unsubscribe from this group and stop receiving emails from it, send an email to android-platform+unsubscribe@googlegroups.com.
To post to this group, send email to android-platform@googlegroups.com.



--
Jeff Sharkey
jsha...@android.com

Jeff Sharkey

unread,
Jan 30, 2014, 12:31:28 PM1/30/14
to android-...@googlegroups.com
Writing to an SD card through Wi-Fi isn't a supported platform feature, so I'm not sure if you're describing a custom OEM feature, or a third-party app.

Third-party apps will always have write access to the entire primary external storage device, and starting in KLP, they'll have write access to their package-specific directories on secondary external storage devices.

This mailing list is mostly focused on platform development, not user support, so you'll have to reach out to your OEM/developer for additional details.

j


To unsubscribe from this group and stop receiving emails from it, send an email to android-platfo...@googlegroups.com.
To post to this group, send email to android-...@googlegroups.com.



--
Jeff Sharkey
jsha...@android.com
Reply all
Reply to author
Forward
0 new messages