I added a dependency to a rust project, then ran cargo run, this gave me this error:
"Blocking waiting for file lock on package cache"
I tried the solution I found online which was to delete the ~/.cargo/.package-cache file, however this has not worked for me. When I type commands like cargo run and cargo update I just get the same message. Now even when I go to another rust project with no dependencies, and try to run it, I get the same "Blocking waiting for file lock on package cache" message. I am on a M1 MacBook Pro.
I got the same problem. I am using Linux and this is how to solve it:
Close VS Code so that the the
rust-analyzer extension will not be able restart
Use a resource monitoring tool (i use btop) and search for
rustc. Click on the process and then press
enter to kill them on by one.
cargo r again and it should work fine without displaying
"Blocking waiting for file lock on package cache".
I still do not know how to prevent VS Code from automatically starting the download of the packages. If you can block VS Code from auto download and instead download the packages manually when invoking
cargo r, you can stop the process by pressing
ctrl+c and thus stop the download if you have slow internet connection at that time for example.