grub-pc reinstallation throws a prompt asking the device it should install on for Noble

Bug #2054103 reported by Utkarsh Gupta
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-images
Fix Released
Undecided
Utkarsh Gupta
grub2 (Ubuntu)
Fix Released
Undecided
Unassigned
ubuntu-release-upgrader (Ubuntu)
New
Undecided
Unassigned

Bug Description

grub-pc requires knowing what device to grub-install on, but when cloud images are generated, the device on the deployment target is never known. And so when the package is reinstalled (for example, when unminimizing the minimized image), the user gets that prompt, asking where to install the grub, when this should happen non-interactively, for example, by determining where the grub was first installed.

Interestingly, this issue always existed, however it was masked by the following timeline:

In July 2020, it was discovered that certain scenarios can cause grub-pc installation to fail, and an emergency SRU https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1889556 disabled grub-pc re-installation on upgrade as a workaround.

Before the commit https://salsa.debian.org/grub-team/grub/-/commit/8d809abe752712cb020e2e95fe21d5832bea52f8 got merged into Ubuntu, grub-pc/install-devices being unset in debconf was acceptable in practice. This was indeed unset and still is for cloud images.

In Dec 2021, grub2 2.06-2ubuntu1 was uploaded containing the previously mentioned commit. But as a result of the above emergency SRU, that upload managed to silently change the status quo without it ever being noticed.

In December 2023, the grub-pc installation workaround was finally removed in https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/2043995 exposing grub-pc package upgrade failures in cloud images where grub-pc/install-devices in debconf was never in-fact set.

The plausible solution is to develop something to set the grub-pc/install-devices debconf entry on first boot in a cloud deployment, which would allow upgrades to function like before.

Related branches

Utkarsh Gupta (utkarsh)
description: updated
Revision history for this message
Mate Kukri (mkukri) wrote :

First we are going to change grub to not hard-error when `grub-pc/install_devices` is empty, in order to avoid worse regressions than grub-pc simply being outdated on disk.

Second, since we know the image layout on cloud images, we can use `grub-probe` to determine the install device based on the filesystem containing the `/boot` directory.

We are introducing the `grub-{efi,pc}/cloud_style_installation` debconf option to determine the install device using `grub-probe` dynamically instead of having to fill the `grub-pc/install-devices`debconf entry.

This can then be set in cloud images at build time, and reinstallation should just work this way without having to introduce a new service.

Revision history for this message
Mate Kukri (mkukri) wrote :

To handle upgrades from pre-Noble, u-r-u will likely need a quirk to set the `grub-{efi,pc}/cloud_style_installation` options if upgrading a cloud installation.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package grub2 - 2.12-1ubuntu3

---------------
grub2 (2.12-1ubuntu3) noble; urgency=medium

  * Improve GRUB reinstallation in cloud images (LP: #2054103):
    - Add debconf options "grub-{efi,pc}/cloud_style_installation"
    - d/postinst.in: Make empty "grub-pc/install_devices" non-fatal in
      noninteractive mode
  * Determine GRUB_DISTRIBUTOR from os-release and fall back to build-time
    dpkg vendor (LP: #2034253)
  * d/p/grub-install-efi-title.patch: Use case-sensitive GRUB distributor as
    EFI option title (LP: #2026310)
  * Unreleased changes from Debian:
    - d/p/revert-term-ns8250-spcr.patch: Revert ACPI SPCR table support
      (#1062073)

 -- Mate Kukri <email address hidden> Tue, 27 Feb 2024 10:54:26 +0000

Changed in grub2 (Ubuntu):
status: New → Fix Released
Revision history for this message
Mate Kukri (mkukri) wrote :

Tagging foundations-todo for the u-r-u change

tags: added: foundations-todo
Utkarsh Gupta (utkarsh)
Changed in cloud-images:
status: New → Fix Released
assignee: nobody → Utkarsh Gupta (utkarsh)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.