Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix boot.loader.grub.mirroredBoots when UEFI booting #18584

Closed
jokogr opened this issue Sep 14, 2016 · 0 comments
Closed

Fix boot.loader.grub.mirroredBoots when UEFI booting #18584

jokogr opened this issue Sep 14, 2016 · 0 comments
Labels
0.kind: bug Something is broken 0.kind: question Requests for a specific question to be answered 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS

Comments

@jokogr
Copy link
Contributor

jokogr commented Sep 14, 2016

Issue description

Hello,

I have one machine with three HDDs on ZFS RAID-Z and UEFI booting. Could we please make it work with Grub?

Steps to reproduce

I have three FAT-32 partitions, one in each HDD and mounted in /boot1, /boot2 and /boot3. If I use the following configuration:

  boot.loader.grub = {
    enable = true;
    version = 2;
    zfsSupport = true;
    efiSupport = true;
    mirroredBoots = [
      { devices = [ "nodev" ]; path = "/boot1"; efiSysMountPoint = "/boot1"; }
      { devices = [ "nodev" ]; path = "/boot2"; efiSysMountPoint = "/boot2"; }
      { devices = [ "nodev" ]; path = "/boot3"; efiSysMountPoint = "/boot3"; }
    ];
  };

  boot.loader.efi.canTouchEfiVariables = true;

then nixos-rebuild switch shoots this error:

building Nix...
building the system configuration...
error: 
Failed assertions:
- You cannot have duplicated devices in mirroredBoots
(use ‘--show-trace’ to show detailed location information)

Could anyone help me fix the assertion at https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/boot/loader/grub/grub.nix#L468, so that "nodev" can be used multiple times?

I tried writing it like that:

assertion = all (c: c < 2) (mapAttrsToList (_: c: c) bootDeviceCounters) || !cfg.efiSupport;

but it didn't work. Currently, my setup is working properly with this assertion removed.

@rasendubi rasendubi added 0.kind: bug Something is broken 0.kind: question Requests for a specific question to be answered 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS labels Sep 14, 2016
jokogr added a commit to jokogr/nixpkgs that referenced this issue Sep 15, 2016
When Grub is to be used with UEFI, it is not going to write to any MBR
of any disk. As such, it is safe to use multiple "nodev" device entries
when mirroring the ESP partition to multiple disks.

E.g.:

```
boot.loader.grub = {
  enable = true;
  version = 2;
  zfsSupport = true;
  efiSupport = true;
  mirroredBoots = [
    { devices = [ "nodev" ]; path = "/boot1"; efiSysMountPoint = "/boot1"; }
    { devices = [ "nodev" ]; path = "/boot2"; efiSysMountPoint = "/boot2"; }
    { devices = [ "nodev" ]; path = "/boot3"; efiSysMountPoint = "/boot3"; }
  ];
};

boot.loader.efi.canTouchEfiVariables = true;
```

Fixes NixOS#18584
fpletz pushed a commit that referenced this issue Sep 25, 2016
…18625)

When Grub is to be used with UEFI, it is not going to write to any MBR
of any disk. As such, it is safe to use multiple "nodev" device entries
when mirroring the ESP partition to multiple disks.

E.g.:

```
boot.loader.grub = {
  enable = true;
  version = 2;
  zfsSupport = true;
  efiSupport = true;
  mirroredBoots = [
    { devices = [ "nodev" ]; path = "/boot1"; efiSysMountPoint = "/boot1"; }
    { devices = [ "nodev" ]; path = "/boot2"; efiSysMountPoint = "/boot2"; }
    { devices = [ "nodev" ]; path = "/boot3"; efiSysMountPoint = "/boot3"; }
  ];
};

boot.loader.efi.canTouchEfiVariables = true;
```

Fixes #18584
acowley pushed a commit to acowley/nixpkgs that referenced this issue Sep 29, 2016
…ixOS#18625)

When Grub is to be used with UEFI, it is not going to write to any MBR
of any disk. As such, it is safe to use multiple "nodev" device entries
when mirroring the ESP partition to multiple disks.

E.g.:

```
boot.loader.grub = {
  enable = true;
  version = 2;
  zfsSupport = true;
  efiSupport = true;
  mirroredBoots = [
    { devices = [ "nodev" ]; path = "/boot1"; efiSysMountPoint = "/boot1"; }
    { devices = [ "nodev" ]; path = "/boot2"; efiSysMountPoint = "/boot2"; }
    { devices = [ "nodev" ]; path = "/boot3"; efiSysMountPoint = "/boot3"; }
  ];
};

boot.loader.efi.canTouchEfiVariables = true;
```

Fixes NixOS#18584
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 0.kind: question Requests for a specific question to be answered 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS
Projects
None yet
Development

No branches or pull requests

2 participants