Sunday, January 25, 2015

How to: Fix no access to the virtual SD card after Android Lollipop update


This solution is based on the experience with some HTC and Nexus devices, however it will work on any device running Android Lollipop or newer/older Android OS with SELinux (Security-Enhanced Linux) kernel security module.

What's the problem? Sometimes you might not be able to access the content of the internal userdata memory, also known as "virtual SD card" - located as /data/media/0 on the userdata partition. The "bad" workaround is to boot the device in a recovery mode and gain the access to all files from there, but this doesn't solve the problem at all.

Repair Process
Note: root required!
  1. Download this mini-sdk package and extract it to c:\mini-sdk
  2. Connect your device to the PC
  3. Start up the device normally, wait until system is fully loaded
  4. Open a command prompt on the PC (cmd.exe), type and confirm each command with ENTER:
  5. cd /d c:\mini-sdk
  6. adb shell
  7. su
  8. restorecon -FR /data/media/0
  9. exit
What's going to happen? Restorecon is a program used to restore file(s) default SELinux security contexts. It can be run at any time to correct errors or to add support for new policy. With a corrected SELinux security context for the /data/media/0 you will be able to access the content of the virtual SD card again.

Do you have any questions or comments? Feel free to share! Also, if you like this article, please use media sharing buttons (Twitter, G+, Facebook) below this post!


For latest news follow Android Revolution HD on popular social platforms: