My motherboard uses UEFI, not BIOS, but the NixOS installer gives this error:
[root@nixos:~]# nixos-install
building the configuration in /mnt/etc/nixos/configuration.nix...
error:
Failed assertions:
- You must set the option ‘boot.loader.grub.devices’ or 'boot.loader.grub.mirroredBoots' to make the system bootable.
(use '--show-trace' to show detailed location information)
Following the instructions here to see if the system is UEFI or BIOS , there is no such folder as "/sys/firmware/efi" . How is this possible?
Check if you are using UEFI or BIOS on Linux
The easiest way to find out if you are running UEFI or BIOS is to look for a folder /sys/firmware/efi. The folder will be missing if your system is using BIOS.
After doing what the error message tells me, it tries to install NixOS, but fails a different way:
[root@nixos:~]# nixos-install
building the configuration in /mnt/etc/nixos/configuration.nix...
[168 built, 375 copied (1556.3 MiB), 7.5 MiB DL]
copying channel...
installing the boot loader...
setting up /etc...
Initializing machine ID from random generator.
updating GRUB 2 menu...
mktemp: failed to create directory via template ‘/tmp/os-prober.XXXXXX’: No such file or directory
grub-probe: error: cannot find a GRUB drive for /dev/sda1. Check your device.map.
mktemp: failed to create directory via template ‘/tmp/os-prober.XXXXXX’: No such file or directory
Found Windows 10 on /dev/sdc1
installing the GRUB 2 boot loader on /dev/nvme0n1...
Installing for i386-pc platform.
/nix/store/zgcj53sxwri8wjm7zxw82c8cv67qjwfn-grub-2.02/sbin/grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
/nix/store/zgcj53sxwri8wjm7zxw82c8cv67qjwfn-grub-2.02/sbin/grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
/nix/store/zgcj53sxwri8wjm7zxw82c8cv67qjwfn-grub-2.02/sbin/grub-install: error: will not proceed with blocklists.
/nix/store/qn1321bzrc0v9pzyznmhw0zvj8p8dnyi-install-grub.pl: installation of GRUB on /dev/nvme0n1 failed
I have ASrock Z170m Pro4s motherboard
https://www.asrock.com/mb/Intel/Z170M%20Pro4S/
I think you need:
boot.loader.grub.devices = [ "/dev/nvme0n1" ];
boot.loader.grub.efiSupport = true;
EDIT: this is not related to your issue, but with EFI it seems useful to set:
boot.loader.efi.canTouchEfiVariables = true;
I think you need:
boot.loader.grub.devices = [ "/dev/nvme0n1" ]; boot.loader.grub.efiSupport = true;
OK I tried this and got:
[root@nixos:~]# nixos-install
building the configuration in /mnt/etc/nixos/configuration.nix...
[3 built, 3 copied (27.8 MiB), 0.0 MiB DL]
copying channel...
installing the boot loader...
setting up /etc...
updating GRUB 2 menu...
mktemp: failed to create directory via template ‘/tmp/os-prober.XXXXXX’: No such file or directory
grub-probe: error: cannot find a GRUB drive for /dev/sda1. Check your device.map.
installing the GRUB 2 boot loader on /dev/nvme0n1...
Installing for i386-pc platform.
/nix/store/zgcj53sxwri8wjm7zxw82c8cv67qjwfn-grub-2.02/sbin/grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
/nix/store/zgcj53sxwri8wjm7zxw82c8cv67qjwfn-grub-2.02/sbin/grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
/nix/store/zgcj53sxwri8wjm7zxw82c8cv67qjwfn-grub-2.02/sbin/grub-install: error: will not proceed with blocklists.
/nix/store/qn1321bzrc0v9pzyznmhw0zvj8p8dnyi-install-grub.pl: installation of GRUB on /dev/nvme0n1 failed
I have to mention, I have the OS prober activated in the config file:
boot.loader.grub.useOSProber = true;
I tried disabling the OS prober and got no improvement:
[root@nixos:~]# nixos-install
building the configuration in /mnt/etc/nixos/configuration.nix...
[3 built]
copying channel...
installing the boot loader...
setting up /etc...
updating GRUB 2 menu...
installing the GRUB 2 boot loader on /dev/nvme0n1...
Installing for i386-pc platform.
/nix/store/zgcj53sxwri8wjm7zxw82c8cv67qjwfn-grub-2.02/sbin/grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
/nix/store/zgcj53sxwri8wjm7zxw82c8cv67qjwfn-grub-2.02/sbin/grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
/nix/store/zgcj53sxwri8wjm7zxw82c8cv67qjwfn-grub-2.02/sbin/grub-install: error: will not proceed with blocklists.
/nix/store/qn1321bzrc0v9pzyznmhw0zvj8p8dnyi-install-grub.pl: installation of GRUB on /dev/nvme0n1 failed
I got it to work by setting
boot.loader.grub.device = "nodev";
This is obnoxiously inconsistent with what the manual dictates. This exception needs to be explained in the manual. In fact I have zero clue what it really does and why to use it. The auto-generated configuration.nix file has it in the same line as the setting:
boot.loader.grub.device = "nodev"; # or "nodev" for efi only
This needs to be updated in the NixOS Manual.
Reopening the issue because after using the "nodev" option, it did not install GRUB, even though it claims it did. Following the Manual did not help me at all. Installer complains that I haven't chosen a place to install GRUB, but my machine does not use BIOS. It is a UEFI machine. When I disable all BIOS-related options and enable UEFI options, it still complains that it needs a BIOS option.
The nixos-generate-config command does not generate fields for these items:
boot.loader.systemd-boot.enable
boot.loader.efi.canTouchEfiVariables
I wiped the previously generated configuration.nix file then re-ran nixos-generate-config:
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n = {
# consoleFont = "Lat2-Terminus16";
# consoleKeyMap = "us";
# defaultLocale = "en_US.UTF-8";
# };
# Set your time zone.
# time.timeZone = "Europe/Amsterdam";
# List packages installed in system profile. To search, run:
# $ nix search wget
# environment.systemPackages = with pkgs; [
# wget vim
# ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = { enable = true; enableSSHSupport = true; };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
# Enable the X11 windowing system.
# services.xserver.enable = true;
# services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e";
# Enable touchpad support.
# services.xserver.libinput.enable = true;
# Enable the KDE Desktop Environment.
# services.xserver.displayManager.sddm.enable = true;
# services.xserver.desktopManager.plasma5.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
# users.users.guest = {
# isNormalUser = true;
# uid = 1000;
# };
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "18.09"; # Did you read the comment?
}
It is apparent the generator is inconsistent, because my previously-generated output was nothing like this.
If there is no /sys/firmware/efi and boot.loader.systemd-boot.enable was not generated, then you have probably booted the installer in BIOS mode. boot.loader.efi.canTouchEfiVariables will have no effect because EFI variables do not exist in this mode. To boot in EFI mode, you can try one of these:
dd if=/dev/zero of=/dev/_?_ bs=446 count=1: https://unix.stackexchange.com/a/71390/182445If there is no
/sys/firmware/efiandboot.loader.systemd-boot.enablewas not generated, then you have probably booted the installer in BIOS mode.boot.loader.efi.canTouchEfiVariableswill have no effect because EFI variables do not exist in this mode. To boot in EFI mode, you can try one of these:* after powering on, press a key to choose the boot device (some motherboards show two entries for the installer, one BIOS and one EFI) * enter system setup and disable BIOS boot, legacy boot, legacy boot compatibility etc. * wipe BIOS boot record on the installer: ` dd if=/dev/zero of=/dev/_?_ bs=446 count=1`: https://unix.stackexchange.com/a/71390/182445
This is not the case.
The installer's boot menu only shows these options:
NixOS 18.09.blahblahblah Installer
NixOS 18.09.blahblahblah Installer (nomodeset)
NixOS 18.09.blahblahblah Installer (copytoram)
NixOS 18.09.blahblahblah Installer (debug)
Memtest86+
There is no mention of BIOS reverse-compatibility in the motherboard UEFI or the manual. *Correction: The manual mentions CSM (Compatibility Support Module), but this option was removed in the updated UEFI.
I have internal 3 SSD's and 1 internal HDD, and 1 external HDD connected to my computer. I have been loading ISO's onto one of the SSDs, then installing to another SSD.
As an experiment, I booted up the install ISO again and re-ran nixos-generate-config in a new folder (mkdir /test) and I got yet a result that matched my first (it's truncated for simplicity):
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
# boot.loader.grub.efiSupport = true;
# boot.loader.grub.efiInstallAsRemovable = true;
# boot.loader.efi.efiSysMountPoint = "/boot/efi";
# Define on which hard drive you want to install Grub.
# boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
What is BIOS mode on a UEFI machine, anyway, and how does it get invoked?
What is BIOS mode on a UEFI machine, anyway, and how does it get invoked?
EFI computers support booting BIOS operating systems by providing BIOS services to the OS. They choose which services to provide, BIOS or EFI, based on the following considerations:
The NixOS installer meets both criteria to support both types of boot.
The installer's boot menu only shows these options
I meant the boot disk selection menu. On the third screenshot here, the motherboard offers EFI boot of the ST2000DX01 disk as the first option, and BIOS boot of the same disk as the third option.
The manual mentions CSM (Compatibility Support Module), but this option was removed in the updated UEFI.
Here a user reports that they did not have the CSM option until they updated the firmware.
So, you can try any of these options:
dd bs=1 count=2 seek=510 conv=notrunc if=/dev/zero of=/dev/? (where ? is sd? or nvme?n?; look at the output of mount or blkid), then boot the installer againThank you @orivej
Most helpful comment
EFI computers support booting BIOS operating systems by providing BIOS services to the OS. They choose which services to provide, BIOS or EFI, based on the following considerations:
The NixOS installer meets both criteria to support both types of boot.
I meant the boot disk selection menu. On the third screenshot here, the motherboard offers EFI boot of the ST2000DX01 disk as the first option, and BIOS boot of the same disk as the third option.
Here a user reports that they did not have the CSM option until they updated the firmware.
So, you can try any of these options:
dd bs=1 count=2 seek=510 conv=notrunc if=/dev/zero of=/dev/?(where?issd?ornvme?n?; look at the output ofmountorblkid), then boot the installer again