Hello, I’m having same issue as this user had few months ago.
This morning I woke my laptop from sleep, my screen locker (swaylock) didn’t allow any input (this has happened to me before), so I pressed the shutdown button (not holding it), the laptop shut down gracefully, but after booting, all my nix commands started throwing segfault, eg.:
$ nix --version
zsh: segmentation fault (core dumped) nix --version
I have no idea what to do, I booted into live ISO, ran fsck (no errors reported), mounted my drives, ran nixos-install (no error, it installed just fine) but even that did not help.
Right now I wiped my root partition and completely reinstalled nix, hoping it was somehow a corruption in the store, but the result is still the same.
What’s weird is that in the live ISO, if I mount my drives & nix-enter
, all of the nix commands work perfectly…
1 Like
Have you tried verifying the store to see if anything’s corrupted?
The nix-store --verify
command also segfaults.
I’ve tried verify in the installer and everything seemed fine. I managed to get a solution from someone over at matrix, the problem was lqx kernel. Switching to regular kernel fixed my problem.
opened 02:12AM - 09 Jan 24 UTC
closed 05:58AM - 07 Mar 24 UTC
bug
**Describe the bug**
Currently neither `nix-daemon` nor any other nix-based c… ommands work in my machine if they are inside a systemd service.
They all fail with a SIGSEV which apparently happens in `getMaxCPU`.
**Steps To Reproduce**
I am not sure how to reproduce yet, however this is my current configuration: https://github.com/GGG-KILLER/nixos-configs (the machine that is experiencing this issues is located in `hosts/sora`).
**Expected behavior**
All commands and services work normally without any errors.
**`nix-env --version` output**
```console
$ nix-env --version
nix-env (Nix) 2.18.1
```
This also happens on 2.19:
```console
$ nix-env --version
nix-env (Nix) 2.19.2
```
**Additional context**
```console
$ coredumpctl info 1523
PID: 1523 (nix-build)
UID: 1000 (ggg)
GID: 100 (users)
Signal: 11 (SEGV)
Timestamp: Mon 2024-01-08 22:22:48 -03 (43min ago)
Command Line: nix-build --expr {} --no-out-link
Executable: /nix/store/p1l4j192w1abk7mmkg60qmvc18svhky4-nix-2.18.1/bin/nix
Control Group: /system.slice/home-manager-ggg.service
Unit: home-manager-ggg.service
Slice: system.slice
Boot ID: 8f993118458b45e7a131b370551e7c40
Machine ID: d234abf9bd5f42c8a488e0bf5005433f
Hostname: sora
Storage: /var/lib/systemd/coredump/core.nix-build.1000.8f993118458b45e7a131b370551e7c40.1523.1704763368000000.zst (present)
Size on Disk: 453.0K
Message: Process 1523 (nix-build) of user 1000 dumped core.
Module libattr.so.1 without build-id.
Module libkeyutils.so.1 without build-id.
Module libkrb5support.so.0 without build-id.
Module libcom_err.so.3 without build-id.
Module libk5crypto.so.3 without build-id.
Module libkrb5.so.3 without build-id.
Module libunistring.so.5 without build-id.
Module libxml2.so.2 without build-id.
Module libbz2.so.1 without build-id.
Module liblzma.so.5 without build-id.
Module libacl.so.1 without build-id.
Module libbrotlicommon.so.1 without build-id.
Module libaws-c-common.so.1 without build-id.
Module libaws-checksums.so.1.0.0 without build-id.
Module libaws-c-sdkutils.so.1.0.0 without build-id.
Module libaws-c-cal.so.1.0.0 without build-id.
Module libaws-c-compression.so.1.0.0 without build-id.
Module libs2n.so.1 without build-id.
Module libaws-c-io.so.1.0.0 without build-id.
Module libaws-c-http.so.1.0.0 without build-id.
Module libaws-c-auth.so.1.0.0 without build-id.
Module libaws-c-s3.so.0unstable without build-id.
Module libaws-c-event-stream.so.1.0.0 without build-id.
Module libaws-c-mqtt.so.1.0.0 without build-id.
Module libzstd.so.1 without build-id.
Module libgssapi_krb5.so.2 without build-id.
Module libssh2.so.1 without build-id.
Module libidn2.so.0 without build-id.
Module libnghttp2.so.14 without build-id.
Module libz.so.1 without build-id.
Module libcpuid.so.16 without build-id.
Module libarchive.so.13 without build-id.
Module libbrotlidec.so.1 without build-id.
Module libbrotlienc.so.1 without build-id.
Module libseccomp.so.2 without build-id.
Module libaws-crt-cpp.so without build-id.
Module libaws-cpp-sdk-core.so without build-id.
Module libaws-cpp-sdk-s3.so without build-id.
Module libaws-cpp-sdk-transfer.so without build-id.
Module libboost_context.so.1.81.0 without build-id.
Module libgcc_s.so.1 without build-id.
Module libstdc++.so.6 without build-id.
Module liblowdown.so.1 without build-id.
Module libeditline.so.1 without build-id.
Stack trace of thread 1523:
#0 0x00007f563ccf9734 _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1ERKS4_ (libnixutil.so + 0x48734)
#1 0x00007f563cd5570e _ZN3nix9getMaxCPUEv (libnixutil.so + 0xa470e)
#2 0x00007f563cefd47d _ZN3nix8Settings15getDefaultCoresEv (libnixstore.so + 0x15d47d)
#3 0x00007f563cf007bd _ZN3nix8SettingsC2Ev (libnixstore.so + 0x1607bd)
#4 0x00007f563ce520b1 _sub_I_65535_0.0 (libnixstore.so + 0xb20b1)
#5 0x00007f563d4efebe call_init (ld-linux-x86-64.so.2 + 0x4ebe)
#6 0x00007f563d4effac _dl_init (ld-linux-x86-64.so.2 + 0x4fac)
#7 0x00007f563d505f50 _dl_start_user (ld-linux-x86-64.so.2 + 0x1af50)
ELF object binary architecture: AMD x86-64
```
**Priorities**
Add :+1: to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).
2 Likes
This happened to me too lately, for the second time. Last time (about a year ago) I believe it was also the lqx kernel. It seems a bit funky that a kernel can cause this kind of issue, and even more funky that only(???) nix
is affected? (Could that mean that it’s still a bug in nix
(e.g. a race condition or similar) that only manifests itself for certain kernel “optimisations”?)
1 Like