NixOS 20.09 bootloader selecting "NixOS [test]" entry by default

I just upgraded to 20.09 from 20.03. Now, by default, whenever I reboot, the default bootloader entry that’s selected is “NixOS [test]”, not the generation I’ve most recently switched to. See photo of boot screen just after POST:

I’ve never seen that before

did you do

nixos-rebuild switch -p test

if you wanted to get rid of it, you can boot up into the newer profile, ensure everything works as intended, then run:

sudo nix-collect-garbage -d

This will clean up other generation such as test

NOTE: this will remove anything that doesn’t have gcroots.

the code that generates the bootloader menu’s is here.

I can’t see anything that would generate

NixOS [test]

Its seems to generate

NixOS - Profile 'test'

if you do

nixos-rebuild switch -p test


hang on , maybe it’s this piece of code… not quite sure what conditions that needs to run without more debugging…

        f.write(BOOT_ENTRY.format(profile=" [" + profile + "]" if profile else "",

profile gets populated from

def get_profiles():
    if os.path.isdir("/nix/var/nix/profiles/system-profiles/"):
        return [x
            for x in os.listdir("/nix/var/nix/profiles/system-profiles/")
            if not x.endswith("-link")]
        return []


what do you have in there?

1 Like

No, I didn’t use -p test.

Interesting - I have only links to test profiles in there, but I don’t remember them showing up in the boot menu before, or if they did, they were never selected as the default:

$ ls -lA /nix/var/nix/profiles/system-profiles/
total 4
lrwxrwxrwx 1 root root 11 Aug 29  2017 test -> test-1-link
lrwxrwxrwx 1 root root 84 Aug 29  2017 test-1-link -> /nix/store/6dv22g21pg7mc89mrx641g6mj5g6rljg-nixos-system-knuth-17.03.1775.56da88a298

Are links in /nix/var/nix/profiles/system-profiles/ gcroots? Maybe that’s why they’re not gone despite being years old.

It is quite likely that you, or someone created a test profile on

Aug 29 2017

it maybe that for some reason 17.03 didn’t update the boot loader menu with optional profiles.

I doubt that alternative profiles will get garbage collected , while the test profile has a link in there.

Why it wasn’t showing up before is a mystery, is /boot full? or your boot loader partition was somehow locked read only , or not mounted correctly?

Yeah, I know I must have created the test profile at some point in the past. I deleted the test profile and now my normal profile is selected in the boot menu by default, like before.

I wonder if there’s a way to designate one generation as the default entry in the boot menu. I don’t remember switching to the test profile at any point - I presume that switching to a profile using nixos-rebuild switch also makes it the default boot menu entry.