How to debug systemd/grub "marking a boot as successful" not working as it is supposed to?

The problem I’m trying to debug is: At every boot, the second boot entry in the grub menu is selected (not the latest kernel, but the one that was installed before it, usually one version older). I tried digging through log files and the systemd journal, but the only entries I could find are:

  • Starting Mark boot as successful...
  • grub-boot-success.service: Deactivated successfully.
  • Finished Mark boot as successful.

This seems to me that everything is fine, the boot succeeded, no problems, and next time, the same kernel should be booted again. However, after rebooting, the second entry (an older kernel, not the one that was supposedly marked as “successful”) is preselected again.

I have also checked grubenv, where the saved_entry points to the latest kernel, and boot_success=1 is listed. Still, at next boot, grub chooses an older kernel again (always the one at position 2).

I tried digging through systemd unit files (grub2-systemd-integration.service, grub-boot-{success,indeterminate}.service) and /usr/libexec/grub2/systemd-integration.sh, but I find it hard to understand how they are supposed to work.

Any idea what might cause this? As I said, logs and journal show only that everything worked, the grubenv file is exactly 1024 bytes long, and this issue has been bugging me (no pun intended - okay, maybe a little) for months, on both Fedora 33 and 34.

3 Likes

Boot ends in Dracut Emergency Shell with warning that root device does not exist - #6 by vgaetera

Upon further investigation, it looks like my /etc/default/grub file was really old and no longer matched the GRUB configuration expected on Fedora 33 and 34 - is that file supposed to be updated by something? It’s only ghost-owned by grub2-tools

1 Like

Turns out, my install survived so many upgrades that GRUB_DEFAULT=saved wasn’t present in /etc/default/grub. After adding it, it seems to work as expected. :man_shrugging:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.