Results 1 to 8 of 8

Thread: How do you setup boot variants

  1. #1

    Default How do you setup boot variants

    I've got my multi-gpu setup working and I'd like to have 2 options during the boot (grub2):

    1. As normal, both gpus available
    2. 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.

  2. #2

    Default Re: How do you setup boot variants

    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.

  3. #3
    Join Date
    Sep 2012
    Posts
    4,972

    Default Re: How do you setup boot variants

    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.

  4. #4

    Default Re: How do you setup boot variants

    I've came across this one:
    https://docs-old.fedoraproject.org/e...stom_Menu.html

    so far it is the best guide I've found (at least for what I want to achieve). Before committing the changes I'll post what I did here so hopefully someone more experienced could review those .

  5. #5
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,353
    Blog Entries
    3

    Default Re: How do you setup boot variants

    Quote Originally Posted by Pshemas View Post
    How should I approach that?
    I would do that in "/etc/grub.d/40_custom".

    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.
    openSUSE Leap 15.1; KDE Plasma 5;

  6. #6

    Default Re: How do you setup boot variants

    thx @nrickert . That's the part I'm missing - I thought I had to do it some "special" way to make those changes "stick" after kernel update. So far I assume the entries would look something like that:

    Code:
    menuentry 'openSUSE Leap 42.3 - NO IOMMU'  --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-3d697a71-17d6-4e7f-80df-2a202bc82583' {
    	load_video
    	set gfxpayload=keep
    	insmod gzio
    	insmod part_gpt
    	insmod ext2
    	set root='hd0,gpt2'
    	if [ x$feature_platform_search_hint = xy ]; then
    	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  391753fe-f39e-414b-92dc-505c512f73ae
    	else
    	  search --no-floppy --fs-uuid --set=root 391753fe-f39e-414b-92dc-505c512f73ae
    	fi
    	echo	'Wczytywanie systemu Linux 4.4.104-39-default...'
    	linuxefi /vmlinuz-4.4.104-39-default root=UUID=3d697a71-17d6-4e7f-80df-2a202bc82583 ro  resume=/dev/disk/by-uuid/0addf297-4cab-4973-8faa-d6338dc8b573 splash=silent quiet showopts
    	echo	'Wczytywanie początkowego dysku RAM...'
    	initrdefi /initrd-4.4.104-39-default
    }
    
    menuentry 'openSUSE Leap 42.3 - IOMMU ON'  --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-3d697a71-17d6-4e7f-80df-2a202bc82583' {
    	load_video
    	set gfxpayload=keep
    	insmod gzio
    	insmod part_gpt
    	insmod ext2
    	set root='hd0,gpt2'
    	if [ x$feature_platform_search_hint = xy ]; then
    	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  391753fe-f39e-414b-92dc-505c512f73ae
    	else
    	  search --no-floppy --fs-uuid --set=root 391753fe-f39e-414b-92dc-505c512f73ae
    	fi
    	echo	'Wczytywanie systemu Linux 4.4.104-39-default...'
    	linuxefi /vmlinuz-4.4.104-39-default root=UUID=3d697a71-17d6-4e7f-80df-2a202bc82583 ro  resume=/dev/disk/by-uuid/0addf297-4cab-4973-8faa-d6338dc8b573 splash=silent quiet showopts intel_iommu=on
    	echo	'Wczytywanie początkowego dysku RAM...'
    	initrdefi /initrd-4.4.104-39-default
    }
    + the remaining submenu entries from grub.cfg .

    So 2 questions:
    1. Are the remaining submenu etc entries from grub.cfg needed in my 40_custom file? If I understand the structure correctly it seems I should add only my custom menu entries there.
    2. How I modify my custom entries so they would pick new kernel after updating?

  7. #7
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,353
    Blog Entries
    3

    Default Re: How do you setup boot variants

    Quote Originally Posted by Pshemas View Post
    1. Are the remaining submenu etc entries from grub.cfg needed in my 40_custom file? If I understand the structure correctly it seems I should add only my custom menu entries there.
    2. How I modify my custom entries so they would pick new kernel after updating?
    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.
    openSUSE Leap 15.1; KDE Plasma 5;

  8. #8
    Join Date
    Sep 2012
    Posts
    4,972

    Default Re: How do you setup boot variants

    Quote Originally Posted by Pshemas View Post
    I assume the entries would look something like that:

    Code:
    menuentry 'openSUSE Leap 42.3 - NO IOMMU'  --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-3d697a71-17d6-4e7f-80df-2a202bc82583' {
    Menu entry ID is supposed to be unique. If you copy existing menu entry you should really change ID to something different. This allows using these ID to set default entry later.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •