You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

💡 Did you know?

⏺ If you can't accept iCloud Terms and Conditions... Learn more >

⏺ If you don't see your iCloud notes in the Notes app... Learn more >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Resolution Steps: iPhone, iPad or iPod Touch library corrupted and showing ghost entries which will not play or music that is on the device in iTunes but inaccessible.

Issue: iOS Music application either has items listed in the library that will not play; or has an empty library but iTunes reports that music is present on the device and taking up space; or a combination of these issues coupled with the inability to resolve the problem through the standard resolution steps of disabling music syncing to remove all music and then re-enabling or by enabling "manually manage library" and removing the items.

Additionally, attempting to restore from a back-up does not resolve the issue and the default response from the Apple Support Community is to factory restore the device and treat as new device, resulting in loss of all settings and basically starting from scratch.


Cause of issue: Corrupted iOS device iTunes library (MediaLibrary.sqlitedb). This database stores the iTunes Media records and related information such as playcount, lyrics etc. It does not store information and settings regarding iOS Applications as far as I am aware so this should be safe.


Resolution Steps:

  1. Perform a back-up to your local computer rather than iCloud if practical. This will be quicker in the event of issues.
  2. Download a iOS device manager such as Phone View (http://www.ecamm.com/mac/phoneview/) which will allow you to directly access the file structure of the device. (This will NOT require an illegal jailbreak to be performed!)
  3. Enable the Advanced View mode so the entire disk structure is accessible.
  4. Browse to the following file: iTunes_Control/iTunes/MediaLibrary.sqlitedb
  5. Rename MediaLibrary.sqlitedb to MediaLibrary.sqlitedb-backup or similar
  6. Hold down POWER and HOME on your iOS device until the Apple logo appears. Release both buttons.
  7. When device has rebooted, connect to iTunes and synchronise it.
  8. iTunes will detect that the Media Library on the device is missing and recreate it based on the items that it has listed in the iTunes synchronisation record for the device.

iPhone 4, iOS 5.1

Posted on Apr 28, 2012 6:14 AM

Reply
40 replies

Nov 12, 2013 6:08 AM in response to GeekDad3

People this solution creates just a temporal solution: let me describe my problem

First issue

I apply recently Itunes Match when i activated it in my iphone 4s it supposed to wipe my entire library to download all from the cloud but it didn't, it just deleted 226 songs from my 4600 collection. it apparently looks good, but when I see the library from itunes in my PC I have the 4600 songs + 226 songs duplicated, the "ghost" songs in the iphone cant be played (error), and can't be deleted. the weird thing when I redo all again from scratch deleting all syncing and activating itunes match, ocurrs the same with same songs, even deleting the library file. wiping the music, restoring iphone from factory etc.

Second issue

Every time i edit my music in itunes to complete missing information I have to deactivate and activate itunes match to see the changes on all my apple devices (apple tv, Iphone, Ipad), before ios7 use to do automatically.

Nov 25, 2013 1:40 AM in response to GeekDad3

Genius! I was quite aggravated that after selectively rebuilding my library by hand, NO album art synced. It's the same art that was previously on my iPod Touch 3, so I know it's compatible. The art shows in iTunes and even showed in iTunes when I clicked on my iPod and then browsed the music and clicked on "Get Info". I made sure that EVERYTHING was properly tagged and had art when I rebuilt the library. I guess Apple is just inept when they have millions of iPods sold and millions of copies of iTunes installed, and they still can't get album art to sync... Thankfully this solution of deleting this specific file and then resyncing appears to have fixed it. Everything has art now. Fortunately I have an "illegal" 😮 jailbreak and used a file browser on the device to delete/rename the file. As far as I know, jailbreaking is not illegal in the US. Exemptions were made to the DMCA to allow jailbreaking. I'm not 100% sure about the current status, but it has at least in recent years, been legally exempted. That's for another discussion though. I just find Apple's smugness on this absurd. I bought the iPod used. It's MY device, not theirs. I'll do what I want with it.

Nov 25, 2013 11:20 PM in response to caa100

I cannot speak to everyone's experience, but my device did not resync. I have 7500+ songs, or about 53GB on my iPod. I deleted all of the music on my iPod when I rebuilt my iTunes library. When I did the initial resync it took over an hour. I don't recall exactly how long it took because I was watching TV. It could have even been 2 hours, I don't know, but I know for sure it was over an hour. When I deleted the database file to fix the album art issue, it took a while to "sync" but it did not resync all of my music. It took maybe 15 minutes. It also did not run through every song and count up like it did on the initial sync. When I plugged my iPod in to iTunes, it showed my storage as 53GB "Other" instead of "Music" because I deleted the file. I assume it took a while, maybe 15 minutes, to sync again because it was reading through my music already on the iPod and having to rebuild the database.


If it matters, I have:

Windows 7 x64

iTunes 10.7 x64 (I don't use version 11 due to removal of artist grid view)

iPod Touch 3rd Gen. 64GB


EDIT: Oh, my database file was 54MB initially. The rebuilt file is 11MB. I still don't see why we have to do this manually. Seems like rebuilding this file should be a part of the resync process or something. Or maybe put a troubleshooting section in iTunes and you can choose to have it do this vs having to use 3rd party software to do it. That would require Apple to admit there is a problem though.


Message was edited by: 1gnotus

Dec 1, 2013 4:39 AM in response to GeekDad3

Thanks for the try. However it happened again after 2 days. I keep my music on the external drive, so i dont have the songs in iTunes library. After deleting the corrupted file I put those songs again on my iPhone, that tried to change some artworks aaaand ... it happened again. about 500 files gone.
co za jebane gówno z tego iPhone'a

Mar 16, 2014 3:46 PM in response to GeekDad3

I have an iPad mini and an iPhone 5s which both seem to suffer from corrupted iTunes libraries - when sync'ed with my Windows 7 laptop, they would corrupt the song ratings (grrr!), add duplicate/ghost playlists that I couldn't get rid of, among other nicieties...


Both devices are now running iOS 7.1 and I have the latest iTunes (11.1.5); though this has been through a series of updates.


I don't have iTunes match but I often buy music on either of the three devices and then sync it to the others, typically over-the-air. Not sure if that's what's causing the issues. Oh and I also foolishly tried iTunes WiFi sync, which never seems to work reliably so I'm now disabling that once and for all.


I didn't want to fully wipe out my devices; just rebuild the iTunes libraries on them, based on the instructions found on this thread and here.


For the record, the following procedure worked for me:

0) Take a backup of the iTunes library on the PC, in case sync attempts re-corrupt it (happened a couple of times so it was nice being able to start afresh).

1) On iPad/iPhone, go to Settings->General->Usage->Music; tap edit and delete all music

2) Downloaded the excellent (and free) PhoneBrowse (this doesn't require a jailbreak)

3) I ended up exporting most of the iTunes_Control/iTunes content away from my iOS device onto my laptop (as a safety) then ensured it was wiped out from the device. Repeated with all the folders mentioned on the aforementioned post.

4) Logged off from my iTunes account on the iPad/iPhone

5) Rebooted them

6) Deleted the local iTunes backups on my PC - until I did this, before even sync'ing, I could navigate to the "on this iPad/iPhone" tab in iTunes and still see the corrupted playlists and songs with the wrong ratings there (despite having deleted all the music at step 1 - barmy). You might be better off moving them somewhere rather than deleting.


This did the trick, finally, all my 8,000 songs are being resync'ed to my iPad (will try the iPhone next). This obviously takes time but I hope it will remain uncorrupted for a while now!


Apple prides itself in easy to use software... This is everything but. The number of years this iTunes sync stuff has basically been broken is a show of complacency one wouldn't normally expect from Apple...

Sep 22, 2014 2:58 PM in response to BiggerMac

omg this finally worked for me! I can't tell you how many different tips tricks hacks I have tried to resolve this issue! I had given up on my iPhone 5s but once I got my 128 gb iPhone 6 I wanted my entire library on there! Finally the counts are accurate. the number of songs in my library matches the number of songs in my phone. Brilliant! Thank you!

Oct 13, 2014 7:55 AM in response to GeekDad3

While this solution does work, and is perhaps easier than some others, on my iPhone 4S under iOS 8.0.2, working from a Mac, it didn't just rebuild the SQL database but also forced iTunes to recopy all of my 5900+ songs to my iPhone. (Which makes this solution equivalent to others involving removing all songs, then restoring them.) Not sure if others also had this experience.


Recopying all those songs takes many hours, so don't try this at a time when you'll need the phone. And it will go faster with a USB connection.

Oct 25, 2014 4:57 PM in response to GeekDad3

Thanks this worked for me as well 🙂


I just received my new iPhone 6 which I promptly restored from a backup of my iPhone 4S. However all my Music was messed up, the files where in there twice, one that was playable and one which had a red circle with a dot to the right of it. All my play lists seemed to be linked to the files with circles beside them and when trying to play a playlist, all the songs just flashed by very quickly as if it was trying to play zero length songs.. and then Music crashed and I had to hard quit the app on the iPhone. I used iTunes to remove all the songs but this only removed the playable copies and left all the songs with the red circles beside them.


I used the free PhoneBrowse for Windows to go into and renamed the three files in iTunes_Control/iTunes named MediaLibrary.sqllitedb... I also renamed the Artwork folder found in this same directory. Hard reset the iPhone (hold down both buttons) and now my Music is working normally, there are no songs in it, and my purchases are available to download form the cloud.


Now just have to resync all my music from iTunes back to the iPhone but that's the easy part...

Oct 26, 2014 3:36 AM in response to GeekDad3

I'm not sure if everyone is accurately describing what they did here. I tried following the original instructions to the letter and it didn't work. When I thought about it, after following the instructions and restoring after the delete, it's perfectly logical that the problem remains.


For the benefit of customer.4879361, here is what I did and it worked for me:


1. Back up phone!! ;-) Ideally, save the backup on a stick or external drive to be super safe.

2. Rename the files mentioned. I deleted them to be honest as I felt so safe having the backup on a stick that I was bit more gung-ho.

3. SYNC (don't restore) phone. Do not put into recovery mode, just eject the phone, quit whatever you were using to explore the files on it, leave it on, unplug it and then plug it back in so iTunes can sync it.

4. It will take a while (for me a long while) for the sync to even actually start transferring files. Be patient. Mine got there eventually... then you have to be more patient while the files copy...


...then you have to patient while the phone catches up! I noticed that the spinning circular arrow sync symbol on the phone kept spinning for quite a while (over an hour, maybe closer to two) after iTunes said it had finished the sync. I left mine plugged in and waited until the symbol stopped spinning and eventually it stopped and all was well. While the symbol on the phone was still spinning, it appeared that not everything was on the phone but I think it was just that iTunes had "dumped" everything on the phone more quickly than the phone could handle and that it took the phone a while to catch up and process what it had been fed and to organise it correctly.


All in all, this process took me most of a day. I was lucky in that I was working from home for the day so I did it while I was doing something else and just checked in on it every now and again. It's not a fun process, but it has worked for me and the problem hasn't occurred at all since.


On a side note, I was syncing an iPhone 6 Plus on a USB3 connection so I'm not sure if things might take longer on older phones or their might be less or more of a delay depending on phone/iPad model etc. All I would say is to be patient (potentially very patient) with both iTunes and the spinning sync symbol. When I sync now the symbol disappears when iTunes finishes most of the time. I've copied a couple films or larger files across since the first time and I do get the symbol on the phone after iTunes finishes for a couple of minutes sometimes but, personally, I don't see that as a problem... or even know if it's completely normal, to be honest.


Anyway, back to the conceptual process... Restoring your phone directly after deleting the files as outlined in the OP's instructions indicated will do nothing more than restoring the files you just deleted, thereby restoring the problem you were trying to resolve in the first place.


I hope this works for you with the sync instead of restore option. I know how frustrating this problem is and it's such a relief to have it resolved and a normally syncing phone again.


Good luck.

Resolution Steps: iPhone, iPad or iPod Touch library corrupted and showing ghost entries which will not play or music that is on the device in iTunes but inaccessible.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.