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

    New PXE menu entry: Deploy Image & Shutdown

    Scheduled Pinned Locked Moved
    Feature Request
    5
    27
    10.3k
    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.
    • Tom ElliottT
      Tom Elliott @george1421
      last edited by

      @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 Reply Quote 0
      • AvaryanA
        Avaryan @Tom Elliott
        last edited by Avaryan

        @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

          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

            @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
            • AvaryanA
              Avaryan
              last edited by

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

              george1421G 1 Reply Last reply Reply Quote 0
              • george1421G
                george1421 Moderator @Avaryan
                last edited by

                @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
                • Tom ElliottT
                  Tom Elliott
                  last edited by

                  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

                  AvaryanA 2 Replies Last reply Reply Quote 0
                  • AvaryanA
                    Avaryan @Tom Elliott
                    last edited by Avaryan

                    @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
                    • AvaryanA
                      Avaryan @Tom Elliott
                      last edited by

                      @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
                      • AvaryanA
                        Avaryan
                        last edited by

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

                        Tom ElliottT 1 Reply Last reply Reply Quote 0
                        • Tom ElliottT
                          Tom Elliott @Avaryan
                          last edited by

                          @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 Reply Quote 0
                          • AvaryanA
                            Avaryan
                            last edited by

                            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

                              @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
                              • First post
                                Last post

                              131

                              Online

                              12.2k

                              Users

                              17.4k

                              Topics

                              155.5k

                              Posts
                              Copyright © 2012-2024 FOG Project