Nixos-rebuild crashes terminal - Microsft Surface Laptop 3

Hello, I am new to nixos and just installed it onto my old-ish Surface Laptop but I am running into trouble usually whenever I try to tweak anything related to hardware. When I run nixos-rebuild after adding certain changes to my configuration.nix the terminal I am using will crash without giving any useful debug information. Adding any different arguments test dry-build dry-activate boot --show-trace do not help at all. Pipping the command to a log file does not give any information either.

─me at nixos in ~
╰─○ fastfetch    
          β–—β–„β–„β–„       β–—β–„β–„β–„β–„    β–„β–„β–„β––             me@nixos
          β–œβ–ˆβ–ˆβ–ˆβ–™       β–œβ–ˆβ–ˆβ–ˆβ–™  β–Ÿβ–ˆβ–ˆβ–ˆβ–›             --------
           β–œβ–ˆβ–ˆβ–ˆβ–™       β–œβ–ˆβ–ˆβ–ˆβ–™β–Ÿβ–ˆβ–ˆβ–ˆβ–›              OS: NixOS 24.05.5809.4eb33fe664af (Uakari) x86_64
            β–œβ–ˆβ–ˆβ–ˆβ–™       β–œβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–›               Host: Surface Laptop 3 (124I:00044T:000M:0400000B:07)
     β–Ÿβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–™ β–œβ–ˆβ–ˆβ–ˆβ–ˆβ–›     β–Ÿβ–™         Kernel: Linux 6.6.57
    β–Ÿβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–™ β–œβ–ˆβ–ˆβ–ˆβ–™    β–Ÿβ–ˆβ–ˆβ–™        Uptime: 5 hours, 35 mins
           β–„β–„β–„β–„β––           β–œβ–ˆβ–ˆβ–ˆβ–™  β–Ÿβ–ˆβ–ˆβ–ˆβ–›        Packages: 1485 (nix-system)
          β–Ÿβ–ˆβ–ˆβ–ˆβ–›             β–œβ–ˆβ–ˆβ–› β–Ÿβ–ˆβ–ˆβ–ˆβ–›         Shell: zsh 5.9
         β–Ÿβ–ˆβ–ˆβ–ˆβ–›               β–œβ–› β–Ÿβ–ˆβ–ˆβ–ˆβ–›          Display (LQ150P1JX51): 2496x1664 @ 60Hz (as 1248x832) [Built-in]
β–Ÿβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–›                  β–Ÿβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–™    DE: KDE Plasma
β–œβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–›                  β–Ÿβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–›    WM: KWin (Wayland)
      β–Ÿβ–ˆβ–ˆβ–ˆβ–› β–Ÿβ–™               β–Ÿβ–ˆβ–ˆβ–ˆβ–›             WM Theme: Breeze
     β–Ÿβ–ˆβ–ˆβ–ˆβ–› β–Ÿβ–ˆβ–ˆβ–™             β–Ÿβ–ˆβ–ˆβ–ˆβ–›              Theme: Breeze (Dark) [QT]
    β–Ÿβ–ˆβ–ˆβ–ˆβ–›  β–œβ–ˆβ–ˆβ–ˆβ–™           ▝▀▀▀▀               Icons: breeze-dark [QT], breeze-dark [GTK2/3/4]
    β–œβ–ˆβ–ˆβ–›    β–œβ–ˆβ–ˆβ–ˆβ–™ β–œβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–›         Font: Noto Sans (10pt) [QT], Noto Sans (10pt) [GTK2/3/4]
     β–œβ–›     β–Ÿβ–ˆβ–ˆβ–ˆβ–ˆβ–™ β–œβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–›          Cursor: Breeze_Light (24px)
           β–Ÿβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–™       β–œβ–ˆβ–ˆβ–ˆβ–™                Terminal: .konsole-wrappe
          β–Ÿβ–ˆβ–ˆβ–ˆβ–›β–œβ–ˆβ–ˆβ–ˆβ–™       β–œβ–ˆβ–ˆβ–ˆβ–™               CPU: AMD Ryzen 5 Microsoft Surface (R) Edition (8) @ 2.10 GHz
         β–Ÿβ–ˆβ–ˆβ–ˆβ–›  β–œβ–ˆβ–ˆβ–ˆβ–™       β–œβ–ˆβ–ˆβ–ˆβ–™              GPU: AMD Radeon Vega Series / Radeon Vega Mobile Series @ 0.20 GHz [Integrated]
         ▝▀▀▀    β–€β–€β–€β–€β–˜       β–€β–€β–€β–˜              Memory: 5.27 GiB / 5.77 GiB (91%)
                                               Swap: Disabled
                                               Disk (/): 27.47 GiB / 248.02 GiB (11%) - ext4
                                               Local IP (wlp2s0): 192.168.50.86/24 *
                                               Battery: 100% [Discharging]
                                               Locale: en_US.UTF-8

Part of my configuration.nix

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
	<nixos-hardware/microsoft/surface/surface-laptop-amd>
	./hardware-configuration.nix
    ];

  # Bootloader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  networking.hostName = "nixos"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Enable networking
  networking.networkmanager.enable = true;

  nix.settings.experimental-features = [ "nix-command" "flakes" ];

  # Set your time zone.
  time.timeZone = "America/Chicago";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.UTF-8";
  # Set your time zone.
  time.timeZone = "America/Chicago";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.UTF-8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "en_US.UTF-8";
    LC_IDENTIFICATION = "en_US.UTF-8";
    LC_MEASUREMENT = "en_US.UTF-8";
    LC_MONETARY = "en_US.UTF-8";
    LC_NAME = "en_US.UTF-8";
    LC_NUMERIC = "en_US.UTF-8";
    LC_PAPER = "en_US.UTF-8";
    LC_TELEPHONE = "en_US.UTF-8";
    LC_TIME = "en_US.UTF-8";
  };

  # Enable the X11 windowing system.
  # You can disable this if you're only using the Wayland session.
  services.xserver.enable = true;

  # Enable the KDE Plasma Desktop Environment.
  services.displayManager.sddm.enable = true;
  services.desktopManager.plasma6.enable = true;

  # Configure keymap in X11
  services.xserver.xkb = {
    layout = "us";
    variant = "";
  };

  # Enable CUPS to print documents.
  services.printing.enable = true

  hardware.bluetooth.enable = true;

This isn’t the entire config but both <nixos-hardware/microsoft/surface/surface-laptop-amd> and hardware.bluetooth.enable = true; will cause both Konsole and XTerm to crash.

I’d love know how to solve this but also this has happened enough times that I really want to know of any way I can debug nixos-rebuild because this is the biggest issue I have had with the distro so far.

Is there some log I can check with a nixos-rebuild fails to figure out what happened?

Umm, this seems fascinatingly broken. It’s almost definitely not nixos-rebuild, there is no such thing as a β€œcrash terminal pls” control sequence, and processes have no way to interact with the parent terminal otherwise. I don’t see this being a bug or anything of the sort.

You can try looking at your logs with journalctl --boot after one of these crashes.

All that said:

I’d suspect using nixos-rebuild just makes your system build something, causing you to run out of memory, and the OOM killer goes and kills the process tree, which then also kills your terminal.

2 Likes