How to debug issues with nix-channel?

Hi,

I have this issue with nix-channel --update. But so far I have failed to debug it further. Starting nix-channel in gdb does not trigger the breakpoint i have set in src/libstore/build.cc. And the same is true if I attach gdb to the nix-daemon. So I guess that some further process is spawned for the update.

Has anyone any tip for me. Otherwise I will try my luck with something like sysdig.

Thanks in advance

Kai Harries

Have you tried the workaround mentioned in https://github.com/NixOS/nix/issues/2605#issuecomment-453777149?

Also, the error with empty strings sounds like you have extra spaces in your Nix configuration file. If that’s true, judging by the patch that worked around it, the extra spaces are probably on extra-sandbox-paths or sandbox-paths. Try getting the exact contents (especially end-of-line whitespace, if any) of /etc/nix/nix.conf before the running of nix-channel. Output of nix show-config --json might also help diagnose the problem, as it’s a parsed and defaults-filled version of /etc/nix/nix.conf.

dramforever via Nix community nixos1@discoursemail.com writes:

Have you tried the workaround mentioned in https://github.com/NixOS/nix/issues/2605#issuecomment-453777149?

Yes I did, and with sandbox disabled the problem disappeared.

Also, the error with empty strings sounds like you have extra spaces in your Nix configuration file. If that’s true, judging by the patch that worked around it, the extra spaces are probably on extra-sandbox-paths or sandbox-paths. Try getting the exact contents (especially end-of-line whitespace, if any) of /etc/nix/nix.conf before the running of nix-channel. Output of nix show-config --json might also help diagnose the problem, as it’s a parsed and defaults-filled version of /etc/nix/nix.conf.

I have also tried it with a completely empty nix.conf, but still the
same problem (anyhow I have attached the nix show-config output). The
problems also arises if I do a nix-build with an override, so that
something actually needs to build.

nix-build -E ‘with import { }; diffoscope.override { enableBloat = true; }’

I should have mentioned that this is a nix build from source.

What I have tried so far is a gdb with follow-fork-mode set to child
and follow-exec-mode set to new. But catch throw has revealed
nothing interesting because I was either in the wrong process or
sometimes hit by an gdb internal-error.

Right now I am wondering if a nix that is build from source and located
outside the nix-store and the sandbox can work together at all.

(Attachment nix.show-config.json is missing)