New PXE menu entry: Deploy Image & Shutdown
-
I would love to see an option to deploy an image then shutdown right on the PXE menu. It would save me from registering the machine and scheduling a deploy image with the shutdown check box checked. Anyway of doing this now via “iPXE New Menu Entry” in FOG?
-
The short answer is there is probably a way. You can set a global kernel parameter to tell the FOS engine to shutdown after its operation. But understand every operation that FOS does (FOS == customized version of linux that runs on the target computer) once it is done it will power off the system. That may not be what you want.
If you go into FOG Configuration -> FOG System Settings -> General Settings -> FOG_KERNEL_ARGS and insert
shutdown=1
The fos engine should shutdown after every operation.
-
No, that wouldn’t work. Right now, I’m imaging 100 machines. The way we build our images is we install Windows, get it updated with drivers then we run a script before we upload the image to Fog. The script is just a host rename and domain join, something that Fog client can do but we can’t use it due to the company not wanting us to use it. If a shutdown after imaging can be done as a new menu entry, it would save me from having to register the machines in Fog and starting them from the web UI with the shutdown check box checked. I didn’t know if you could set up the menu entry to schedule a shutdown after the imaging like you can do from the web ui.
-
@psyfer9983 Maybe I didn’t explain my idea well enough.
If you were to register the machine and deploy an image. If you select the check box that says shutdown after deployment the FOG server adds the kernel parameter
shutdown=1
to the instructions FOG tells FOS when booting the target computer.So what I propose is to just force that kernel parameter for every imaging event where you PXE boot the target computer. There is no need to register the target computer, there is no need for the fog client. This command happens in the imaging stage only.
-
Does anyone know if or how to set “shutdown=1” via pxe menu?
-
Testing something. I’ll let you know in about 15 minutes if it worked.
edit: Didn’t work. -
Is this a specific host? Are you wanting this for “every host regardless?”
-
@Tom-Elliott He wants after quick imaging to shutdown the computer, either by asking or just do it.
I thought the easiest way is with a kernel parameter.
-
@george1421 that sounds the easiest to me too. since it sounds like he’s not registering them and managing them in fog anyway. the only tasks it would affect are captures and deploys.
-
@george1421 It definitely is the easiest way, but if it’s specific to “quick imaging” goto:
FOG Configuration Page->iPXE Menu Configuration->fog.deployimage
InBoot Options:
add:shutdown=1
If you want it for ALL tasks (will not impact debug of course):
FOG Configuration Page->FOG Settings->General Settings->FOG_KERNEL_ARGS and add:shutdown=1
-
@Tom-Elliott said in New PXE menu entry: Deploy Image & Shutdown:
@george1421 It definitely is the easiest way, but if it’s specific to “quick imaging” goto:
FOG Configuration Page->iPXE Menu Configuration->fog.deployimage
InBoot Options:
add:shutdown=1
If you want it for ALL tasks (will not impact debug of course):
FOG Configuration Page->FOG Settings->General Settings->FOG_KERNEL_ARGS and add:shutdown=1
I just tried this and it did not work. Still booted to Windows after imaging.
-
@Avaryan Then something wasn’t done correctly. Did you have exactly
shutdown=1
? Code to validate is literally:
[[ $shutdown -eq 1 ]] && poweroff || reboot -f
-
@Avaryan Its important to not have spaces it should be one command
-
@Tom-Elliott Is there a way we can capture if the boot options field is translating into a kernel parameter for the quick image (yes I know its not called quick image any more).
-
@george1421 If they goto http://fogipaddress/fog/service/ipxe/boot.php?mac=<macofhostbooting>
You should see ‘shutdown=1’ in the list of arguments.
-
@Tom-Elliott said in New PXE menu entry: Deploy Image & Shutdown:
@Avaryan Then something wasn’t done correctly. Did you have exactly
shutdown=1
? Code to validate is literally:
[[ $shutdown -eq 1 ]] && poweroff || reboot -f
This is exactly what I have:
http://puu.sh/vT05Q/eae7a8eadc.pngDid not work. It was an unregistered host. Haven’t tried with a registered one.
FOG 1.4.0 Revision 6069.
edit: Deploying image to a different model now. Device is registered (although that shouldn’t matter?). ETA 15 minutes.
-
Right now, the only way I can get the shutdown to work is by adding the “shutdown=1” to the “FOG_KERNEL_ARGS”. It works but its set globally which is not what I’m looking for. I would like everything to function like it should on default settings (unless set when creating a task in the WebUI). I would like to just add a new entry that does the same thing as “Deploy Image” but with a shutdown after deploy. If I could pass the “shutdown=1” to “FOG_KERNEL_ARGS” via new pxe menu entry, this would be great as it would leave everything else as default settings.
FYI, I’m on version 1.3.3
-
@Tom-Elliott said in New PXE menu entry: Deploy Image & Shutdown:
This is what is currently in that PHP file, I don’t see the shutdown.
#!ipxe set fog-ip X.X.X.X set fog-webroot fog set boot-url http://${fog-ip}/${fog-webroot} cpuid --ext 29 && set arch x86_64 || set arch i386 iseq ${platform} efi && set key 0x1b || set key 0x1b iseq ${platform} efi && set keyName ESC || set keyName Escape prompt --key ${key} --timeout 3000 Booting... (Press ${keyName} to access the menu) && goto menuAccess || chain -ar ${boot-url}/service/ipxe/grub.exe --config-file="rootnoverify (hd0);chainloader +1" :menuAccess login params param mac0 ${net0/mac} param arch ${arch} param platform ${platform} param username ${username} param password ${password} param menuaccess 1 param debug 1 isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme :bootme chain -ar http://X.X.X.X/fog/service/ipxe/boot.php##params
-
Adding
shutdown=1
to the Boot Options for the deploy option does not work. Tested on 3 different devices. -
@Avaryan I can understand why (with my limited knowledge of the inner workings of FOG) the way the quick image menu is created. The quick image menu doesn’t call the the kernel load directly but it turns around and calls boot.php again which then creates a new menu for image selection. Its possible that the kernel parameter is getting lost on this second boot.php call.
or the field value for
shutdown=1
is wrong and should be written asparam shutdown 1
instead to be in line with what iPXE is expecting.