-
-
Notifications
You must be signed in to change notification settings - Fork 461
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
After building with flakes, git is always failing during darwin-rebuild switch #693
Comments
Which git is being found on the machine and what architecture is it and what architecture is the machine? |
The broken machine is |
For what it's worth this appears to have been the lack of |
Sorry, it has started happening again, |
Unfortunate updately, this issue has now spread to a second machine… |
This is very strange, but I can't imagine it's not an upstream Nix bug. Perhaps the Nix version changes on activation (Nixpkgs is currently using 2.15 rather than the latest stable Nix release of 2.16)? Do you have the sandbox on (though I don't think that should be relevant for fetching flake inputs)? |
I deleted Everything worked… Quite odd. When I'm back home I'll try that on the other computer and see if it fixes things. |
I find this sometimes - I find a nix flake update seems to fix this sometimes. I think if you are using a flake and it is not correct in some way then it produces this error. |
Thanks for the response. :) The nix version it's using is 2.15.1… if the sandbox is disabled by default then I assume it's not on. I haven't actively turned it on. |
Thanks for the reply @bestlem. What do you mean by "not correct"… the flake builds successfully. It's only the switch that fails when I call |
I can"t quite remember but I think it crashed in nix flake check first but by 'not correct' I don"t know what is wrong and fixed it by doing random things rather then seeing where code is wrong. Given other comments here the cache being messed up seems possible. I do wish you could run nix without it calling git |
Nix really shouldn't be doing this under any circumstances. I would recommend reporting a bug upstream to Nix; presumably the nix-darwin configuration might have something to do with what's going on here, but Git getting randomly killed from underneath Nix isn't something that should be happening regardless of any cache state. |
Unfortunately I found the issue was not reproduceable so can"t form a proper bug report. Thinking more - the thing which crashes is git so not necessarily a nix bug. But I suspect that this is the nix git failing not a build of git made with Apple"s clang |
I have the same issue on an aarch64 machine and it persists despite following some of the steps mentioned above. I would like to contribute to help fixing this - what useful information can I gather whilst in this broken state? |
I don't think I've run into this issue locally, so if someone could link to their dotfiles or an example that reproduces the issue, that would be quite helpful 👍 |
AS i said not reproduceable by me, But in the last few days - get an invalid flake and it fails on nix develop or nix build and uses nix"s git. Run on another machine and it shows the nix error. I mainly get them when trying my configuration in a VM with nothing opther than nix installed. |
Just to clarify re my initial (and ongoing) problem… it's not failing in
Perhaps that flow does another Any tips on what I could use to verify the tree of nix files that make up my environment? I assumed that if they build, they're fine. |
Can you run |
Neat trick. Thanks for the tip. :) The output is:
|
Interesting. So I'm going to assume it's using git from |
It succeeds, outputting some json, and didn't seem to have any errors in the |
Same if you use the same
|
Good point. 🤦♂️ With the same path it fails. Trying to do anything with the git in that path fails… even |
Good that we're narrowing it down! Does |
Trying to do anything with the |
Looks like that |
Yeah, that's the |
I found the issue I think… looking at Crash Reports in the macOS Console app, it looks like the code signature of that
|
Dropbox seems fine; it's very unlikely this is a nix-darwin bug and it might not even be a Nix one, but it'd be interesting to see what happened to the path. |
I have the same git . sha256-CWP84RaMWzv1WP+UDwQ/f9j+v8y5fEMve8dXb4DEjoc= |
A link to the broken version: https://www.dropbox.com/scl/fi/8z3a7qfw7h4fcuoq0b2sn/xw0462wahwywbl751zdrn5b56m3af4zz-git-2.41.0.zip?rlkey=d4z93fycrj49e36jwumkj546l&dl=1 (I'll probably delete this at some point) I wonder if this is related to the auto-optimise-store stuff? I have disabled it in my latest update to see if the issue continues to happen. |
I'm comparing the files and this is very strange indeed. I don't think it's a hardware issue. It might be related to store optimization but it would be a really bizarre bug. I'll report back when I'm slightly less confused. |
@emilazy Thanks for all your help. Not only has it fixed my immediate problem, I learned a lot more "nix foo". Thanks. 🙏 |
I get
|
You need |
Just dumping the results of my investigation from yesterday here for posterity:
This is very strange; it's clearly not random hardware corruption or anything. My best guess is that there is some other derivation that differs only in this way, and maybe it is somehow getting incorrectly substituted or hard-linked. If it is, then presumably Hydra has built a @ryanbooker I'm glad things are working for you now! Do you mind if I archive the broken path somewhere more permanent? This might be something that needs reporting to Nix upstream. It's definitely not a nix-darwin bug, but it's quite concerning all the same. |
Another question is, do you remember if you ever saw Git being built on your machine, and do you have any overlays or other strange things in your nix-darwin configuration that could potentially have overridden the Git package? |
No overlays - I don"t think it was built. |
FYI if you still have this present on an installation you can check the signature of the path to see whether it was substituted.
|
That did not quite work for me
But
|
@emilazy Feel free to archive the broken derivation. I'm using/configuring git via home-manager if that's relevant. @LnL7 I do have another machine where this is currently broken (I haven't gotten around to fixing it yet).
|
The
To be completely correct you should check using the path of git which darwin-rebuild refers to. |
The git path is different on the other broken machine and it doesn't really give a signature…
And the verify has no output
|
Aha! Looks like your Git got built locally, even though I'm guessing you will get different output for this: emily@yuyuko ~> nix hash path /nix/store/k11z2k4iyf3sjfca1vfg935vss9v8y03-git-2.41.0
sha256-ZI4MCiWf0Y66c4nFHoRdFKWWUsjzFuXNikz8Jn8fL+c= Seems we're getting closer to an answer here. Do you need that machine fixed urgently? If you could upload this other broken Git and we see similar differences to the last pair, then it looks like it might be that somehow Git is getting mis-built locally despite being available on Hydra, possibly via the incorrect store optimization route (is store optimization enabled on that machine too?). |
I didn't but I just fixed it while waiting 🤦♂️ I did take a copy of the broken path though. I can upload that for you. Yes it has/had auto-optimise enabled. All the machines are near identical in terms of set up. Only really installed app are different. I could also reset that small change I made to the auto-optimise setting and keep updating each day until it breaks again. It was not difficult to get to happen. Re auto-optimise I do often see errors in linking and have to pass --fallback to the build command. |
An upload would be great! Another thing that might help us figure out if this is store optimization related is to run the following:
where |
A link to the other broken version: https://www.dropbox.com/scl/fi/ywvpnri18uzqxamvc9izm/k11z2k4iyf3sjfca1vfg935vss9v8y03-git-2.41.0.zip?rlkey=ptpog7udnke93n62st72k2aj5&dl=1 I don't see any output looping through the store paths. Is it possible they were cleaned up when I repaired? |
Looks like the same thing is going on here: If all this was caused by store optimization it wouldn't surprise me too much: automatic store optimization is well-known to be flaky on macOS and people tend to turn it off for that reason; this would just be yet another problem with it. However, the snippet I posted giving no results implies that maybe something else is going on here. (I guess it depends on whether store repair overwrites the inodes directly or not; you could maybe try the same with Even if your configuration is somehow resulting in a local build of Git, any differences should result in a change to the hash in the path; it's hard for me to understand how your machine would want an identical Git to the default Nixpkgs one, decide to skip fetching it from the binary cache, and then build it in such a way that paths to other derivations inside are different and the code signature is broken. This is deeply confusing, honestly, so I'm inclined towards an explanation that involves store optimization, especially if turning it off on one machine makes it stop thre but not the other, but it's just a wild guess. It's also possible for a process running as root to tamper with the Nix store, and if it was just the code signature differences maybe I would guess it could be some corporate anti-malware thing or similar, but the referenced store path changes would seem to rule out that explanation too. Does |
I fixed this by running
|
Thanks @johnhamelink. Did you also have |
Indeed I did |
Still baffled by how the derivations could be getting corrupted in the way they seem to be, but it seems like maybe we should try to encourage upstream to warn more strongly against automatic store optimization on macOS until we can figure this out. Did you ever notice |
@emilazy I can't say for sure, as I sat with this issue for a few weeks before I fixed it, but but I think this did happen, yes. |
Closing as duplicate of #484 |
One of my machines has recently started displaying the following error when I try to switch after
nix build
using flakes. It was previously working fine, and two other machines using the same flake set up are working fine.I ran
nix doctor
on all machines, and the failing machine's output is slightly different. The working machines all output the following line about being trusted, the failing machine doesn't output this line:Is this potentially the issue? How do I get the user to be trusted? All machines have exactly the same
/etc/nix/nix.conf
.I'm not sure what I'm looking for, so if anyone has any tips on what to look for or how to get more useful information, that would be greatly appreciated. Thanks.
The text was updated successfully, but these errors were encountered: