Git-related softwares make NixOS freeze

Hi everyone,

I am quite new to NixOS, but I managed to get something up and working. I face a strange bug although I think I nearly replicated the setup I had on Arch where I did not encounter this issue. Some programs such as LazyGit, or Obsidian with the git plugin, are causing system freezes where I have to force the shutdown of the laptop. It happens as soon as the software is trying to fetch infos about the repository.

I see nothing in journalctl, at the time of the crash:

Jun 07 12:22:31 nixos systemd[2321]: Started kitty child process: 6086 launched by: 6071.
Jun 07 12:22:54 nixos systemd[2321]: Started GnuPG cryptographic agent and passphrase cache.
Jun 07 12:22:54 nixos gpg-agent[6412]: gpg-agent[6412]: WARNING: "--supervised" is a deprecated option
Jun 07 12:22:54 nixos gpg-agent[6412]: gpg-agent (GnuPG) 2.4.5 starting in supervised mode.
Jun 07 12:22:54 nixos gpg-agent[6412]: using fd 3 for ssh socket (/run/user/1000/gnupg/S.gpg-agent.ssh)
Jun 07 12:22:54 nixos gpg-agent[6412]: using fd 4 for std socket (/run/user/1000/gnupg/S.gpg-agent)
Jun 07 12:22:54 nixos gpg-agent[6412]: listening on: std=4 extra=-1 browser=-1 ssh=3
Jun 07 12:23:08 nixos systemd[2321]: kitty-5684-0.scope: Consumed 2.396s CPU time.
Jun 07 12:23:09 nixos systemd[2321]: Started kitty child process: 6484 launched by: 6471.

An example of LazyGit logs during a small freeze it caused:

Jun  7 12:34:18 |INFO| refreshing the following scopes in sync mode: files 
Jun  7 12:34:18 |DEBU| using cache for key status.showUntrackedFiles 
Jun  7 12:34:18 |INFO| refreshed merge conflicts in 10.229µs 
Jun  7 12:34:18 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"
Jun  7 12:34:18 |INFO| git status --untracked-files=all --porcelain -z (10.433872ms) 
Jun  7 12:34:18 |INFO| refreshed files in 10.863244ms 
Jun  7 12:34:18 |INFO| Refresh took 11.062536ms 
Jun  7 12:34:18 |INFO| postRefreshUpdate for submodules took 9.919µs 
Jun  7 12:34:18 |DEBU| RunCommand command="git -C /home/clementpoiret/Sync/Projects/Caminov/Fringuant/_fit diff --no-ext-diff --submodule --unified=3 --color=always -- .gitignore"
Jun  7 12:34:18 |INFO| postRefreshUpdate for files took 203.981µs

Sometimes freezes are so long I have to force the shutdown manually…
In case it might help, I use a Solokey to handle my ssh auth.

My config is rather simple for git: nixos-config/modules/home/git.nix at 1f48e244e99dacdcd6bb1694c1d822528732fa6e · clementpoiret/nixos-config · GitHub

I have no issues with ssh or git commands directly.

Do you guys have any idea? Thanks!

Sounds vaguely like swapping, can you keep an eye on stats with e.g. bottom while this happens?

Does look like that “short” freeze is 10ms of disk IO, are you running on spinning rust? Is your drive healthy?

I can’t even monitor what happens, everything is frozen, and stats don’t move anymore…

It’s a brand new Framework 16 laptop with two new NVMe SSDs so I think they are healthy.
The issue happens both on my desktop computer and on my laptop which have the same NixOS config, so the probability for it to be hardware-related is pretty small I believe

3 Likes

Okay so, I found something interesting: the issue is resolved when using an SSH Key without a password. When I use a key with a password, it fails directly without crashing because nothing asks for my password. The freeze occurs when trying to unlock the key using my Solokey. Maybe it’s my config related to SSH and FIDO/U2F?

EDIT: The system freezes exactly the same way if I call $SSH_ASKPASS

PROBLEM SOLVED :smiley:

I don’t understand why, but in my config, the default SSH_ASKPASS (x11-ssh-askpass) was broken. By replacing it by lxqt-openssh-askpass, everything now works perfectly! For the sake of reference if someone encounters the same issue:

{ pkgs, ... }: 
{
  environment.systemPackages = with pkgs; [
    lxqt.lxqt-openssh-askpass
  ];

  programs.ssh = {
    enableAskPassword = true;
    askPassword = "${pkgs.lxqt.lxqt-openssh-askpass}/bin/lxqt-openssh-askpass";
  };
}

and

{ pkgs, ... }:
{
  home.sessionVariables = {
    SSH_ASKPASS = "${pkgs.lxqt.lxqt-openssh-askpass}/bin/lxqt-openssh-askpass";
  };
}
3 Likes

Damn, askpasses tend to be very simple, didn’t expect it to be there. I suppose x11-ssh-askpass hasn’t seen any changes since 2015.

May be worth filing an issue for in nixpkgs, you likely won’t be the only one with this problem. Maybe share your DE/WM while you’re at it, xwayland might be getting in the way or something.

1 Like