Ask Your Question

Revision history [back]

No, installing a new kernel does NOT run grub2-mkconfig. It directly edits the grub.conf file in your /boot directory. BTW, if the title, or the id of your custom entry is FIRST, it should be booted by default even if it is not the first entry in grub menu. Otherwise, put the id of your custom entry in GRUB_DEFAULT. For example, assume the custom entry is (stolen from info grub2 ;)):

menuentry 'Example GNU/Linux distribution' --class gnu-linux --id example-gnu-linux {
        ...
     }

You can set: GRUB_DEFAULT=example-gnu-linux, and it should be booted by default regardless of its position in the menu.

No, installing a new kernel does NOT run grub2-mkconfig. It directly edits the grub.conf file in your /boot directory. BTW, if the title, or the id of your custom entry is FIRST, it should be booted by default even if it is not the first entry in grub menu. Otherwise, put the id of your custom entry in GRUB_DEFAULT. For example, assume the custom entry is (stolen from info grub2 ;)):

menuentry 'Example GNU/Linux distribution' --class gnu-linux --id example-gnu-linux {
        ...
     }

You can set: GRUB_DEFAULT=example-gnu-linux, and it should be booted by default regardless of its position in the menu.

Update: If you want grub2-mkconfig to be run after each kernel install, you can create /etc/kernel/install.d directory and put an executable (e.g. shell script) in it. During kernel installation, it'll be called with these parameters: add "$KERNEL_VERSION" "$BOOT_DIR_ABS" "$KERNEL_IMAGE", in which you probably should only care about the first parameter: add (because the script will also run when a kernel is removed, in which case you probably don't need to run grub2-mkconfig).

All you need to do is to call grub2-mkconfig with appropriate parameters when the first argument of the script is add