this post was submitted on 29 May 2024
5 points (100.0% liked)

Fedora Linux

1651 readers
1 users here now

All about Fedora Linux

founded 5 years ago
MODERATORS
 

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?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] -1 points 2 months ago (1 children)

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.

[–] [email protected] 2 points 2 months ago (1 children)

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

[–] [email protected] 1 points 2 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.