New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nix doctor: add command #2394
nix doctor: add command #2394
Conversation
Inspired by the homebrew command, shows a combination of debugging information and warnings with potential issues with a nix installation.
A protocol mismatch can sometimes cause problems when using specific features with an older daemon. For example: Nix 2.0 changed the way files are compied to the store. The daemon is backwards compatible and can still handle older clients, however a 1.11 nix-daemon isn't forwards compatible.
The serve protocol used by LegacySSHStore has a different major and shouldn't be compared to PROTOCOL_VERSION.
It's pretty easy to unintentionally install a second version of nix into the user profile when using a daemon install. In this case it looks like nix was upgraded while the nix-daemon is probably still unning an older version.
In most cases profiles that are in PATH should have a gcroot.
Maybe provide a way to fix these, too? |
I didn't spend a lot of time on the error messages, they can definitively be improved. But I'm not sure if moving the all the |
Not all store types LegacySSHStore support these operations and it doesn't really make sense to check those.
src/nix/doctor.cc
Outdated
bool found = false; | ||
for (auto & i : roots) | ||
if (referrers.find(i.second) != referrers.end()) | ||
found = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better way to do this? It's slow and can trigger gc unrelated messages.
This is awesome. As the go-to person for "dude my Nix is broken halp" at my company, this will be a godsend for me 😄 |
Anything else you can think of that would be low hanging fruit to include here? |
Not sure how best to implement it, but some way to determine if |
Would it make sense to merge this with |
This is great!! Not sure it should stall on implementing all fixes we can think of, but of course it'd be great to add more as we can. Thoughts from @NixOS/nix-core ? |
Calculating roots seems significantly slower on darwin compared to linux. Checking for /profile/ links could show some false positives but should still catch most issues.
I was thinking of adding some more stuff first, but I guess there's no reason to wait. Especially if this could be included in 2.1 (client only changes). I reimplemented the profile check to use similar logic as upgrade-nix to detect normal profiles, fixing my main annoyance with it. |
Merge? |
This command performs a bunch of sanity checks on the nix installation, most of these are not necceceraly a problem but can be very useful when debugging an issue. Most notably a way to detect worker/serve protocol mismatches in various conditions. This also works in combination with
--store ssh://host
to help debug eg. nix-copy-closure issues like #2383.TODO: also include the details
nix-info
generates?The code probably also needs a bit of cleanup.