I’ve got my multi-gpu setup working and I’d like to have 2 options during the boot (grub2):
As normal, both gpus available
One gpu passed through for vm, iommu enabled
I have successfully set those individually but I’d like to have a list for choosing a suitable variant on system start, depending whether I need both gpus for computing the 3d renders, or whether I need the secondary gpu in VM (when I need to launch a cad app in vm, as sadly there are no designer cad apps on Linux and the ones I use, for example Rhino, are very buggy in Wine even if I manage to start them).
How should I approach that? My guess is that I should modify /etc/default/grub file somehow, in a manner similar to the one I do when setting up passthrough, but I have no clue how.
ok, so basically what I’d like to achieve is to have 2 menu entries on system start. BOth almost identical. The only difference (apart from name - would be cool to name one “Multi GPU” and other “Pcie Passthrough” for example) would be that one would have “intel_iommu=on” added to kernel parameters.
Also it would be best to set it up so it won’t break after kernel update.
I’ve spent last hour going through various resources hinting it is doable but none showed how. Usually they’ve concentrated on something else. Any suggestions are welcome. At this point I’m not even sure whether it needs /etc/default/grub modification only or setting up /etc/grub.d/ script.
Currently grub.cfg is dynamically (re-)generated by running scripts in /etc/grub.d. So yes, to have second set of menu entries you would need to have script in /etc/grub.d that would emit these entries.
It may be possible to (ab-)use recovery menu entries by setting GRUB_CMDLINE_LINUX_RECOVERY, but then titles will be confusing (it will name menu entry “…(recovery)” which does not match intended purpose anymore.
I would take a few lines from “grub.cfg” and copy them there. Then I would modify as desired. And I would have them use the symlinks “vmlinuz” and “initrd” in “/boot” rather than the explicit kernel version, because that way I would not need to keep editing my changes on every kernel update.
You only need the submenus if you need to be able to boot to an older kernel.
If you change “vmlinuz-4.4.104-39-default” to just “vmlinuz”, and change “initrd-4.4.104-39-default” to just “initrd”, then you won’t have problems after a kernel update. The kernel update changes those symlinks to the newest kernel, so you will always get that. And you can manually change them back to an older kernel if the newest kernel turns out to be broken, though you will lose your manual change on the next kernel update.