NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.95k stars 13.97k forks source link

Why do I get GRUB 452 Pointer out of range when upgrading to 23.11? #293038

Open madorian opened 7 months ago

madorian commented 7 months ago

Describe the bug

I'm unable to boot with grub after upgrading to 23.11

I notice the grub installed is an RC. Any way to upgrade to the non-RC?

Steps To Reproduce

Steps to reproduce the behavior:

  1. Boot
  2. Failboat
  3. Harakiri

Expected behavior

Boot

Screenshots

image

Additional context

This actually knocked out my entire station, cause this GRUB is not able to boot any of my operating systems on any drive.

I reported the issue to discord: https://discourse.nixos.org/t/why-do-i-get-grub-452-pointer-out-of-range-when-upgrading-to-23-11/40408/8 Also a thread here where I ask how to install GRUB from unstable, which is actually non-RC https://discourse.nixos.org/t/how-can-i-get-the-latest-version-of-grub/40500/4

Notify maintainers

@samueldr

Metadata

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

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.79, NixOS, 23.11 (Tapir), 23.11.4761.5bf1cadb72ab`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"home-manager-23.11.tar.gz, musnix, nixos-23.11"`
 - channels(b0ef): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Add a :+1: reaction to issues you find important.

allgreed commented 7 months ago

Howdy, just landed in a somewhat similar boat today. For all it matters I'm running MBR / aka legacy.

Upgrading to 2.12 [no rc] didn't quite do the trick for me (that lead to either pre boot menu issues or the same problem, can't remember now). However, downgrading to 2.06 did.

So... in terms of managing GRUB2 version it's really as simple as a basic overlay (yes, after reading the module I was thinking it'll not work for whatever reason):

  nixpkgs.overlays = [
    (final: prev: {
       grub2 = your_desired_package_goes_here;
    })
  ];

As for getting the 2.06 - I did an somewhat ugly hack as I was just trying to get it done(tm), obviously just picking an earlier channel or whatever would suffice.

I'm not commenting on the GRUB2 versioning scheme - yes, the newest version older than 2.12 is apparently 2.06, but they don't go in 0.06 increments, as the previous one is 2.04.

edit: @madorian may I suggest putting a link on the first Discourse topic to this issue

nixos-discourse commented 7 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-can-i-get-the-latest-version-of-grub/40500/7

bwlang commented 7 months ago

I ran into the same issue, but discovered that it is not 100% reproducible. Retrying 4 times resulted in a successful boot (i first went back to older versions, which also showed the same error).

RamKromberg commented 6 months ago

Howdy, just landed in a somewhat similar boat today. For all it matters I'm running MBR / aka legacy.

Upgrading to 2.12 [no rc] didn't quite do the trick for me (that lead to either pre boot menu issues or the same problem, can't remember now). However, downgrading to 2.06 did.

So... in terms of managing GRUB2 version it's really as simple as a basic overlay (yes, after reading the module I was thinking it'll not work for whatever reason):

  nixpkgs.overlays = [
    (final: prev: {
       grub2 = your_desired_package_goes_here;
    })
  ];

As for getting the 2.06 - I did an somewhat ugly hack as I was just trying to get it done(tm), obviously just picking an earlier channel or whatever would suffice.

I'm not commenting on the GRUB2 versioning scheme - yes, the newest version older than 2.12 is apparently 2.06, but they don't go in 0.06 increments, as the previous one is 2.04.

edit: @madorian may I suggest putting a link on the first Discourse topic to this issue

Thanks for this. I only want to clarify that if you're fresh off 23.06 landing into 23.11 after a nixos-rebuild and the system isn't booting, using the grub menu to choose 23.06 won't work. So, what worked for me is:

  1. Use the 23.11 installation media following https://wiki.nixos.org/wiki/Bootloader#From_an_installation_media to nixos-enter (a chroot of sorts) into the system (and realize there's no internet connection...).
  2. Find an old grub version that worked with "ls /nix/store/*grub-2.06" and execute something like "/nix/store/m5qywhgxrv4i7a97i4gp8p8xxfsi6s0h-grub-2.06/bin/grub-install /dev/sda1 --force" to get the system booting again.
  3. Apply the overlay to use the old grub 2.06 version as explained above now that the internet connection is working.

I'm guessing step 2 and 3 will be considered bad practice and that there's a proper way to rollback the bootloader/system without an internet connection... But I couldn't figure it out and this worked for me so...