[SOLVED] mirroredBoots with / on tmpfs build error: Failed to get blkid info for / on tmpfs at ...install-grub.pl

When using mirroredBoots with / on tmpfs, the following error occurs when building or rebuilding nixos:

...
evaluating file '/nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/tools/misc/grub/2.0x.nix'
evaluating file '/nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/development/tools/gnulib/default.nix'
updating GRUB 2 menu...
updating GRUB 2 menu...
updating GRUB 2 menu...
Failed to get blkid info (returned 512) for / on tmpfs at /nix/store/nvycxmg4g2q5jyqdxfvkgi95sqs48iw3-install-grub.pl line 202.
warning: error(s) occurred while switching to the new configuration

The build stops there. However, the build is actually completed and Grub updated, so I can reboot into the new derivation.

This doesn’t occur with a normal / on tmpfs installation, only / on tmpfs using mirroredBoots.

It’s not a showstopper since the new build still completes and activates, but it’s a little concerning nonetheless. Anyone know what might be the problem?

Additional info from Github Issue:

To Reproduce
Steps to reproduce the behavior:

  1. Configure hardware-configuration.nix with / on tmpfs.
  2. Configure configuration.nix and hardware-configuration.nix for mirroredBoots with two EFI boot partitions on different drives [1], [2]
  3. nix-build or nix-rebuild (dry-build and dry-activate succeed with no error, only boot/switch/etc cause this error)

Expected behavior
Re/Build should complete as normal.

Additional context

It seems the problem is that blkid / returns nothing when / is on tmpfs. Can verify this by calling blkid on the commandline. However, this error does not occur on a normal, single-boot-partition / on tmpfs configuration, only when using mirroredBoots simultaneously with / on tmpfs.

configuration.nix (boot properties subset) and hardware-configuration.nix in this gist: boot section of configurtion.nix, troubleshooting mirroredBoots with / on tmpfs · GitHub

Full configuration.nix here: https://github.com/byrongibson/nixos-setup/blob/7adfeb218ce4d9acab5c99d6683544e941836b3c/config/configuration.tmpfsroot.zfscrypt.full.z11pa-d8.nix

Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

  • system: "x86_64-linux"
  • host os: Linux 5.10.48, NixOS, 21.05.1408.9376bf7b342 (Okapi)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.12
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

There’s a slightly updated build error now, says the same thing but with a bit more info:

...
evaluating file '/nix/store/xkjafds79w6s17nf0jkzdcfw09b1s2zj-nixos-21.05.3248.6120ac5cd20/nixos/pkgs/tools/misc/grub/2.0x.nix'
evaluating file '/nix/store/xkjafds79w6s17nf0jkzdcfw09b1s2zj-nixos-21.05.3248.6120ac5cd20/nixos/pkgs/development/tools/gnulib/default.nix'
updating GRUB 2 menu...
installing the GRUB 2 EFI boot loader into /boot1...
Installing for x86_64-efi platform.
/nix/store/8dkfnl4k7vjr5f88kbh389i61ympvrnd-grub-2.06/sbin/grub-install: warning: cannot open directory `/nix/store/8dkfnl4k7vjr5f88kbh389i61ympvrnd-grub-2.06/share/locale': No such file or directory.
Installation finished. No error reported.
updating GRUB 2 menu...
installing the GRUB 2 EFI boot loader into /boot2...
Installing for x86_64-efi platform.
/nix/store/8dkfnl4k7vjr5f88kbh389i61ympvrnd-grub-2.06/sbin/grub-install: warning: cannot open directory `/nix/store/8dkfnl4k7vjr5f88kbh389i61ympvrnd-grub-2.06/share/locale': No such file or directory.
Installation finished. No error reported.
updating GRUB 2 menu...
Failed to get blkid info (returned 512) for / on tmpfs at /nix/store/xh1sd9ms5b2ixhz61qqiz07j2b9xv4z9-install-grub.pl line 202.
warning: error(s) occurred while switching to the new configuration

Solution: I had an extra boot.loader.grub.device line in the config that was conflicting with boot.loader.grub.mirroredBoots.devices. Removing that line fixed it.