MacOS – OS X is repeatedly asking for login keychain password

keychainmacospasswordSecurity

I know this has been asked here several times, but I already checked the other discussions and tried their suggestions, but without success.
Is there anything I can do instead of re-installing the complete system?

When certain applications want to access the keychain, I am getting asked for the "login" keychain password repeatedly and never-ending, even though I type in the correct password.

I already tried the following, separate from each other:

  • Keychain Access > Preferences > Reset my default key chain
  • reset the password (new password = old password) of the login keychain
  • Deleting the ~/Library/Keychains/XYZ... folder (as suggested here: https://apple.stackexchange.com/a/148437/5924)
  • restarted several times

Now I wanted to simply grant access to all applications to certain keychains, but when wanting to save the changes, I have the same as the original issue: I get asked for the login keychain password, which never gets accepted.
I am definitely typing the correct password, I can even lock and unlock the keychain with it without problems. Or even reset the password. It just won't help.
(And in case it matters: the "login" keychain password is the same that I use for my user account.)

Here is the screencast video: https://www.dropbox.com/home/Public?preview=video3.m4v

[enter image description here]

(I'm on El Capitan, the Keychain Access is Version 9.0 (55171.20.2))

Related discussions, but none of them helped:

===UPDATE===

I just came across this thread: Keychain does not show passwords after El Capitan upgrade

and indeed, this is also the message I am getting in the /var/log/system.log:

SecurityAgent[877]: Ignoring user action since the dialog has received events from an untrusted source 

but I am already using a real mouse (Magic Mouse) and/or the built-in touchpad of my Mac, so the proposed solution there does not help much:

So a solution to this problem is to use a physical mouse to interact
with the Keychain.

(By the way: I have all recent updates installed that I got auto-notified about via App Store.)

What's also interesting, looking at the system.log: it shows a lot of these lines quite frequentely, without any user interaction and every few seconds:

secd[292]:  __SOSCCProcessSyncWithAllPeers_Server_block_invoke sync with all peers failed: Error Domain=com.apple.security.sos.error Code=1032 "peer: UQl/Oz6WIs//dOl3o8fSLDAa2p not found" UserInfo={NSDescription=peer: UQl/Oz6WIs//dOl3o8fSLDAa2p not found}
Mar 21 22:40:04 mln-mbp CloudKeychainProxy[344]:  __39-[UbiqitousKVSProxy doSyncWithAllPeers]_block_invoke_2 <UB--s--C---> syncWithAllPeers (null), rescheduling timer

(Now I just removed the keychain from being stored on iCloud and the error in the log stopped.)

Best Answer

I had exactly the same problem with Lync messenger - request to enter a keychain password, over and over again, even though password was the correct one. Tried numerous suggestions, nothing worked. Until I found this one:

  • go to the folder userid/Library/Keychains
  • look for a key with the file name from the password request window
  • delete this file (only this one!)
  • try again your app - password is accepted now

Somehow this key was not shown in Keychain Access, like it does not exist. But actual key file was present in keychain folder.

Seems to be some bug in macOS (I am on Sierra) when it can't see key-file, and then another bug - system tries to create a new key-file, but file operation fails (file already exists there). I would suggest to the apple devs to add a proper exception handling there, but I am satisfied for now - problem fixed.