I'm interested in configuring grub to allow selecting different sets of kernel parameters at boot time. I know I can edit the boot command line by hand, but this is tedious and error-prone. (An example might be to choose between the Nouveau and Nvidia drivers by selecting the appropriate menu entry). And of course I'd want this updated automatically with each new kernel version (i.e. each kernel would then have two alternative entries).
How feasible is this?
poc
I've got simmilar problem.
1) You should use BLSCFG. that way, you will have each boot entry as a standalone file - which is easily configurable - in "/boot/loader/entries".
2) You have to update the script that creates / updates the boot entries. which is "/usr/lib/kernel/install.d/20-grub.install" You shouldn't edit it directly. Rather drop your own configuration script(s) to "/etc/kernel/install.d/". If you will use the exact name used by the script in "/usr/lib/kernel/install.d/", it will be overriden by your script in "/etc/kernel/install.d/". So you can just copy the "20-grub.install" script there and customize as you like.
--
Michal Schorm Software Engineer Core Services - Databases Team Red Hat
--
On Mon, Apr 1, 2019 at 1:22 PM Patrick O'Callaghan pocallaghan@gmail.com wrote:
I'm interested in configuring grub to allow selecting different sets of kernel parameters at boot time. I know I can edit the boot command line by hand, but this is tedious and error-prone. (An example might be to choose between the Nouveau and Nvidia drivers by selecting the appropriate menu entry). And of course I'd want this updated automatically with each new kernel version (i.e. each kernel would then have two alternative entries).
How feasible is this?
poc _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
On Mon, 2019-04-01 at 13:32 +0200, Michal Schorm wrote:
I've got simmilar problem.
- You should use BLSCFG.
that way, you will have each boot entry as a standalone file - which is easily configurable - in "/boot/loader/entries".
- You have to update the script that creates / updates the boot entries.
which is "/usr/lib/kernel/install.d/20-grub.install" You shouldn't edit it directly. Rather drop your own configuration script(s) to "/etc/kernel/install.d/". If you will use the exact name used by the script in "/usr/lib/kernel/install.d/", it will be overriden by your script in "/etc/kernel/install.d/". So you can just copy the "20-grub.install" script there and customize as you like.
Thanks. That seems to be a change for F30, so not released yet. Can it be installed for F29?
poc
Patrick O'Callaghan wrote:
On Mon, 2019-04-01 at 13:32 +0200, Michal Schorm wrote:
I've got simmilar problem.
- You should use BLSCFG.
that way, you will have each boot entry as a standalone file - which is easily configurable - in "/boot/loader/entries".
- You have to update the script that creates / updates the boot entries.
which is "/usr/lib/kernel/install.d/20-grub.install" You shouldn't edit it directly. Rather drop your own configuration script(s) to "/etc/kernel/install.d/". If you will use the exact name used by the script in "/usr/lib/kernel/install.d/", it will be overriden by your script in "/etc/kernel/install.d/". So you can just copy the "20-grub.install" script there and customize as you like.
Thanks. That seems to be a change for F30, so not released yet. Can it be installed for F29?
You can manually enable it with the grub2-switch-to-blscfg command. I haven't tested it, but this is per the documentation in the change proposal:
https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault#Upgrade.2Fcom...
Best of luck if you decide to test it out. :)
On Mon, 2019-04-01 at 12:57 -0400, Todd Zullinger wrote:
Patrick O'Callaghan wrote:
On Mon, 2019-04-01 at 13:32 +0200, Michal Schorm wrote:
I've got simmilar problem.
- You should use BLSCFG.
that way, you will have each boot entry as a standalone file - which is easily configurable - in "/boot/loader/entries".
- You have to update the script that creates / updates the boot entries.
which is "/usr/lib/kernel/install.d/20-grub.install" You shouldn't edit it directly. Rather drop your own configuration script(s) to "/etc/kernel/install.d/". If you will use the exact name used by the script in "/usr/lib/kernel/install.d/", it will be overriden by your script in "/etc/kernel/install.d/". So you can just copy the "20-grub.install" script there and customize as you like.
Thanks. That seems to be a change for F30, so not released yet. Can it be installed for F29?
You can manually enable it with the grub2-switch-to-blscfg command. I haven't tested it, but this is per the documentation in the change proposal:
https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault#Upgrade.2Fcom...
Best of luck if you decide to test it out. :)
Yes. just saw that, thanks. Slightly nervous about trying it but we'll see.
poc
On Mon, Apr 1, 2019 at 5:22 AM Patrick O'Callaghan pocallaghan@gmail.com wrote:
I'm interested in configuring grub to allow selecting different sets of kernel parameters at boot time. I know I can edit the boot command line by hand, but this is tedious and error-prone. (An example might be to choose between the Nouveau and Nvidia drivers by selecting the appropriate menu entry). And of course I'd want this updated automatically with each new kernel version (i.e. each kernel would then have two alternative entries).
How feasible is this?
blscfg just moves Fedora menu entries from grub.cfg into their own file in /boot/loader/entries. It's easier to parse. You can duplicate them, and then edit the boot parameters however you want. But as for automatically duping them for each kernel you install, that's not a current feature. So you'll need to dup and modify, or script it.
You could probably get a tip on the help-grub list for duping the grub-mkconfig (grub2-mkconfig in Fedora) scripts, and modifying it to accept a new "GRUB_CMDLINE_LINUX2" line in /etc/default/grub. The original script would create an entry using GRUB_CMDLINE_LINUX and the modified script would create an entry using GRUB_CMDLINE_LINUX2, for each kernel found in /boot. Of course you'd have to manually run grub2-mkconfig after every kernel installation, as this isn't used by kernel post-install scripts. You could maybe hack grubby with a replacement bash script, so that when the kernel package calls grubby, it calls your bash script named grubby, which then just runs grub2-mkconfig.
On Tue, 2019-04-02 at 23:12 -0600, Chris Murphy wrote:
On Mon, Apr 1, 2019 at 5:22 AM Patrick O'Callaghan pocallaghan@gmail.com wrote:
I'm interested in configuring grub to allow selecting different sets of kernel parameters at boot time. I know I can edit the boot command line by hand, but this is tedious and error-prone. (An example might be to choose between the Nouveau and Nvidia drivers by selecting the appropriate menu entry). And of course I'd want this updated automatically with each new kernel version (i.e. each kernel would then have two alternative entries).
How feasible is this?
blscfg just moves Fedora menu entries from grub.cfg into their own file in /boot/loader/entries. It's easier to parse. You can duplicate them, and then edit the boot parameters however you want. But as for automatically duping them for each kernel you install, that's not a current feature. So you'll need to dup and modify, or script it.
You could probably get a tip on the help-grub list for duping the grub-mkconfig (grub2-mkconfig in Fedora) scripts, and modifying it to accept a new "GRUB_CMDLINE_LINUX2" line in /etc/default/grub. The original script would create an entry using GRUB_CMDLINE_LINUX and the modified script would create an entry using GRUB_CMDLINE_LINUX2, for each kernel found in /boot. Of course you'd have to manually run grub2-mkconfig after every kernel installation, as this isn't used by kernel post-install scripts. You could maybe hack grubby with a replacement bash script, so that when the kernel package calls grubby, it calls your bash script named grubby, which then just runs grub2-mkconfig.
Thanks. I'm probably too lazy to do this, though I might try posting an RFE for Grub to see if this can be supported in the future.
poc