NixOS pkgs Brackets

Hello,

I’m using NixOS with home-manager (tried to put in in configuration.nix / home.nix / nix-env -i ).

Tried to install Brackets but get the following error:

brackets

Segmentation fault (core dumped)


the application doesn’t start up (though the icon appears for a second)

I installed it on ubuntu via nix and it works fine why not in NixOS

I’ve just tried it on NixOS and it works. V1.9, nixos revision 029a5de0839

Hello danbst,

nixos nixos-20.03 release nixos-20.03.3330.1db42b7fe38

nix-env -i nixos.brackets
warning: name collision in input Nix expressions, skipping ‘/home/user/.nix-defexpr/channels_root/nixos’

How can I figure out what happened (I guess I did something wrong)?

try

$ nix run -f channel:nixpkgs-unstable brackets -c brackets

Does it work for you or crashes?

nix run -f channel:nixpkgs-unstable brackets -c brackets

[89 copied (528.1 MiB), 131.4 MiB DL]

(process:5149): Gtk-WARNING **: 19:50:53.498: Locale not supported by C library.
        Using the fallback 'C' locale.
Segmentation fault (core dumped)

dmesg
[ 387.248982] Brackets[5149]: segfault at fffffffc020b995c ip 00007fbe8ef098c3 sp 00007ffde9d98bf0 error 5 in libcef.so[7fbe8c067000+442c000]

huh, does this crash too?

$ nix-shell '<nixpkgs>' --pure -p brackets --run brackets

If yes, then you should try 1) strace brackets and notice what are last steps before crash and 2) gdb brackets, run, notice where it crashed and try to diagnose the problematic library

Though I expect it would be painfully fun

nix-shell ‘’ --pure -p brackets --run brackets

these paths will be fetched (0.05 MiB download, 0.28 MiB unpacked):
  /nix/store/wqfv04xz2rpl2326ijghn1f2qgiyplb4-bash-interactive-4.4-p23-dev
copying path '/nix/store/wqfv04xz2rpl2326ijghn1f2qgiyplb4-bash-interactive-4.4-p23-dev' from 'https://cache.nixos.org'...
[0616/203058:ERROR:browser_main_loop.cc(192)] GTK theme error: Unable to locate theme engine in module_path: "adwaita",
[0616/203058:ERROR:sandbox_linux.cc(130)] InitializeSandbox() called with multiple threads in process gpu-process
[0616/203209:ERROR:browser_main_loop.cc(187)] GTK icon error: Could not find the icon 'inode-directory'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
        http://icon-theme.freedesktop.org/releases

this is good news. So --pure disables all environment variables during run, it might one of those is problematic. I bet LD_LIBRARY_PATH or LD_PRELOAD but you should check that yourself

thank you

both are empty in the user/root space

  • how do I could get from the error in the screenshot to the mentioned env-vars?

Where in the nixos doc is a part about setting this variables manually? Why isn’t nixos doing it automatically?

No, I assumed you had those set manually, and those interfered with brackets.

Okay, so your next steps are:

  • run env (regular environment)
  • run nix run -f '<nixpkgs>' -i brackets -c env (pure environment)
  • compare the difference and allow envvars one by one:
$ nix run -f '<nixpkgs>' -i brackets \
   --keep VAR1 --keep VAR2  \
   -c brackets

and figure out which envvar causes segfault

run nix run -f '<nixpkgs>' -i brackets -c env

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "",
        LC_ALL = (unset),
        LANG = "en_DE.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
The program ‘run’ is currently not installed. You can install it by typing:
  nix-env -iA nixos.run

nix run -f '<nixpkgs>' -i brackets -c env
error: unable to exec 'env': No such file or directory

sorry, had to check. Should be

nix-shell '<nixpkgs>' --pure -p brackets --run env

do I understand you correctly that I have to check all vars from user-env one by one to find the one var with causes brackets to crash?

yes, correct. You can do slightly faster by using the manual envvar binary search :wink: Given this is a very common issue, I’d like to have this “environment-git-bisect” as a tool… but we are not there yet

Isn’t the message

Locale not supported by C library.

suspicious?

LANG=en_DE.UTF-8

en and DE is ok, or?

locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_DE.UTF-8
LC_CTYPE=“en_DE.UTF-8”
LC_NUMERIC=“en_DE.UTF-8”
LC_TIME=“en_DE.UTF-8”
LC_COLLATE=“en_DE.UTF-8”
LC_MONETARY=“en_DE.UTF-8”
LC_MESSAGES=“en_DE.UTF-8”
LC_PAPER=“en_DE.UTF-8”
LC_NAME=“en_DE.UTF-8”
LC_ADDRESS=“en_DE.UTF-8”
LC_TELEPHONE=“en_DE.UTF-8”
LC_MEASUREMENT=“en_DE.UTF-8”
LC_IDENTIFICATION=“en_DE.UTF-8”
LC_ALL=

Hello danbst,

sorry but still I would like to get some more hints.

nix-env -i brackets

warning: name collision in input Nix expressions, skipping '/home/ae/.nix-defexpr/channels_root/nixos'
warning: there are multiple derivations named 'brackets-1.9'; using the first one
installing 'brackets-1.9'
building '/nix/store/qq6bx1vfga215xbhq533398hc9x0nfgv-user-environment.drv'...
created 2198 symlinks in user environment

ls -lah $(which brackets )
lrwxrwxrwx 1 root root 69 Jan 1 1970 /home/ae/.nix-profile/bin/brackets -> /nix/store/cf2klajdda4brmlgvrzk275f3lnjgb58-brackets-1.9/bin/brackets

but

/run/current-system/sw/bin/nix run -f '<nixpkgs>' -i brackets --keep COLORFGBG -c brackets

/nix/store/cf2klajdda4brmlgvrzk275f3lnjgb58-brackets-1.9/bin/brackets: line 8: readlink: command not found
/nix/store/cf2klajdda4brmlgvrzk275f3lnjgb58-brackets-1.9/bin/brackets: line 10: dirname: command not found
/nix/store/cf2klajdda4brmlgvrzk275f3lnjgb58-brackets-1.9/bin/brackets: line 20: /Brackets: No such file or directory

which is the same result like without any var kept:
nix run -f '<nixpkgs>' -i brackets -c brackets

Are there env variables which have to be provided or how to unterstand the resulting errors?

Hello danbst,

the result of
strace brackets

recvfrom(3, "SelectionBox.foreground:\t#232627"..., 10012, 0, NULL, NULL) = 10012
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xfffffffc065e7aa4} ---
+++ killed by SIGSEGV (core dumped) +++

How to figure out where I can start - what to look for?


Could the locale error hint to a problem (“locale: Cannot set LC_CTYPE”)?

try also to --keep PATH

thanks for you help

I have issues with the nixos-rebuild switch → that why I cannot get brackets out of configuration.nix
[Nixos-rebuild switch vs build vs boot - NetworkManager-wait-online.service fails)

even that I installed brackets via nix-env

nix-env -q

brackets-1.9
home-manager-path
lighttable-0.8.1
run-0.7.1

sudo brackets

  • lets open brackets with the UTF-8 error (like in the screenshot above) and

[0617/155125:ERROR:sandbox_linux.cc(130)] InitializeSandbox() called with multiple threads in process gpu-process

I tested all vars which are different but allways exit code is 1 → permission denied (-> installed in configuration via root ).

  • How to read out the current configuration of the system (becasue switch is not working and the file is overwritten in /etc/nixos/ )