NixOS pkgs Brackets

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/ )

so, /etc/nixos/configuration.nix is overwritten? Unless you did any backups, you’re in trouble :slight_smile: NixOS doesn’t backup that file for you.

As for your issue - it is more of a warning, not a failed switch. rebuild switch consists of 2 phases - build and activate, and error just says some services were not activated. But it should take brackets out of system-wide installment.

which envvar causes segfault?

fact - brackets is not in the current failed switch configuration but I can open it with sudo brackets.
I cannot see that the switch worked because the is no now generation (and switch -p “name” is not the either)

idenpended of all env-Vars the exitcode is always 1 (but Segmentation fault (core dumped) is ecitcode 139).

if I execute brackets → 139, if I excecute nix run -f '<nixpkgs>' -i brackets --keep PATH -c brackets it is 1 [permission denied]

brackets is not anymore in the current configuration.nix file but as you see, the system has kept it.

  • do I have to garbage collect or so ?

(there are some stange things on this nixos system - e.g. DHCP is set to false but now and then after bootup it permanetly tries and fails to setup dhcp!?)

NixOS has some hacks to make sudo behave a bit different. If you have a package installed only as a user, then sudo brackets will run your user’s binary, not root’s. Try to sudo su - and then run brackets – it should be absent.

yes, but… Would you like to find out which envvar causes segfault?

  • the -i --keep PATH makes your environment pristine, clear
  • segfault is not reproduced in this clear environment, so it must be some environment variable causes it. Be it QT, or locale, or LD_*, or drivers, or XDG_* or whatnot - you have to figure out, as this is “impurity”, a thing we try to avoid in Nix/NixOS

You have network manager – maybe it tries to dhcp?

This indicates nothing had changed. Dummy rebuild, when this happens switch does only activate step.

dummy rebuild - mh ok. I will take care about that.

according to the error theit will be no new generation created:

Jun 18 09:08:00 nixos nixos[12970]: switching to system configuration /nix/store/jwxq8lpb8jg58vakld6sn4sx2c50xssb-nixos-system-nixos-20.03.2157.db31e48c5c8 failed (status 4)

I have network manager – but why does it tries to dhcp if it is set to false? Should I use something else/better (what alternatives are there in nixos)?

you are right, with su there is no brackets

I tested all vars additionally to PATH (via python subprocess) and all have exiscode 1, so the permission issue.

  • I’m not sure if I understood how to test it the right way
    – if I only add --keep PATH it end with the error - I would expect that this most simple scenario shurt run, no?

Ok, I see that there are too many variables required to actually run brackets. I don’t actually know how to help here, maybe you should write a script which tried all combinations of variables in loop and tests if brackets actually starts with those vars…

Hello danbst,
ok, i will try all different var combinations.

with some changes in configuration.nix sudo brackets opens without an error.

  • why does it open with sudo anyway when it fails in user env?

I’m not sure, but sudo restricts environment – removes many envvars, one of which may be the culprit.

Hello danbst,

on question (back to the roots)
How is a “brocken” path possible if I set up a clean new nixos / managed the user env with home-manager?

  • I did not modify any path variable (intentionally)

I don’t quite understand what are you talking about, can you tell more details? What’s the error?

Hello danbst,
I did not define or change env/path variables.
All I did was setting up a fresh nixos installation (with home-manager).

  • that would mean that the issues to be not able to start brackets (e.g. env variables) only come from the installation of nix pkgs, right?

correct, but note also that I use XFCE desktop manager, and you may be using a different one and you may use different drivers, so our environment even if both installed “cleanly” have some differences.