GRUB doesn't load/save values when a submenu entry is used

Bug #1901633 reported by Kellen Renshaw
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
New
Undecided
Unassigned

Bug Description

It appears that GRUB in focal (2.04-1ubuntu26.6) doesn't load or save values to grubenv when using entries that are under a submenu. This is similar to LP #1816633

For context, this issue arose using the latest focal cloud image (https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img). I attempted to set GRUB_DEFAULT to "1>0" to boot the first entry of the "Advanced options for Ubuntu" submenu as a test for booting a specific kernel version.

This resulted in a boot loop where the first entry in the submenu was booted, the kernel panics, and restarts.

Using GRUB_DEFAULT=0 results in a boot > panic > boot > success. This is similar to LP #1870189.

From LP #1870189, cloud images set the GRUB_FORCE_PARTUUID variable in /etc/default/grub.d/40-force-partuuid.cfg. This results in menu entries that use a if/else structure to attempt initrd-less boot before falling back to booting with an initrd. The if/else structure uses a GRUB variable called initrdfail (and I believe recordfail) to note whether the initrd-less boot worked.

Note that unsetting GRUB_FORCE_PARTUUID works around my issue, since the if/else logic that uses the initrdfail variable is only placed in the grub.cfg when GRUB_FORCE_PARTUUID is set.

However, I tried using custom menuentries in grub.cfg to show the variables' state in an attempt to determine why this didn't work with GRUB_FORCE_PARTUUID set. I will attach it to this bug.

This showed that the submenu menuentries didn't set or use the variables, specifically initrdfail and recordfail. The first entry, before the "Advanced options..." submenu, did set the variables, and would use them. However, using that first entry (by booting it once, getting the kernel panic and restarting) to set initrdfail to "1" didn't work. The submenu menuentries booted as though the value was unset.

I tested this by manually selecting boot entries and observing the values printed by my custom menuentries.

I expected that the submenu menuentries would use the values and would set them appropriately.

Revision history for this message
Kellen Renshaw (krenshaw) wrote :

My customized (via 40_custom) grub.cfg that displays the values of initrdfail (amongst others).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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