Subject: bug#75896: GRUB configurations generated by deploy and delete-generations differ, interfering with boot process

From: Tomas Volf <[email-masked]>
Date: Mon, 27 Jan 2025 13:12:06 +0100

For some reason the generated configuration by `guix system deploy'
differs from the one generated by `guix system delete-generations'.  The
one from `delete-generations' is missing the extra-initrd, interfering
with the boot of the system.

From `guix deploy':

--8<---------------cut here---------------start------------->8---
menuentry "GNU with Linux 6.12.11" {
  [..]
  initrd /disk/key.cpio /gnu/store/id8k7j24c4ijxiw1pgfsp0pg2ws52wkd-combined-initrd/initrd.img
}
--8<---------------cut here---------------end--------------->8---

From `guix system delete-generations':

--8<---------------cut here---------------start------------->8---
menuentry "GNU with Linux 6.12.11 (#42, 2025-01-27 11:54)" {
  [..]
  initrd  /gnu/store/id8k7j24c4ijxiw1pgfsp0pg2ws52wkd-combined-initrd/initrd.img
}
--8<---------------cut here---------------end--------------->8---

Ignoring that the menuentries are differently named (which is bit weird,
but does not really matter), notice that the `initrd' lines differ.

Reproduction is simple:

0. Configure system with bootloader with extra-initrd configured.
1. Run `guix deploy' few times.
2. Look at first menuentry in /boot/grub/grub.cfg.
3. Run `guix system delete-generation $OLDEST'.
4. Compare first menuentry in /boot/grub/grub.cfg to step 2.
  --> Notice the differences (name, initrd, ...).
5. Run `guix deploy' once more.
  --> Notice it got fixed again.

Workaround is to always run `guix deploy' once more after deleting
generations, even if there is nothing to deploy.  It will still
regenerate the grub.cfg, fixing things up.

But it would be great if it "just worked".

Have a nice day,
Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.