`nix-daemon.service` won't start, but `sudo nix-daemon` works

Just updated my system today, and I get these errors in journalctl:

May 27 18:54:25 ZENIX systemd[1]: nix-daemon.service: Main process exited, code=dumped, status=11/SEGV
May 27 18:54:25 ZENIX systemd[1]: nix-daemon.service: Failed with result 'core-dump'.

And of course nix is not functional without a daemon running in background. Apparently, running sudo nix-daemon --daemon works.

linking this in case someone sees it later: this was resolved on Can't update my system due to a weird bug with `systemd-boot-builder.py` · Issue #315547 · NixOS/nixpkgs · GitHub

The bug here is that linux-zen (or maybe it was another kernel) puts some funny things in the max CPU file, Nix reads it, splits it, then has no bounds check and reads out of bounds. I fixed this bug in Lix a couple months ago, backported it to CppNix, and idunno it’s probably fixed on the Nix 2.22 branch, but isn’t backported to 2.18. The easiest immediate solution to this problem is to run Lix, which has essentially no downsides (it being pink is an upside :stuck_out_tongue: ).

Fix PR: fix: bounds check result in getMaxCPU by lf- · Pull Request #10172 · NixOS/nix · GitHub

3 Likes