How to update Memtest86+ to 6.20
-
Hello,
I’d like to update the version of memtest 86+ that comes preinstalled with fog and still be able to schedule memtest as a task from the Web GUI.
The currently newest version is 6.20 and supports UEFI PXE Boot.
fog version 1.5.10I tried replacing the memtest.efi-file in /fogproject/packages/web/service/ipxe with the newer one (memtest64.efi) and editing the memtest kernel name in the general fog settings.
But this leads to ‘Exec formatting Errors’ in iPXE.
What are the config-Files that might have to be edited and which files need to be placed where on the (freshly installed) fog-server?BR
Chris -
@NX06 I have not tried this update before so this will mostly be an educated guess to get you started. Note that you should not need to hack any FOG programming to make this newer version of memtest work.
Note1: Understand the version of memtest86 that ships with FOG only works with BIOS based computers. For UEFI computers you will need a uefi compatible kernel.
The FOG iPXE menu is created by the boot.php program. If you want to view the contents of the FOG iPXE menu just key in the following url into a brower.
http://<fog_server_ip>/fog/service/ipxe/boot.php
Looking at the programming code you will see this section that creates the menu on the screen.item fog.local Boot from hard disk >> item fog.memtest Run Memtest86+ item fog.reginput Perform Full Host Registration and Inventory item fog.reg Quick Registration and Inventory item fog.deployimage Deploy Image item fog.multijoin Join Multicast Session item fog.sysinfo Client System Information (Compatibility) choose --default fog.local --timeout 3000 target && goto ${target} :fog.local sanboot --no-describe --drive 0x80 || goto MENU >> :fog.memtest >> kernel memdisk initrd=memtest.bin iso raw >> initrd memtest.bin >> boot || goto MENU
I’ve highlighted the section of the code that is most important to you with the
>>
symbols.You see when you select the
Run Memtest86+
menu item it runs the commandskernel memdisk initrd=memtest.bin iso raw initrd memtest.bin
So the Kernel loaded will be memdisk which will intern load and run memtest.bin.
Note2: When you update the FOG settings General Settings->MEMTEST KERNEL its changing the iso image that will be loaded by the bios program memdisk. This is why with your configuration is failing. You are trying to chain to a uefi program (memtest64.efi) from a bios program (saying it using simple words).
So how should you fix this? Simply by creating a new FOG iPXE menu to replace the FOG supplied
Run Memtest86+
Your new FOG iPXE menu will be a bit smarter than the FOG supplied menu in that (if this works) when you pxe boot a bios based computer the legacy bios memtest will be used and when you pxe boot a uefi computer the uefi memtest will be used.iPXE is actually a programming language that creates and runs the FOG iPXE menu. Knowing this will will try to create a script that will call the bios files for a bios computer and uefi files for a uefi based computer.
if iseq ${platform} efi { kernel memtest64.efi boot || goto MENU } else { kernel memdisk initrd=memtest.bin iso raw initrd memtest.bin boot || goto MENU }
Note3;
I have not tested this to see if this script will work. I just glued bits of code together into a logical script.We test to see if the pxe booting platform is uefi or bios. If its uefi then we load your new memtest64 uefi file and boot it. If its bios then we call the FOG supplied commands.
ref: https://ipxe.org/cfg/platform
Now you have that script go into FOG Settings-> New iPXE menu.
Set the following fields
Menu Item: util.memtest64
Description: Run Memtest64+
Parameters:
if iseq ${platform} efi {
kernel memtest64.efi
boot || goto MENU
}
else {
kernel memdisk initrd=memtest.bin iso raw
initrd memtest.bin
boot || goto MENU
}
Menu Show with: All Hostsref: https://forums.fogproject.org/topic/10944/using-fog-to-pxe-boot-into-your-favorite-installer-images
Now pxe boot a uefi based computer and check to see if the new memtest program boots, then confirm that a bios based computer works.
-
This post is deleted! -
@george1421 Thank you for your writeup. That information helps a lot.
Tough it seems that the if-clause is not supported in that context, or that the syntax is off.After selecting the memtest64 option in the iPXE-Menu i got an error message of: “if: command not found”
Without the if-clause using only the efi instructions this solution worked flawlessly. Thank you for your help in that.Should this Parameters section in theory support these kinds of flow control?
Or is it expected/safer to call an additional script with the menu item to let that script then work through the logic? -
@NX06 Well researching this a bit more it seems like the if/then/else command is a bit more primitive than in my example.
Lets change this:
if iseq ${platform} efi { kernel memtest64.efi boot || goto MENU } else { kernel memdisk initrd=memtest.bin iso raw initrd memtest.bin boot || goto MENU }
Into this
goto mem-${platform} :mem-efi kernel memtest64.efi boot || goto MENU goto mem-exit :mem-pcbios kernel memdisk initrd=memtest.bin iso raw initrd memtest.bin boot || goto MENU goto mem-exit :mem-exit goto MENU
If everything works correctly it should never get to the :mem-exit location tag.
As I said I never tested it only glued it.
-
Just tested it and it works correctly.
Thank you for your effort.For other beginners with iPXE like me:
This is the relevant documentation for the flow control.
https://ipxe.org/scripting
With examples at
https://ipxe.org/examples -
-