Locked Library.itl iTunes.itl file when Opening iTunes

email me

Solution 1

This usually happens because, somehow the iTunes Library.itl file got set as read only. You can fix this by doing the following steps:

1. Open the My Documents folder.

2. Open the My Music folder.

3. Open the iTunes folder

4. Right-click the iTunes Library.itl file and select Properties.

5. Uncheck Read-only.

6. If you have a Security tab, select it. Ensure that your account has Full Control permissions to the file. If you don’t have this tab, ignore this step.

7. Click OK.

Now you should be able to start iTunes without the error. If not, your music files may actually be set to where you don’t have proper permissions. Check it with these steps.

1. Navigate to the location where the music files are located. For Windows 7 users, it’s normally in the C:\Users\username\Music\iTunes\iTunes Media folder.

2. Right-click the iTunes Media folder, then select Properties.

3. Ensure that the Hidden and Archive boxes aren’t checked. If you have a permissions tab, check to see that you have it set to “Full Control” and that nothing is set to “Deny”.

 

Solution 2

1. Back up/copy your “locked” iTunes (library files etc).

2. Move “iTunes Library”, “iTunes Library Extras.itdb”, “iTunes Library Genius.itdb” and “iTunes Music Library.xml” out of your “locked” iTunes folder to somewhere safe, you’ll need them again in a sec.

3. Now the only thing in the “locked” iTunes folder will be the “Album Artwork”, “iTunes Music” and “Previous iTunes Libraries” folders.

4. Create a new “blank” iTunes library, (hold option as you launch iTunes). Select “create library”. Make a new iTunes library elsewhere on your drive. Quit iTunes. You now have a blank iTunes with blank “iTunes Library”, “iTunes Library Extras.itdb”, “iTunes Library Genius.itdb” and “iTunes Music Library.xml” folders which you can put in a folder called “blank”. Keep this in your “Previous iTunes Libraries” folder for when this problem comes around again (which it will).

5. Copy all these blank iTunes files from the “blank” folder into your “locked” iTunes folder.

6. Start iTunes (option-launch to reselect your “locked” iTunes folder). It opens up empty. Quit iTunes.

7. Delete the new “blank” files from the “locked” iTunes folder.

8. Copy your old files from your back up folder, into your “locked” iTunes folder.

9. Start iTunes again. Everything should be back to normal!

 

Code Snippet

This is part of the code I used to automate this process.

strComputer = “.”

Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
Set objRegistry=GetObject(“winmgmts:\\” & strComputer & “\root\default:StdRegProv”)
strKeyPath = “SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\ProfileList”
objRegistry.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys
For Each objSubkey In arrSubkeys
on error resume next
strValueName = “ProfileImagePath”
strSubPath = strKeyPath & “\” & objSubkey
objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue
Const POPUP_TITLE = “User To SID Conversion”
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
Set objAccount = objWMIService.Get(“Win32_SID.SID='” & objSubkey & “‘”)
strUser = objAccount.AccountName
‘strDomain = objAccount.ReferencedDomainName’returns referenced domain

‘DISPLAY PROFILE NAME & SID
objSubkey = trim(objSubkey)’trims whitespace
strUser = trim(strUser)’trims whitespace
‘msgbox “objSubkey: ” & objSubkey’returns SID
‘msgbox strUser’returns username

‘LOGIC TO DETERMINE IF REGISTRY ACCOUNT IS TO BE LOADED
if strUser = “SYSTEM” then strUser=””
if strUser = “LOCAL SERVICE” then strUser=””
if strUser = “NETWORK SERVICE” then strUser=””
‘if strUser = “ADMINISTRATOR” then strUser=””

if strUser <> “” then
on error resume next

‘prevents the library.itl error from appearing
objShell.Run “%comspec% /c del /q ” & chr(34) & “C:\users\” & strUser & “\Music\iTunes\iTunes Library.itl” & chr(34),0,false