Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#75773 - [nix] Segmentation fault (core dumped)

Attached to Project: Community Packages
Opened by Kevin Maris (kmaris) - Thursday, 01 September 2022, 17:44 GMT
Last edited by Toolybird (Toolybird) - Friday, 02 September 2022, 21:28 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

I am getting segmentation faults from nix.

Additional info:
* nix 2.11.0-1
* Linux <hostname> 5.19.5-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 29 Aug 2022 15:51:05 +0000 x86_64 GNU/Linux

Steps to reproduce:

# Install nix
$ pacman -S nix
$ usermod -a -G nix-users $USER

# Logout and login... make sure nix-users is in your groups
$ groups
... nix-users ...

# Start nix-daemon
$ sudo systemctl start nix-daemon.service

# Update nix packages
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
$ nix-channel --update

# Install `hello` and try to use it, same steps as the wiki entry
# (The behavior is the same between zsh and bash shells)
$ nix-env -iA nixpkgs.hello
installing 'hello-2.12.1'
these 4 paths will be fetched (6.78 MiB download, 31.19 MiB unpacked):
/nix/store/6f66prpgx1qx4n6k450sxs3d157ia1ps-glibc-2.35-163
/nix/store/g7lwga9p547cqyi9ym35bk78m1r12rky-libunistring-1.0
/nix/store/jna5qh81395w6xsalnl532pm9qvvvpjy-libidn2-2.3.2
/nix/store/mg35qkhk7wqbhhykpakds4fsm1riy8ga-hello-2.12.1
copying path '/nix/store/g7lwga9p547cqyi9ym35bk78m1r12rky-libunistring-1.0' from 'https://cache.nixos.org'...
copying path '/nix/store/jna5qh81395w6xsalnl532pm9qvvvpjy-libidn2-2.3.2' from 'https://cache.nixos.org'...
copying path '/nix/store/6f66prpgx1qx4n6k450sxs3d157ia1ps-glibc-2.35-163' from 'https://cache.nixos.org'...
copying path '/nix/store/mg35qkhk7wqbhhykpakds4fsm1riy8ga-hello-2.12.1' from 'https://cache.nixos.org'...
building '/nix/store/6s3wspdk7ww0p9r4g35f3cyybfsg99n3-user-environment.drv'...
$ nix-env -q # confirms `hello` is installed
$ hello
zsh: segmentation fault (core dumped) hello

# An uninstall works...
$ nix-env --uninstall hello
uninstalling 'hello-2.12.1'
building '/nix/store/xsk9wjy0dpp7w7d3r3bkzxzaklqdzq6q-user-environment.drv'..
$ nix-env -q # will show empty output.
This task depends upon

Closed by  Toolybird (Toolybird)
Friday, 02 September 2022, 21:28 GMT
Reason for closing:  Not a bug
Additional comments about closing:  See comments
Comment by Toolybird (Toolybird) - Thursday, 01 September 2022, 22:06 GMT
> core dumped

Which process is crashing? (look at the output of coredumpctl). Can you somehow compile with debug and get a trace [1]? IIUC this is downloading third party compiled pkgs from nixos.org?

[1] https://wiki.archlinux.org/title/Debugging/Getting_traces
Comment by Kevin Maris (kmaris) - Thursday, 01 September 2022, 23:04 GMT
Apologies for the bad ticket formatting, this is my first one. Thanks for the `coredumpctl` info, I've pasted the most recent below. I'll look into compiling/debugging nix as the "convenient" options mentioned in the wiki aren't available to the community nix package in the next day or two.

❯ coredumpctl info 1654501
PID: 1654501 (hello)
UID: 1000 (kmaris)
GID: 1000 (kmaris)
Signal: 11 (SEGV)
Timestamp: Thu 2022-09-01 16:42:17 MDT (3min 18s ago)
Command Line: hello
Executable: /nix/store/mg35qkhk7wqbhhykpakds4fsm1riy8ga-hello-2.12.1/bin/hello
Control Group: /user.slice/user-1000.slice/session-3.scope
Unit: session-3.scope
Slice: user-1000.slice
Session: 3
Owner UID: 1000 (kmaris)
Boot ID: ef03d430c8b94460b9b45fd7163946a3
Machine ID: a69ecfd28b844a5c8c4ff1846ab0a37c
Hostname: <hostname>
Storage: /var/lib/systemd/coredump/core.hello.1000.ef03d430c8b94460b9b45fd7163946a3.1654501.1662072137000000.zst (present)
Disk Size: 17.9K
Message: Process 1654501 (hello) of user 1000 dumped core.

Module linux-vdso.so.1 with build-id 1cc50ac83e08b09068653c5a2c163bc7c266cdaa
Module ld-linux-x86-64.so.2 with build-id 5fc82d34f4b3f2404903a583cb1189b544ffd180
Module libc.so.6 with build-id 9c28cfc869012ebbd43cdb0f1eebcd14e1b8bdd8
Module hello without build-id.
Stack trace of thread 1654501:
#0 0x00007f67f921ba06 __ctype_init (libc.so.6 + 0x31a06)
#1 0x00007f67f933aa10 __libc_early_init (libc.so.6 + 0x150a10)
#2 0x00007f67f93f3f9b dl_main (ld-linux-x86-64.so.2 + 0x20f9b)
#3 0x00007f67f93ef966 _dl_sysdep_start (ld-linux-x86-64.so.2 + 0x1c966)
#4 0x00007f67f93f1525 _dl_start (ld-linux-x86-64.so.2 + 0x1e525)
#5 0x00007f67f93f0308 _start (ld-linux-x86-64.so.2 + 0x1d308)
ELF object binary architecture: AMD x86-64


It's the same behavior with a different packages, here is cowsay for example:

❯ coredumpctl info 1663329
PID: 1663329 (cowsay)
UID: 1000 (kmaris)
GID: 1000 (kmaris)
Signal: 11 (SEGV)
Timestamp: Thu 2022-09-01 17:02:07 MDT (24s ago)
Command Line: /nix/store/iiy452z89fpj7ky0i8fls6kh41k8qcg8-perl-5.36.0/bin/perl /home/kmaris/.nix-profile/bin/cowsay hi there
Executable: /nix/store/iiy452z89fpj7ky0i8fls6kh41k8qcg8-perl-5.36.0/bin/perl
Control Group: /user.slice/user-1000.slice/session-3.scope
Unit: session-3.scope
Slice: user-1000.slice
Session: 3
Owner UID: 1000 (kmaris)
Boot ID: ef03d430c8b94460b9b45fd7163946a3
Machine ID: a69ecfd28b844a5c8c4ff1846ab0a37c
Hostname: <hostname>
Storage: /var/lib/systemd/coredump/core.cowsay.1000.ef03d430c8b94460b9b45fd7163946a3.1663329.1662073327000000.zst (present)
Disk Size: 49.6K
Message: Process 1663329 (cowsay) of user 1000 dumped core.

Module linux-vdso.so.1 with build-id 1cc50ac83e08b09068653c5a2c163bc7c266cdaa
Module ld-linux-x86-64.so.2 with build-id 5fc82d34f4b3f2404903a583cb1189b544ffd180
Module libc.so.6 with build-id 9c28cfc869012ebbd43cdb0f1eebcd14e1b8bdd8
Module libutil.so.1 with build-id 3d206534bac5936fca5f2b66cc035b01aef2c9b7
Module libcrypt.so.1 with build-id f69d34e38d1e5d56c65758d1c39be1c7fd5d63e6
Module libm.so.6 with build-id 0b8d43ea2dae21a1c5e44c3f0a9dc2fb292d27c0
Module libdl.so.2 with build-id 3b5b9c7c3efd20001319657d1972e90e853984e2
Module libpthread.so.0 with build-id 135923f9a38592e2e90692c8191278a166f86569
Module libperl.so without build-id.
Module perl without build-id.
Stack trace of thread 1663329:
#0 0x00007fc2b884aa06 __ctype_init (libc.so.6 + 0x31a06)
#1 0x00007fc2b8969a10 __libc_early_init (libc.so.6 + 0x150a10)
#2 0x00007fc2b8f24f9b dl_main (ld-linux-x86-64.so.2 + 0x20f9b)
#3 0x00007fc2b8f20966 _dl_sysdep_start (ld-linux-x86-64.so.2 + 0x1c966)
#4 0x00007fc2b8f22525 _dl_start (ld-linux-x86-64.so.2 + 0x1e525)
#5 0x00007fc2b8f21308 _start (ld-linux-x86-64.so.2 + 0x1d308)
ELF object binary architecture: AMD x86-64
Comment by Kevin Maris (kmaris) - Friday, 02 September 2022, 13:21 GMT
I went ahead and file an issue on the nix github: https://github.com/NixOS/nix/issues/6992
Comment by Kevin Maris (kmaris) - Friday, 02 September 2022, 13:57 GMT
Thanks to input from the nix issue, turns out it was my fault and LD_LIBRARY_PATH being set in /etc/environment:

LD_LIBRARY_PATH="/usr/lib;/usr/lib64;/usr/lib32"

Unsetting or commenting out that line fixes the issue. I think that resolves this issue, thank you for taking a look Tooly :)

Loading...