Cargo installed packages list randomly resets


I've been using the cargo-update subcommand to update installed binaries for a long time, today after checking for updates with cargo-update I noticed that the only package checked for updates was topgrade, but over the years I've installed many others binaries with cargo, indeed my .cargo/bin folder contains many others packages, but cargo install --list only shows one package, is there any reason why this could be happening or it could be a bug to report?

Could it be possible you changed the CARGO_HOME environment variable?

Not that I'm aware of, I never set CARGO_HOME explicitly

Do you have an old version of cargo-update? Cargo has switched from git registries to sparse index, and old tooling may be looking at the git checkout that doesn't get updated any more.

Try rm -rf ~/.cargo/registry/

I have the latest version of cargo-update cargo-install-update 13.0.4, I tried to remove the registry folder but cargo still see just one package.

Sounds like cargo-update is broken. I just have a one-liner for listing all the packages:

cargo install --list | rg '^[\w-]+' -o

And then I give each of those to cargo install.

I don't think is a cargo-update issue, cargo list itself list only a package so your script only list that.

cargo keeps information about installed crates in ~/.cargo/.crates.toml and ~/.cargo/.crates2.json.
So if cargo install --list isn't telling you anything anymore, then most likely these files have been modified. You should try figure out what touches them.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.