The past week has been a rough one for all of my technology products. My MacBook Pro hard drive died, my tablet pc pen had a speck of crushed diamond or something equally hard that lead to a big gouge on the screen, half of my RAID mirror died on my development machine and some crappy software corrupted the iTunes database on my iPhone.
Word to the wise: as of January 1, 2009 there is no software available that can update the iTunes database on an iPhone or iPod Touch running firmware 2.x. Once the new hash for signing the database is reverse engineered this will be possible again, but until then be careful. I discovered this the hard way while trying to add some movies to my iPhone while my MBP was out of commission.
When you connect your iPhone after using one of the crappier utilities (quality apps tell you it's not possible) you'll be greeted with the following message:
iTunes cannot read the contents of the iPhone "XXX". Go to the Summary tab in iPhone preferences and click Restore to restore.
Restoring on a customized jailbroken iPhone is a bit of a pain; you need to reinstall all of your jailbroken apps, set your Winterboard theme, arrange all of your icons "just so", etc. It takes me about an hour to get everything just the way I like it, and I've got most of the process scripted out now.
Your iTunes database is stored in /private/var/mobile/Media/iTunes_Control/iTunes and mine has the following files in it:
Extras.itdb IC-Info.sidb IC-Info.sidv PhotosFolderAlbums PhotosFolderName PhotosFolderPrefs Rentals.plist Ringtones.plist iPhotoAlbumPrefs iTunesApplicationIDs iTunesControl iTunesDB iTunesMovies iTunesPrefs
The suspect file was iTunesDB. My first thought was just to remove (rename) the iTunes directory and see what happened. Instead of an error I was prompted to configure a new iPhone or restore from backup. No go. When I refreshed the directory listing I saw that iTunes had re-created the iTunes directory.
I removed everything inside of the newly created /private/var/mobile/Media/iTunes_Control/iTunes directory except iTunesDB and copied all of the files (except iTunesDB) from my backup directory, /private/var/mobile/Media/iTunes_Control/iTunes-bad. Everything inside of the iTunes directory should be owned by user/group mobile/mobile and permissions set to 644.
chmod -R 644 /private/var/mobile/Media/iTunes_Control/iTunes chown -R mobile:mobile /private/var/mobile/Media/iTunes_Control/iTunes
I plugged my iPhone in and iTunes happily recoginzed it, sans music. Since it's a horrific music player (I love my touch wheel) I didn't care about this, my jailbreak configurationwas much more important.
You can download the virgin iTunesDB file here.
Tags: Apple, Cydia, iPhone, iTunes, jailbreak





January 6th, 2009 at 12:53 am
I totally commiserate. I just had the same experience (like tonight!). ImTOO just screwed up my iPodDB when I used it to delete an album. Unfortunately your warning came too late as I am reading this article after the fact. I have spent a quadzillion hours hacking and tweaking my iPod and I use it as my only mp3 player (I have a different opinion about the click wheel), so you can imaging my horror and heart attack when I got the iTunes message and saw that my Music did not display in the player.
===================================
My final solution (after hours of messing around):
====================================
Slight variant on what you had done/ Keep iTunes closed while you do this. I have tool called i-FunBox (it's free at http://i-funbox.com/ ), let's me see, alter and browse the iPod touch as if I was in explorer. I used it to rename iTunes_control to iTunes_control2 (or BAD). I did not make any new iTunes_control directories. Opened iTunes up, when it I was prompted to configure a new iPhone or restore from backup, I chose configure new iPod. It simply rebuilt my iTunesDB and resynced the music that is in my PC's iTunes. It did not delete my Applicaton or format my disk as it would have had I selected the restore to factory settings… If you only have your music on your iPod (lost your original Mac or PC's original iTunes), you can can use i-FunBox to dump iTunes_control2 onto your HD, dragg the Music folder into Windows iTunes and let it rebuild a new database.
February 26th, 2009 at 9:52 am
I also followed the final solution from Fadi's comment on my 3G iphone and it worked like a charm. Thank you to the original blogger and commenter for publishing your recovery methods!
Adam
February 26th, 2009 at 11:40 pm
The method I've been using is simply browsing my ipod using WinSCP, and deleting the entire Itunes_Control folder. When you start up itunes again it asks you to restore, and all the apps and jb stuff is kept. Now, the question I have is, has anyone found a way to simply un-corrupt or rebuild the database somehow, so I don't have to re-upload all my music every time? The reason I am asking is because my iPod Touch gets corrupted an average of once a month…
April 10th, 2009 at 12:27 am
You are my personal hero!!!!!!!!! Thank you very much for this, I had your exact problem and it works like a charm now!!!!!!!
April 10th, 2009 at 8:11 am
Thank you so much!! ImTOO completely messed up the iTunes database on my iPhone… I was afraid I would have to restore it again. Instead I just renamed the iTunesDB file and it worked again! iTunes now recognizes my iPhone as before :-)
April 14th, 2009 at 5:02 am
really great solution. hats off to you dude.
April 28th, 2009 at 8:57 am
Hi,
I have another weird problem. i have a 3G iphone, which worked fine until its database got corrupted. i did exactly what you mentioned here and chose setup a new iphone (instead of restore which i don't want to do) and the problem was almost fixed. By almost i mean that Itunes recognize my iphone but does not let me transfer any mp3s to it claiming mp3 is not supported format by my iphone. on top of that my applications and video folders under my iphone device (when you click on the triangle left of the device name) are gone and i can't sync neither applications nor video. so now I am stuck with the inability to sync anything. please help
May 17th, 2009 at 2:51 am
thanks a lot for your solutions!!!! now i can back up my contacts before restore!!!
May 25th, 2009 at 12:30 pm
i have same issue as mentioned by GUY, I too cant sync my iphone with itunes.
i have done these steps earlier but i dont why its not working now
only difference is that i have iphone 2g
with firmware 2.2
Any sugestions from your end would be helpfull
Thanks
July 19th, 2009 at 8:37 pm
Help is appreciated.
Imtoo ipod transfer messed up my database. transfered some videos but nothing shows up. yet it consumes the available space.
Thanks in advance
my email add is schwanella_chong@yahoo.com
November 14th, 2009 at 10:45 am
I agree with what Fadi Says.
He became my personal hero too.. I am from India and have jail borken iphone and I got same error. I eventually come to this blog and … yes Yes YES YES YES. I got the solution.
Its great. Thanks to you all and also the i-FunBox team.
Thanks and regards,
Raj Swami.
November 14th, 2009 at 10:47 am
After rename the itune database , connect to itunes and create a new database. After that you can delete the older database. Else the space with old corrupted database will not be available for use.
This works.
Thanks in Advance,
Raj Swami.
November 24th, 2009 at 4:21 pm
I found this and it solved my problem. However, I just SSH'd into my iPhone and deleted the iTunesDB file all together. It seemed to do the trick, but this post led me in the right direction.
December 30th, 2009 at 5:17 am
Hey man, you saved me the neck…
Thanks a lot.
January 22nd, 2010 at 9:28 am
Writing this from my fixed iPhone. Playing music and loving it thanks to this thread. I used the trial version of ifile which I'm now inclined to purchase. My db was corrupted by sharepod deleting an album. I used ifile to locate the directory. In the dolder that says itdb Inside that folder is a iTunes db backup. I copied the backup to the main folder and itdb. Voilà. Music playing.
February 2nd, 2010 at 4:14 pm
I attempted the "Recovery of a corrupt Itunes DB on Iphone" posted by Corey Gilmore, I did eventually get my apps, and contacts back, but no iTunes music, whilst apps and other stuff syncs, music will not, iTunes simply hangs.
I think I might have made some mistakes with permissions, can anyone tell me what the default permissions are for the "Music" folder and files in it, and for the "tmp" folder.
Please help !!!
February 2nd, 2010 at 4:49 pm
/var/mobile/Media/iTunes_Control/Music is owned by mobile:mobile and set to 700.
It's filled with F## directories that are mobile:mobile and set to 755.
The F## directories contain files that are mobile:mobile/644.
The process I outlined here isn't meant to help you recover your music, it's meant to help you avoid having to restore your iPhone from a backup because the iTunes DB is corrupt. Restore using the blank iTunes DB, and then sync your music/movies back from iTunes.
February 27th, 2010 at 5:08 pm
Hi,
I had the following problem which is not exactly the same as the described above, but it is close enough: I updated from 8.x to 9.0.x today and all my music was lost, some 2 GB, all gone to "Others"
I did solve it as follows:
- delete all music, podcast, downloads, videos, recordings from ipod that is still recognisable under the /var/mobile/Media and /var/mobile/Media/iTunes_Control directories, if any (I used openssh)
- move iTunes_control to iTunes_control-bad or similar (move NOT copy) — to make a backup, just in case
- delete all contents inside F00–F13 (in my case just 13 folders) in the Music folder inside iTunes control. This was the "Others" content
- sync
Voilà! "Others" should disappear
Cheers,
Slono