Skip to content

"nixos-rebuild build-vm-with-booloader" with systemd-boot is broken again #107255

@bjornfor

Description

@bjornfor

Describe the bug
nixos-rebuild build-vm-with-booloader on a NixOS configuration with systemd-boot as bootloader (the default for NixOS installs on UEFI systems) fails with this error:

insmod: ERROR: could not insert module /nix/store/1ibmgfr13r8b6xyn4f0wj115819f359c-linux-5.4.83/lib/modules/5.4.83/kernel/fs/efivarfs/efivarfs.ko.xz: No such device
mount: /sys/firmware/efi/efivars: mount point does not exist.

I checked that the efivarfs.ko.xz file exists, so what's missing in the kernel since it reports "No such device"?

Steps to reproduce

$ cat >configuration.nix << EOF
{
  fileSystems."/".device = "/dev/sda1";
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
}
EOF

$ nixos-rebuild build-vm-with-bootloader -I nixos-config=$PWD/configuration.nix -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-20.09.tar.gz
building Nix...
building the system configuration...
these derivations will be built:
  /nix/store/dx2ycclyknvibrskwmii42sgyalagjxa-nixos-boot-disk.drv
  /nix/store/7dkqw00frhzfqjzn4w7fnwirldhs48bl-run-nixos-vm.drv
  /nix/store/yaw9kch9adk6xi1qzki98jcricxyz9l8-nixos-vm.drv
building '/nix/store/dx2ycclyknvibrskwmii42sgyalagjxa-nixos-boot-disk.drv' on 'ssh://nix-remote-build@bforsman.name'...
Formatting '/nix/store/1bzy8vqdv2bmib7qi658anc9kf7w7b6f-nixos-boot-disk/disk.img', fmt=qcow2 cluster_size=65536 compression_type=zlib size=62914560 lazy_refcounts=off refcount_bits=16
cSeaBIOS (version rel-1.13.0-48-gd9c812dda519-prebuilt.qemu.org)

iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+1FF8EEF0+1FEEEEF0 CA00

Booting from ROM...
loading kernel modules...isable)... ock
mounting Nix store...
mounting host's temporary directory...
starting stage 2 (/nix/store/rq2ishkgykpx4szwk5w8zcjk1jbp8svx-vm-run-stage2)
Creating new GPT entries in memory.
Setting name!
partNum is 0
Setting name!
partNum is 1
The operation has completed successfully.
mkfs.fat 4.1 (2017-01-24)
insmod: ERROR: could not insert module /nix/store/1ibmgfr13r8b6xyn4f0wj115819f359c-linux-5.4.83/lib/modules/5.4.83/kernel/fs/efivarfs/efivarfs.ko.xz: No such device
mount: /sys/firmware/efi/efivars: mount point does not exist.
[    1.908328] reboot: Power down
builder for '/nix/store/dx2ycclyknvibrskwmii42sgyalagjxa-nixos-boot-disk.drv' failed with exit code 32
error: build of '/nix/store/dx2ycclyknvibrskwmii42sgyalagjxa-nixos-boot-disk.drv' on 'ssh://nix-remote-build@bforsman.name' failed: builder for '/nix/store/dx2ycclyknvibrskwmii42sgyalagjxa-nixos-boot-disk.drv' failed with exit code 32
builder for '/nix/store/dx2ycclyknvibrskwmii42sgyalagjxa-nixos-boot-disk.drv' failed with exit code 1
cannot build derivation '/nix/store/7dkqw00frhzfqjzn4w7fnwirldhs48bl-run-nixos-vm.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/yaw9kch9adk6xi1qzki98jcricxyz9l8-nixos-vm.drv': 1 dependencies couldn't be built
error: build of '/nix/store/yaw9kch9adk6xi1qzki98jcricxyz9l8-nixos-vm.drv' failed

This happens with nixos-20.09 and nixos-unstable, but not nixos-20.03. (Just change the nixos-rebuild command above.)

Expected behavior
The build succeeds, like it did before (on nixos-20.03).

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Notify maintainers

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

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken0.kind: regressionSomething that worked before working no longer6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions