[os-prober] microcode still in grub.cfg after first update-grub

Bug #2052382 reported by Alban Ponche
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
os-prober (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

If you install microcode-initrd and then remove it, after the FIRST update-grub, reference to microcode.cpio. but /boot/microcode.cpio don't exists anymore, causing boot failure.

This problem only occure when using os-prober AND having SUBMENU enabled in grub.

This is due to use of /usr/lib/linux-boot-probes/mounted/40grub2, in os-prober, wich use grub.cfg, but when update-grub run, it's grub.cfg.new which is the new reference.

I propose managing grub.cfg.new in 40grub2 :

<code>
96c96,101
< if [ -e "$mpoint/boot/grub/grub.cfg" ] && \
---
> # If fresh grub.cfg.new exists, we where in update-grub/grub-mkconfig generation cycle
> GRUB_NEW=$(find ${mpoint}/boot/grub/ -maxdepth 1 -type f -name grub.cfg.new -mmin -5 || true)
> if [ -n "${GRUB_NEW}" ];then
> debug "parsing grub.cfg.new"
> parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub/grub.cfg.new"
> elif [ -e "$mpoint/boot/grub/grub.cfg" ] && \
<code>

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in os-prober (Ubuntu):
status: New → Confirmed
Revision history for this message
Guillaume (e1msih) wrote :

Replicated on 20.04 & 22.04 with an AWS virtual machine.
Removing linux-aws, then microcode-initrd with autoremove, which ran update-grub but keep the microcode.cpio call on initrd lines.
Boot is ko.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Patch file" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Guillaume (e1msih) wrote :

I got another case so here's some logs :

# apt-get purge linux-aws microcode-initrd
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'linux-aws' is not installed, so not removed
The following packages will be REMOVED:
  microcode-initrd*
0 upgraded, 0 newly installed, 1 to remove and 11 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 151421 files and directories currently installed.)
Purging configuration files for microcode-initrd (2~20.04.0) ...
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-171-generic
Found initrd image: /boot/initrd.img-5.4.0-171-generic
Found linux image: /boot/vmlinuz-5.4.0-170-generic
Found initrd image: /boot/initrd.img-5.4.0-170-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
[INFO] Checking initrd image...
  [INFO] Checking '/initrd.img-5.4.0-171-generic'...
  [INFO] Checking '/initrd.img-5.4.0-171-generic'...
  [INFO] Checking '/initrd.img-5.4.0-170-generic'...
  [INFO] Checking '/microcode.cpio'...
    [WARN] File '/boot/microcode.cpio' does not exists.
    [ERROR] No initrd found for '/boot/microcode.cpio'

# update-grub2
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-171-generic
Found initrd image: /boot/initrd.img-5.4.0-171-generic
Found linux image: /boot/vmlinuz-5.4.0-170-generic
Found initrd image: /boot/initrd.img-5.4.0-170-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
[INFO] Checking initrd image...
  [INFO] Checking '/initrd.img-5.4.0-171-generic'...
  [INFO] Checking '/initrd.img-5.4.0-171-generic'...
  [INFO] Checking '/initrd.img-5.4.0-170-generic'...
  [INFO] Checking '/microcode.cpio'...
    [WARN] File '/boot/microcode.cpio' does not exists.
    [ERROR] No initrd found for '/boot/microcode.cpio'

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.