• 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.
  • 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
                        • A
                          Avaryan @Tom Elliott
                          last edited by Avaryan May 17, 2017, 9:12 PM May 18, 2017, 3:00 AM

                          @Tom-Elliott I’ll test in the morning (8 hours from now) when I get back to my office. Although I could probably connect to VPN and deploy image into a VM.

                          edit: I ran the script and updated the file on my test server. Can’t access a computer on the correct vlan to deploy an image to. Will continue in the morning.

                          1 Reply Last reply Reply Quote 0
                          • A
                            Avaryan @Tom Elliott
                            last edited by May 18, 2017, 11:05 AM

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

                            https://raw.githubusercontent.com/FOGProject/fogproject/working/packages/web/lib/fog/bootmenu.class.php

                            Ok. I’ve done the following.

                            root@hs-fog:~# wget -O /var/www/fog/lib/fog/bootmenu.class.php https://raw.githu                                                                                        busercontent.com/FOGProject/fogproject/working/packages/web/lib/fog/bootmenu.cla                                                                                        ss.php
                            --2017-05-17 23:03:43--  https://raw.githubusercontent.com/FOGProject/fogproject                                                                                        /working/packages/web/lib/fog/bootmenu.class.php
                            Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.124.1                                                                                        33
                            Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.124.                                                                                        133|:443... connected.
                            HTTP request sent, awaiting response... 200 OK
                            Length: 62089 (61K) [text/plain]
                            Saving to: ‘/var/www/fog/lib/fog/bootmenu.class.php’
                            
                            /var/www/fog/lib/fo 100%[===================>]  60.63K  --.-KB/s    in 0.03s
                            
                            2017-05-17 23:03:44 (1.97 MB/s) - ‘/var/www/fog/lib/fog/bootmenu.class.php’ save                                                                                        d [62089/62089]
                            
                            root@hs-fog:~# reboot
                            

                            After reboot I booted to pxe menu with a registered host and deployed an image to it with the modified “Deploy Image” option.

                            I then went to this address.
                            http://10.20.21.136/fog/service/ipxe/boot.php?mac=<hostmac>

                            And got the following results:

                            #!ipxe
                            set fog-ip 10.20.21.136
                            set fog-webroot fog
                            set boot-url http://${fog-ip}/${fog-webroot}
                            kernel bzImage32 loglevel=4 initrd=init_32.xz root=/dev/ram0 rw ramdisk_size=127000 web=10.20.21.136/fog/ consoleblank=0 rootfstype=ext4 storage=10.20.21.136:/images/ storageip=10.20.21.136 mac=<hostmac> ftp=10.20.21.136 storage=10.20.21.136:/images/ storageip=10.20.21.136 osid=9 irqpoll hostname=<hostname> chkdsk=0 img=Windows10 imgType=n imgPartitionType=all imgid=1 imgFormat=0 PIGZ_COMP=-9 hostearly=1 type=down
                            imgfetch init_32.xz
                            boot
                            

                            It’s deploying now. I don’t see the shutdown=1 option in there.

                            1 Reply Last reply Reply Quote 0
                            • A
                              Avaryan
                              last edited by May 19, 2017, 1:44 AM

                              So, I never did get this to work. I got busy and was unable to reply back while I was at work.

                              T 1 Reply Last reply May 19, 2017, 1:48 AM Reply Quote 0
                              • T
                                Tom Elliott @Avaryan
                                last edited by May 19, 2017, 1:48 AM

                                @Avaryan I suspect what’s wrong, though I don’t have a good fix coming for it right now :(.

                                I have to think of a way to pass in extra args and it’s not always the simplest thing.

                                I think an approach to help address this would be:
                                Add a new field per each “menu option” that allows you to check “shutdown” or not. This way I can make it pass a variable, theoretically, from one window to the next for that menu item. Just my thoughts though. I don’t have a quick fix quite yet. Sorry 😞

                                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 20, 2017, 3:20 AM Reply Quote 0
                                • A
                                  Avaryan
                                  last edited by May 19, 2017, 1:54 AM

                                  Not a big deal for me. I’m not even the one who requested this, lol.

                                  1 Reply Last reply Reply Quote 0
                                  • P
                                    psyfer9983 @Tom Elliott
                                    last edited by May 20, 2017, 3:20 AM

                                    @Tom-Elliott Thank you for trying. That field per each menu option would be great. As for now, we are setting Fog kernel with shutdown=1 when we need to mass deploy machines before sending them out to the sites and then remove the shutdown setting. Its a little hassle, but hey, it works. I’ll keep an eye out on newer releases to see if you manage to get the shutdown field put in.

                                    1 Reply Last reply Reply Quote 0
                                    • 1
                                    • 2
                                    • 2 / 2
                                    2 / 2
                                    • First post
                                      20/27
                                      Last post

                                    210

                                    Online

                                    12.0k

                                    Users

                                    17.3k

                                    Topics

                                    155.2k

                                    Posts
                                    Copyright © 2012-2024 FOG Project