Symptoms & scope
- A configuration activated with test is not the boot default.
- The running kernel remains older after switch until reboot.
Relevant environment
NixOS system generations; test, boot and switch update different parts of activation and boot selection.
Possible causes
These are possible explanations, not a confirmed diagnosis. Several independent faults can coexist.
- nixos-rebuild test changes runtime without setting the boot default; boot does the converse.
- The firmware may boot a different loader or generation, or a bootloader update may have failed during activation.
Diagnose safely
Run one command at a time in the relevant session. Read the explanation first. Uppercase placeholders need your own values; tools and privileges vary by distribution. These commands are displayed here and never executed by the website.
Check 1
Reads the three usual NixOS targets without switching; keep the output order aligned with the arguments.
readlink -f /run/current-system /run/booted-system /nix/var/nix/profiles/systemInterpret the result: current-system reflects active userspace, booted-system the booted closure, and the system profile the selected generation. Differences can be intentional after test or switch.
Check 2
Lists system profile history; read access may be restricted, and no boot choice is changed.
nix-env --profile /nix/var/nix/profiles/system --list-generationsInterpret the result: The profile's current marker does not prove firmware booted it. Compare dates with the tested change and saved rebuild output.
Evidence-guided next steps
Choose the intended rebuild action
If a successful test should persist, build and use switch for runtime plus boot default or boot for activation at next reboot, with the same explicit flake host or channel input. Verify the command completed its bootloader stage.
Precautions: switch can restart services but cannot replace the running kernel. Keep console access and a known-good boot entry before remote activation.
Recovery / rollback: Choose a retained known-good boot generation or use the documented rollback action; boot changes and mutable state migrations need separate review.
Did this solution help you?
Repair the verified boot-selection mismatch
If the rebuild succeeded but the wrong loader or entry boots, inspect the machine's actual firmware choice and the configured ESP/bootloader location. Correct only the NixOS boot target proven inconsistent with that choice.
Precautions: Do not reinstall a bootloader to an assumed disk. Preserve other OS entries and record current firmware selection.
Recovery / rollback: Restore the recorded firmware choice and previous bootloader configuration, then boot the known-good retained generation.
Did this solution help you?
References & review
This guide was prepared from primary project or distribution sources and reviewed on the date shown. This is an editorial source check, not evidence that a fix was reproduced on your hardware. Diagnostic log examples are synthetic fixtures. Version-dependent details must be checked against your installed release.
- NixOS manual — changing configuration and rollback (project or distribution documentation)
- Official NixOS Wiki — nixos-rebuild modes (project or distribution documentation)