I installed a GRUB theme and changed some options in the config but now I need to run update-grub (alias for grub2-mkconfig -o /etc/grub2-efi.cfg) after every kernel update or else that new kernel version won’t boot. Does anybody know a fix for this?

  • jrgd@lemm.ee
    link
    fedilink
    arrow-up
    2
    ·
    7 months ago

    Checking inside /usr/lib/kernel/install.d/, you can see the mechanisms in place for installing new kernel entries. Not knowing what you did to your config (did you back it up before making changes?), you should check if the entries are being populated properly in /boot/loader/entries/. If they are, you have likely toyed with the BLS config in some way that broke being able to load dynamic entries without mkconfig.

    If that is indeed the case, I wouldn’t know exactly what you touched to break it, but this discussion forum might give some insight.

    If this isn’t the problem, it might be helpful to post your grub config minus any sensitive details to help determine what is going wrong.

    • Fisch@discuss.tchncs.deOP
      link
      fedilink
      arrow-up
      1
      ·
      7 months ago

      I only installed the theme (I think by using grub customizer) and then I changed some options in /etc/default/grub to e.g. show a submenu for the kernel versions instead of having them all in one list. I don’t know what BLS is but I have the option GRUB_ENABLE_BLSCFG set to false, if I remember correctly, I set that to false because the theme wouldn’t show up otherwise or something. But from your comment, it sounds like BLS has something to do with dynamically loading kernel entries, so maybe setting that to false is the source of my issue.

      • jrgd@lemm.ee
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        7 months ago

        Based on how the script /usr/lib/kernel/install.d/99-grub-mkconfig.install (a script that runs on kernel installations) behaves, unless you are running in Xen Hypervisor or are on an architecture that doesn’t support it, Fedora by default expects to have GRUB_ENABLE_BLSCFG set to true. This script is provided by the package grub2-common, so it’s unlikely it can be removed without removing the GRUB bootloader’s management system entirely.

        More than likely, most customizations will work just fine with GRUB_ENABLE_BLSCFG set to true as long as you properly run grub-mkconfig (or just update-grub) after you make those changes so that they get applied to the bootloader portion of GRUB itself.

        If for some reason you do absolutely need to disable BLS in order to get the customization you want, the proper way to enforce grub-mkconfig on new kernels would be to write a script in the /usr/lib/kernel/install.d/ directory titled like 98-grub-manual-mkconfig.install that would forcibly run the proper mkconfig command after kernel installation and initramfs generation.

        • Fisch@discuss.tchncs.deOP
          link
          fedilink
          arrow-up
          1
          ·
          7 months ago

          I just tested it, enabling GRUB_ENABLE_BLSCFG fixed the issue. Unfortunately, submenus don’t work with it enabled. That was probably why I disabled it. Thanks for your help.

  • yala
    link
    fedilink
    arrow-up
    1
    arrow-down
    3
    ·
    7 months ago

    ChatGPT gave the following. Follow at your own risk. Most important is to check if the file locations are compatible with Fedora.

    To automate running the update-grub command after each kernel update, you can create a script and set it up to run automatically. Here’s a more direct approach:

    1. Open a text editor and create a new script file. For example, you can name it “update_grub.sh”.

    2. In the script file, add the following lines:

      #!/bin/bash
      /usr/sbin/update-grub
      
    3. Save the script file in a location where it can be easily accessed, such as your home directory.

    4. Make the script executable by running the following command in the terminal:

      chmod +x /path/to/update_grub.sh
      
    5. Next, you can set up a cron job to run this script automatically. Open your crontab file by running:

      crontab -e
      
    6. Add a new line at the end of the crontab file to schedule the script to run after each kernel update. For example:

      @reboot /path/to/update_grub.sh
      
    7. Save and exit the crontab file.

    With these steps, the update-grub command will be executed automatically after each kernel update, ensuring that the new kernel version boots successfully.

    • jrgd@lemm.ee
      link
      fedilink
      arrow-up
      2
      ·
      7 months ago

      This seems like a terrible bandage fix rather than letting the system mechanisms do what they are supposed to.

      • Fisch@discuss.tchncs.deOP
        link
        fedilink
        arrow-up
        1
        ·
        7 months ago

        I’ll probably end up doing something like this if I don’t find out how to actually solve this issue but yeah, it’s just a bandaid fix for another issue. I wonder if it might be an issue that needs to be fixed by the Fedora maintainers themselves but I’d like to find out what’s actually causing it before reporting it.