NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.14k stars 14.17k forks source link

grub + efi broken #16374

Closed paspanag closed 8 years ago

paspanag commented 8 years ago

Currently booting an efi system with grub is broken. Tried to install using

{               
        boot.loader.grub = {
                enable = true;
                version = 2;
                efiSupport = true;
                device = "nodev";};
        boot.kernelPackages = pkgs.linuxPackages_4_5;
}

Replaced the grub parts with systemd boot and it works. When I tried to use this config again, it reported success but the boot is still under systemd boot.

spinus commented 8 years ago

@paspanag, I'm not very good with grub but device="nodev" looks suspicious to me. what does it do? I'm using device="/dev/xxx" and works for me (I'm not sure that's the case here).

paspanag commented 8 years ago

Yeah looks odd but I got it from one of the open issues to get grub and efi to work. #9096

spinus commented 8 years ago

did you try to set this up for some device? Do you have EFI boot partition?

paspanag commented 8 years ago

Yeah it's for my laptop.

I had Nixos, but installed another another distro, then went back to Nixos using the same config and same partitioning scheme as before I installed the other distro.

And yes, I had the EFI partition setup using gdisk.

cransom commented 8 years ago

I noticed when testing my own laptop a few weeks ago that when disabling gummiboot/grub, the efi boot stubs don't get removed automatically. There are scripts that get called to install the boot loaders but there aren't any that remove said loaders. If you delete/disable/rename /boot/EFI/gummiboot grub or change the EFI boot settings in bios or via efibootmgr, you'll get grub back.

paspanag commented 8 years ago

@cransom, Thanks!

I used efibootmgr, I'll try to make a fix and do a pull request. Seems to be only one command is needed to do the transition from systemd-boot to grub.

vcunat commented 8 years ago

A few days ago I installed 16.03 successfully on UEFI by following the manual. EDIT: I also had to mess a little with bios to disable "secure boot", etc.

domenkozar commented 8 years ago

According to @avnik it's working:

domenkozar commented 8 years ago

But @obadz has also issues: doesn't work unless installed from a UEFI enabled device

avnik commented 8 years ago

@domenkozar last one common for all distros, debian also unable to install efi grub, unless booted from UEFI enabled device (at least it WAS unable two years ago)

obadz commented 8 years ago

this is a commit in the works that should be able to helpful when installing a UEFI system from a non-UEFI booted system or simply when one does not want to deal with the stateful messiness of efivars: https://github.com/obadz/nixpkgs/commit/45e219d03f80a0050b0a2b645a7ab72285d0cb7e

jokogr commented 8 years ago

If I understand well, the device attribute is required to write to the MBR, so "nodev" is correct.

My installation also works with Grub and UEFI, I had a setup initially similar to @avnik's (https://github.com/avnik/nixos-configs/blob/master/common/efi.nix), now I am working on properly cloning the ESP partitions (see #18584).