Custom boot config per host/group
-
I am currently setting up a network consisting of different types of hosts to image. One of those different types are HP Z2 workstations which suffer from a bug in rEFInd described here. While I was able to work around this by setting a manual boot entry in refind.conf, this effectively creates even more problems with other systems then HP which do not necessarily label their EFI partition SYSTEM.
Is it possible to set different refind.conf files for different hosts? Would there be a different solution to only effect the HP hosts with this solution? And if both answers are no, would it be possible to implement such a feature in FOG?
Kind regards and thanks for the help.
-
The short answer is fog doesn’t support more than one uefi exit mode config file.
With that said you may be able to hack (read update) the FOG code to support this. What version of FOG are you using?
-
@TheBitFighter said in Custom boot config per host/group:
Is it possible to set different refind.conf files for different hosts?
Would there be a different solution to only effect the HP hosts with this solution?No for both as far as I know. Though I have to admit that I am not part of the project since the beginning and there might be something I am not aware of yet.
And if both answers are no, would it be possible to implement such a feature in FOG?
Absolutely. FOG is open source and you can implement anything you want. Just start by looking at bootmenu.class.php (line 160). Here you see an array of the entries which will be available for selection in the web UI. So you can just add your custom entry here:
... $refind_hp = sprintf( 'imgfetch ${boot-url}/service/ipxe/refind_hp.conf%s' . 'chain -ar ${boot-url}/service/ipxe/refind_x64.efi', "\n" ); ... self::$_exitTypes = array( 'sanboot' => $sanboot, 'grub' => $grub['basic'], 'grub_first_hdd' => $grub['basic'], 'grub_first_cdrom' => $grub['1cd'], 'grub_first_found_windows' => $grub['1fw'], 'refind_efi' => $refind, 'refind_efi_hp' => $refind_hp, 'exit' => 'exit', ); ...
As well you need to add your custom exit type to another file called service.class.php for it to be select-able in the host/group settings:
... $types = array( 'sanboot', 'grub', 'grub_first_hdd', 'grub_first_cdrom', 'grub_first_found_windows', 'refind_efi', 'refind_efi_hp', 'exit', ); ...
-
@Sebastian-Roth Thanks… I JUST finished reverse engineering the answer…
I happened to come up with the same answer too…vi lib/fog/service.class.php
$types = array( 'sanboot', 'grub', 'grub_first_hdd', 'grub_first_cdrom', 'grub_first_found_windows', 'refind_efi', 'refind2_efi', 'exit', );
and vi lib/fog/bootmenu.class.php
$refind2 = sprintf( 'imgfetch ${boot-url}/service/ipxe/refind2.conf%s' . 'chain -ar ${boot-url}/service/ipxe/refind_x64.efi', "\n" );
self::$_exitTypes = array( 'sanboot' => $sanboot, 'grub' => $grub['basic'], 'grub_first_hdd' => $grub['basic'], 'grub_first_cdrom' => $grub['1cd'], 'grub_first_found_windows' => $grub['1fw'], 'refind_efi' => $refind, 'refind2_efi' => $refind2, 'exit' => 'exit', );
systemctl restart httpd
-
Here you see an array of the entries which will be available for selection in the web UI. So you can just add your custom entry here:
I will try using this workaround. It should do exactly what I’m trying to accomplish.
What version of FOG are you using?
1.5.7
Thank you for your help everybody!
-
@TheBitFighter If you get stuck modifying the php code, I can give you a bit clearer step by step.
If you totally mess up the php code, just rerun the fog installer and it will reinstall off the original code.
-
I implemented the fix in my setup. It works HOWEVER just copying refind.conf and renaming it WILL NOT WORK!
rEFInd seems to hardcoded look for refind.conf and WILL NOT ACCEPT a file named differently. I worked around this by naming both files refind.conf and putting them in different folders.Thanks again for your help!