Most nix commands crashes all user sessions

On my new Nixos installation most nix commands lead to all user sessions to crash. By user session I mean all ssh session as well as local shell and graphical system crash. Sadly journalctl does not contain any information other than the sessions being closed. All ideas are welcome.

How much RAM do you have and what Nix commands you are trying to use? E.g. nix-env -i or nix-env -u will cause OOM on a wide range of machines…

oh, right a little more detail. Commands that crash:

  • nix build
  • nix test
  • nix develop
  • nixos-rebuild switch

RAM amount? Does it crash immediately or after a bit of time? Do sessions respawn succesfully? Is there anything fresh in dmesg output after a crash (if the sessions do respawn)? Does the typical thermal situation look safe or close to the edge?

The machine has 32Gb of ram. It crashes after downloading files. For the sessions: ssh sessions are disconnected but I can reconnect immediately, the ttys give me a login, the graphical sessions fall back to login.
Right now I am experimenting with a working config of another machine on the failing one. That config is working on this machine as well. I will work my way slowly to the config that I need and see where it is starts failing.

1 Like

Good that you have some config that does work on that hardware!

Sorry if the suggestion is trivial, but it’s easy to happen to need it: you say «work my way slowly», but most of the time bisection — changing half of the stuff still under suspicion — is a faster way to find at least one minimum triggering change.

ok, I narrowed to down to the username. As soon I use anything else than “oni” it breaks. By now I removed all instances of “oni” from the config, but still the it breaks.

Ouch. I guess I would try creating a test VT login session (so that nothing happens in it by default), attach strace with output to file from another VT session, and see whether strace succeeds to write down the signal received… but mysterious for sure

Another interesting observation: running nix as root will not kill roots shell but still the users shell.
I am pretty much out of ideas by now

1 Like

Hmmm, but this means you can run strace from a root session attaching to an inactive user session, and see whether anything at all (a signal?) happens to it?

Also, what happens if you create a second user and have sessions for both users open?

ok I found the problem, all session of users that are in the ‘nixbld’ group are killed.