• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

[Verizon] Important info for flashing to Jelly Bean (4.2.x) from 4.1.x ROM's(last update 5/11/13)

teddyearp

Android Expert
So, though this sticky is a bit behind the times, I did first start noticing problems with Jelly Bean 4.2.x as I polled and pointed out here:

Is a full 4.2 ROM really worth the trouble?

While still called "Jelly Bean" the update from Android 4.1.2 to 4.2.x changes the file structure of the 'virtual' sdcard on our Galaxy Nexus devices. Actually it changes it for every device, but I only will cover the GNex here. What has changed is that the ability to add user accounts, similar to any regular computer, has been implemented. However, if the proper steps are not taken before you crack flash a few new 4.2.x Roms, you will end up with a huge mess and run out of room on your device in a hurry.

Moving on, the actual location when viewed with a root file manager like SUFBS or ES Explorer (or others of your choice) of your 'virtual' sdcard has been here on 4.1.x:

/data/media

And though you will see the same files in /sdcard and /storage/sdcard0, those are just symlinks to the same info, just like a shortcut (on a windows box) or alias (on a mac box). Once you flash a 4.2.x ROM, the actual location gets changed (and all the files moved) to here:

/data/media/0

And the symlinks get changed to /sdcard/0 and /storage/sdcard0/0. On the surface, no big deal, right? Wrong. The problems arise if the version of your custom recovery is not compatible with a 4.2.x ROM. If it is not and you keep crack flashing 4.2.x ROMs you might soon end up in trouble. If, while using the 'older' custom recovery, you continue crack flashing, your 'virtual' sdcard ends up somewhere around here:

/data/media/0/0/0/0/0/0 (etc.) with all your files copied to every '0' directory and your symlinks end up the same way, and your device quickly runs out of space (the dreaded "your device is low on storage" message).

You get my drift, I hope. This may also make it very difficult to restore your nandroid of a 4.1.x ROM as well. If you are already in that situation, not to worry, the solution for that is later in this post.

But first, you ask: "How do I avoid this mess in the first place?"

Answer: Make sure you first have the proper version of a custom recovery compatible with an Android 4.2.x ROM installed on your device. If you have CWM 6.0.1.x or TWRP 2.3.x.x you must update your custom recovery before flashing a 4.2.x ROM. At the very least, CWM 6.0.2.3 or TWRP 2.4.x.x are required before you flash a 4.2.x ROM, therefore you will not end up with the 'nested /0/0/0/0' directories if you continue to crack flash.

Though there are several ways to flash the latest custom recovery to your phone, I have found that Scary Alien's "Android Root Toolkit" available for free in the Play store is a pretty good tool to check your current recovery version and then flash the ones I have mentioned.

Now, "What do I do if I have all these nested '0' directories?" First off, go ahead and flash the compatible custom recovery as mentioned above, then find a way to copy (just in case) all the files found in the last /data/media/0/0/0/0 (?) folder to your computer. Then using a file manager that will show hidden files and folders, copy/move the files in the last '0' directory to:

/data/media/0

And then use your file explorer to delete all the other '0' directories until you have just this one:

/data/media/0

leaving nothing else in the symlinks but /sdcard/0 and /storage/sdcard0/0. A reboot of your device is essential at this point.

Additional info and disclaimer:

As in the very first thread I linked in this post, I have yet to go from an Android 4.1.2 ROM to an Android 4.2.x ROM for fear of this situation. Call me chicken poop. So I have compiled the information in this post from several sources, both from the posts I will link below as "References" and a couple of PM's from tdevaughn; so far the feedback I have received is that I am correct. I have flashed the latest recoveries that I mentioned, just in case. Also, iowabowtech has some really great adb commands to also help troubleshoot some of the 'nested /0/0/0 directory' problems I mentioned here. I give him full editing rights to add/insert them where or if he sees fit.

----->Gray area:
If after flashing a 4.2.x ROM you decide you don't like it and want to restore your nandroid to your saved 4.1.2 ROM, how does that work out? Obviously I haven't done it, maybe someone else has and will chime in. tdevaughn said he did and found no problem with the fact that 4.1.2 points your sdcard to /data/media and mentioned symlinks and 4.2.x points your sdcard to /data/media/0; I kind of find that hard to believe.

So because of that I will leave this sticky open for addtional info, but useless posts will be reported and deleted.
------------------
References:
NEED serious help. cm10.1 bricked
Can't reach root of SD card because of file structure.
0 directory on sdcard question
HELP! Verizon GNex stuck in Recovery
[How To] Manually fix SD card issues when switching from 4.1.x to 4.2.x.
VZW Galaxy Nexus stuck on 4.2.1
 
----->Gray area: If after flashing a 4.2.x ROM you decide you don't like it and want to restore your nandroid to your saved 4.1.2 ROM, how does that work out? Obviously I haven't done it, maybe someone else has and will chime in. tdevaughn said he did and found no problem with the fact that 4.1.2 points your sdcard to /data/media and mentioned symlinks and 4.2.x points your sdcard to /data/media/0; I kind of find that hard to believe.

Ok, since no one else decided to report back on this, I tried it myself with great trials and tribulation, personal sacrifice, wailing and gnashing of teeth at the end (<-----heavy sarcasm here folks).

First off I want to say that I will mention Rom Manager a few times here. I do not 'rely' solely on Rom Manager, I only use it as a handy scripting tool to pass off commands to my custom recovery so that I can be booted into Android, tell my phone what all I want to do in recovery, hit 'ok', set the phone down, and when it's booted back up, everything has been done and it's back in Android (this is how I covertly do stuff to my phone at work). I know that Goo Manager does the same thing, but I like the backup naming convention better in RM.


The other night I flashed an Android 4.2.2 based ROM using TWRP 2.4.1.0. Everything went fine and as expected the contents of my 'sdcard' all got moved from

/data/media

to

/data/media/0

and the symlinks all followed. No problems. I use Apex and it found and restored the settings fine. Rom Manager 'saw' all my backups and such as well. Then I realized that there were a couple of other apps for which I had forgotten to backup their data before flashing the 4.2.2 ROM. So I opening Rom Manager, told it I wanted to restore my 4.1.2 backup and when prompted told it to make a backup of my current ROM. After passing it along to TWRP, the backup was created fine, but then it gave TWRP the wrong location for the restore. No problem, TWRP was still open, saw all my backups so I pointed it to and restored the one I wanted just fine. Rebooted phone and everything was all good.

And here is where it starts to get interesting

After making the other backups, I though "Hey, let me look at the file structure now". Opened SUFBS and went to /data/media and there was still the '0' directory with most of my 'sdcard' contents, but now there were some others back up at /data/media containing stuff while I was working within the 4.1.2 ROM. And now Rom Manager didn't see any backups. No problem, got the backed up stuff in the right sub location under /data/media/0, booted into recovery, TWRP saw my 4.2.2 backup and restored it. After a while of further setting up and playing with the 4.2.2 ROM I decided it wasn't quite what I wanted so wanted my 4.1.2 rom back. Booted into recovery, restored 4.1.2 ROM backup with TWRP and rebooted just fine. But when I opened my gallery, none of my pictures were seen anymore.

And then the fun really began!

At the end of this process I still had to delete the /data/media/Pictures/cache folder and reboot to get the gallery to see my pictures, so I don't know if all this is required, but I did it anyways because I didn't want to have this huge mess of stuff both in /data/media and /data/media/0 not knowing which was being used, which was current, which was duplicated, or not. I also found afterwards my system sounds (ringers, etc.) were borked, but don't know if it was because of this as I didn't check first, but like I said, I wanted a clean slate going forward.

Using a file manager that you can see (sometimes this has to changed in the settings of the selected app) the hidden folders/files with (Astro, ES File Manager, etc), select all within /data/media/0 and then paste everything back into /data/media selecting merge and/or overwrite or whatever. As I mentioned in the OP of this thread, it would be best "just in case" to copy the contents to your PC first, I was at work and didn't have that luxury and it still worked out OK. Once done, just delete the /data/media/0 folder, reboot your phone and viola, roses. But, the usual cautions are in place, your mileage may vary. I'm going to edit out the reference to SUFBS in the OP because it does not see the hidden files/folders.

I know this was the long way around the barn but I felt posting my whole journey going to and reverting back to a 4.1.x ROM from a 4.2.x ROM (via a nandroid backup, flashing a 4.1.x ROM from 4.2.x, who knows?). Sorry for the long post, no wonder it timed out on me the other night, lol. I will still leave this thread open in case there is meaningful additional information to be added; I know there is a way to do this file/folder manipulation via adb.
 
Ok folks for next guy who decides to upgrade to 4.2 but does NOT want the multi-user environment, give this a try.

1. Download the attached file
2. Remove the .txt extension
3. Copy it to your /data directory
4. Open Android Terminal Emulator (Free Market app if you don't already have it)
5. At the prompt type "cd /data"
6. Type "chmod 644 .layout_version" on the file in /data (/data/.layout_version)

Code:
cd /data
chmod 644 .layout_version

Now when you upgrade to 4.2 you should stay single user and have no /data/media/0 directory when you are done. If anyone tries this please let me know if it works and thank me if it does.

ps-its just a special file in a special location, the presence of which tells Android NOT to upgrade your system to a multi-user environment. If you later decide you want multi-users, delete the file and reflash (from recovery) the stock or custom firmware or ROM or recovery. If your custom ROM or recovery wipes the entire /data partition less /data/media including this file, obviously then this will not help, but with latest versions of ROMs and recoveries that should not happen any more.

[Ref] **********************************[Ref]****************************************[Ref]
 

Attachments

Ok, if anyone sees what I did, I moved some stuff to this thread:

http://androidforums.com/verizon-ga...-work-sdcard-0-problem-solutions-brewing.html

And copied some stuff, so a couple of posts are duped in both threads, just to keep each thread making sense.

Good stuff there man. Keep us posted of any progress for sure.

:beer:
+1 ^^^ this. The stuff you're coming up with is pretty far above my pay grade, keep it up. I'm also watching your thread here:

http://forum.xda-developers.com/showthread.php?t=2264643&page=3

and hope that when you get a final conclusion you post it in this one.
 
Back
Top Bottom