Cargo - index is locked


#1

I killed a cargo process after spawning it by mistake. Now, Cargo has been refusing to update the index.

[10/-14] The index is locked. This might be due to a concurrent or crashed process

Sidenotes:

  • I have a multirust setup.
  • I’m running Rust 1.7.0

PS: I’m posting this (along with the answer) for anyone else who has the same issue.


#2

Cargo was killed while the registry was being updated, the git-repository index was locked. Thus, the registry is now in an invalid state.

The only way to solve this is to delete the registry and start fresh.

For multirust, this will be in ~/.multirust/toolchains/stable/cargo/registry if you use the stable version. Deleting that folder should fix this issue.