• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

New PXE menu entry: Deploy Image & Shutdown

Scheduled Pinned Locked Moved
Feature Request
5
27
9.0k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G
    george1421 Moderator
    last edited by george1421 May 11, 2017, 2:24 PM May 11, 2017, 8:15 PM

    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.

    Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

    1 Reply Last reply Reply Quote 0
    • P
      psyfer9983
      last edited by psyfer9983 May 11, 2017, 9:37 PM May 11, 2017, 8:28 PM

      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.

      G 1 Reply Last reply May 11, 2017, 8:45 PM Reply Quote 0
      • G
        george1421 Moderator @psyfer9983
        last edited by May 11, 2017, 8:45 PM

        @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.

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

        1 Reply Last reply Reply Quote 0
        • P
          psyfer9983
          last edited by May 17, 2017, 1:36 PM

          Does anyone know if or how to set “shutdown=1” via pxe menu?

          1 Reply Last reply Reply Quote 0
          • A
            Avaryan
            last edited by Avaryan May 17, 2017, 10:25 AM May 17, 2017, 4:07 PM

            Testing something. I’ll let you know in about 15 minutes if it worked.
            edit: Didn’t work.

            1 Reply Last reply Reply Quote 0
            • T
              Tom Elliott
              last edited by May 17, 2017, 4:26 PM

              Is this a specific host? Are you wanting this for “every host regardless?”

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

              Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

              Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

              G 1 Reply Last reply May 17, 2017, 4:34 PM Reply Quote 0
              • G
                george1421 Moderator @Tom Elliott
                last edited by May 17, 2017, 4:34 PM

                @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.

                Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                J T 2 Replies Last reply May 17, 2017, 4:38 PM Reply Quote 0
                • J
                  Junkhacker Developer @george1421
                  last edited by Junkhacker May 17, 2017, 10:38 AM May 17, 2017, 4:38 PM

                  @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.

                  signature:
                  Junkhacker
                  We are here to help you. If you are unresponsive to our questions, don't expect us to be responsive to yours.

                  1 Reply Last reply Reply Quote 0
                  • T
                    Tom Elliott @george1421
                    last edited by May 17, 2017, 4:38 PM

                    @george1421 It definitely is the easiest way, but if it’s specific to “quick imaging” goto:
                    FOG Configuration Page->iPXE Menu Configuration->fog.deployimage
                    In Boot 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

                    Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                    Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                    Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                    A 1 Reply Last reply May 17, 2017, 4:41 PM Reply Quote 1
                    • A
                      Avaryan @Tom Elliott
                      last edited by May 17, 2017, 4:41 PM

                      @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
                      In Boot 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.

                      T G 2 Replies Last reply May 17, 2017, 4:45 PM Reply Quote 0
                      • T
                        Tom Elliott @Avaryan
                        last edited by May 17, 2017, 4:45 PM

                        @Avaryan Then something wasn’t done correctly. Did you have exactly shutdown=1? Code to validate is literally:
                        [[ $shutdown -eq 1 ]] && poweroff || reboot -f

                        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                        G A 2 Replies Last reply May 17, 2017, 4:57 PM Reply Quote 0
                        • G
                          george1421 Moderator @Avaryan
                          last edited by May 17, 2017, 4:56 PM

                          @Avaryan Its important to not have spaces it should be one command

                          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                          1 Reply Last reply Reply Quote 0
                          • G
                            george1421 Moderator @Tom Elliott
                            last edited by May 17, 2017, 4:57 PM

                            @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).

                            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                            T 1 Reply Last reply May 17, 2017, 5:07 PM Reply Quote 0
                            • T
                              Tom Elliott @george1421
                              last edited by May 17, 2017, 5:07 PM

                              @george1421 If they goto http://fogipaddress/fog/service/ipxe/boot.php?mac=<macofhostbooting>

                              You should see ‘shutdown=1’ in the list of arguments.

                              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                              Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                              Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                              P 1 Reply Last reply May 17, 2017, 6:22 PM Reply Quote 0
                              • A
                                Avaryan @Tom Elliott
                                last edited by Avaryan May 17, 2017, 11:39 AM May 17, 2017, 5:32 PM

                                @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.png

                                Did 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.

                                1 Reply Last reply Reply Quote 0
                                • P
                                  psyfer9983
                                  last edited by psyfer9983 May 17, 2017, 12:19 PM May 17, 2017, 6:18 PM

                                  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

                                  1 Reply Last reply Reply Quote 0
                                  • P
                                    psyfer9983 @Tom Elliott
                                    last edited by May 17, 2017, 6:22 PM

                                    @Tom-Elliott said in New PXE menu entry: Deploy Image & Shutdown:

                                    http://fogipaddress/fog/service/ipxe/boot.php?mac

                                    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
                                    
                                    1 Reply Last reply Reply Quote 0
                                    • A
                                      Avaryan
                                      last edited by May 17, 2017, 7:02 PM

                                      Adding shutdown=1 to the Boot Options for the deploy option does not work. Tested on 3 different devices.

                                      G 1 Reply Last reply May 17, 2017, 7:10 PM Reply Quote 0
                                      • G
                                        george1421 Moderator @Avaryan
                                        last edited by May 17, 2017, 7:10 PM

                                        @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 as param shutdown 1 instead to be in line with what iPXE is expecting.

                                        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                                        1 Reply Last reply Reply Quote 0
                                        • T
                                          Tom Elliott
                                          last edited by May 18, 2017, 2:27 AM

                                          Mind trying this?

                                          wget -O /var/www/fog/lib/fog/bootmenu.class.php https://raw.githubusercontent.com/FOGProject/fogproject/working/packages/web/lib/fog/bootmenu.class.php
                                          

                                          TLDR; I’m an idiot though it was meant with good intentions, please try above and let me know if it’s better.


                                          Apparently when I was adding the API, I was trying to ensure the API was stateless and was making adjustments to elements using $_SESSION variables. The boot menu script (what I’m asking you to copy) had a few of them for something I implemented a while ago to address this very problem. Not thinking about it when making adjustments, I removed all the relevant bits and didn’t replace them. My initial thoughts were that there wasn’t anything in the boot menu requiring those SESSION elements. I’ve readded these bits and maintained the “stateless” element of the script. While I did re-add these things, my tests are currently limited to simple browser checks calling out to a rather direct url. As such, a test going into deployimage would be extremely useful from a “full” run.

                                          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                                          Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                                          Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                                          A 2 Replies Last reply May 18, 2017, 3:00 AM Reply Quote 0
                                          • 1
                                          • 2
                                          • 1 / 2
                                          1 / 2
                                          • First post
                                            11/27
                                            Last post

                                          153

                                          Online

                                          12.0k

                                          Users

                                          17.3k

                                          Topics

                                          155.2k

                                          Posts
                                          Copyright © 2012-2024 FOG Project