Subject: GRUB 2.12 hell on x86_64

From: Alex <[email-masked]>
Date: Thu, 4 Jan 2024 20:30:52 +0100

If you're unlucky like me and, after the GRUB 2.12 upgrade in Edge, you
had a non-working GRUB, read on:

So, if after an upgrade of GRUB, you boot the computer only to find
some text saying "Welcome to GRUB!" flash on the screen and an instant
reboot into the UEFI firmware settings, congratulations, your GRUB
installation is broken! Hopefully you have an install of
SystemRescue handy for this one.

Insert your CD/DVD/USB drive with SystemRescue and boot it. We're
going to reinstall GRUB.

Once on SystemRescue, open a terminal (if using a GUI) and run
"mountall". This script mounts all drives on the system and also
bind-mounts SystemRescue's /dev, /proc and /sys into the filesystem of
your drives if it finds them on the drives[1]. This is a necessary
step, so make sure you mount the drives using "mountall"·.

Next, chroot into your EXT4 (or whatever filesystem you use) partition.
Once there, run "mount -a". This will use your /etc/fstab (on your
drive) to mount the rest of your filesystems on the chroot, most
importantly your boot partition.

To reinstall GRUB, run "grub-install --efi-directory=/boot/ --no-nvram
--disable-shim-lock" in the chroot. --disable-shim-lock is necessary,
otherwise GRUB will appear to work, but if you boot into Alpine Linux
it will complain about missing "grub_is_shim_lock_enabled" symbols and
fail. This I fixed thanks to [2]. Next, you'll want to copy the
grubx64.efi file it generates into the alpine and boot folders (for
this last one rename it to bootx64.efi). Run "apk fix grub" so that APK
regenerates the GRUB configuration just in case. Reboot and you should
have a working GRUB once again! At least I did.

CCing Timo Teräs, maintainer of GRUB on Alpine, since this should've
been handled by APK automatically IMO, without requiring manual
intervention like this.

[1]: https://www.system-rescue.org/scripts/mountall/
[2]:
https://github.com/NixOS/nixpkgs/issues/243026#issuecomment-1644078833

-- 
Current PGP KeyID: 0AFB427F1800FD89751C4035292228735AE707FF

https://blueselene.com/pgp-archive/0AFB427F1800FD89751C4035292228735AE707FF/key.pub

---

From: Страхиња Радић <[email-masked]>
Date: Fri, 5 Jan 2024 11:00:22 +0100

With any distro:

- If you want normie-friendly stability without reading on-screen output and 
  prompts, avoid "edge"/"rolling release"/"unstable" and use the "stable" 
  variants.

- If you are using hardcore edge/rolling release/unstable, be hardcore: pay 
  attention when upgrading and have a boot medium handy, just in case.

---

From: Bobby Hiltz <[email-masked]>
Date: Fri, 5 Jan 2024 12:38:30 +0100 (GMT+01:00)

This is decent advice, although not the wording I would use.

Totally off-topic: I like using Edge to have up-to-date packages, but I am definitely a "normie" by most standards because I have never bothered with chroot when I muck something up and just use it as an excuse to reinstall.

I'm glad OP sent a message though. I didn't have any SystemRescue disc ready and now I do.

Also, thanks to the Alpine team, happy new year, etc.

---

From: Ralf Mardorf <[email-masked]>
Date: Fri, 05 Jan 2024 13:33:15 +0100

On Fri, 2024-01-05 at 12:38 +0100, Bobby Hiltz wrote:
> I didn't have any SystemRescue disc ready and now I do.

Any USB stick with a live Linux is suitable. Just have a few USB Ventoy
sticks [ https://www.ventoy.net/en/index.html ] (aged 1 or 2 GiB sticks,
for EUR 1,-) with few live Linux lying around, and you're all set.

---

From: Konstantin Kulikov <[email-masked]>
Date: Fri, 5 Jan 2024 12:43:08 +0300

Looking at upgrade MR[1] here's what i want to say - switch to
limine[2]. There is no reason for a bootloader to require 20+ patches
to work.

[1]: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/57927/diffs
[2]: https://github.com/limine-bootloader/limine/