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

    PXE-less booting FOS client OS

    Scheduled Pinned Locked Moved Solved
    Feature Request
    4
    26
    10.1k
    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.
    • george1421G
      george1421 Moderator @ITSolutions
      last edited by george1421

      @ITSolutions The issue I see it (being able to quick image) as two fold.

      1. The target computer is already in the FOS OS, when that error is thrown, with a certain set of kernel parameters, to load quick image it would have to chain load to itself to change the kernel parameters (I don’t know if that is possible)
      2. I looked into the quick image but ran into an issue. The quick image is actually 2 iPXE screens. One is the main menu where quick image menu entry is and the second allows you to pick an image for deployment. With GRUB I can’t do dynamic screens (i.e update a grub menu based on a database query for the available images).

      I wouldn’t say the issue is impossible, but right now I want to focus on getting the basic image to capture and deploy from a USB boot. At this time I’m almost ready to call it complete.

      I can run all of the menu items and they work ( even reregistering a host, which reset all of the host parameters (not sure if that is a good thing) ). That all passes without error. The only one I’m stumbling on right now is booting to the local hard drive, and I may drop that if I can’t get it to work on more than a few systems.

      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!

      I 1 Reply Last reply Reply Quote 0
      • I
        ITSolutions Testers @george1421
        last edited by

        @george1421 Sounds great, like I had said I wasn’t sure if it was possible for quick image. If not I don’t see it as a big deal in my opinion. The exit to the HDD I think is a very small issue, If you want to go to the HDD just remove the USB key. lol
        I have been hoping for a usb boot option for a while, but I have very limit knowledge in creating such a thing and not enough time to explore and learn. Glad you and Tom are able to work on this part.

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

          This is really easy to add.

          Remember, we allow a method of creating a new host that asks if you would like to image the computer?

          Just a little extra code, but we can build the requests right into a script.

          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

          george1421G 1 Reply Last reply Reply Quote 1
          • george1421G
            george1421 Moderator @Tom Elliott
            last edited by

            @Tom-Elliott Tom you have to remember you can do everything. My programming tool box, is a bit limited. 😉

            If I can see and read the code I can copy it, that’s about it for programming.

            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

              Ask and you will have an example:
              This is straight from the “do you want to image now” but it should give a basic flow logic base.

               askme=""
               while [[ -z $askme ]]; do
                   echo -n "    Would you like to image this computer now? (y/N) "
                   read askme
                   case $askme in
                       [Nn]|[Nn][Oo]|"")
                           askme="N"
                           ;;  
                       [Yy]|[Yy][Ee][Ss])
                           tmp=""
                           ret=""
                           retry=3
                           while [[ $ret != "#!ok" && ! $retry -eq 0 ]]; do
                               echo " * Enter FOG GUI Username and Password"
                               echo -n "    Username: "
                               read username
                               echo -n "    Password: "
                               read -s password
                               user64=$(echo $username | tr -d '\012' | base64)
                               pass64=$(echo $password | tr -d '\012' | base64)
                               ret=$(wget --post-data="mac=$mac&username=$user64&password=$pass64" -qO - http://  ${web}service/checkcredentials.php 2>/dev/null)
                               case $ret in
                                   '#!ok')
                                       echo " * This host will reboot and imaging will start!"
                                       ret=$tmp
                                       realdoimage=$(echo -n 1 | base64)
                                       break
                                       ;;  
                                   '#!il')
                                       echo " * Error: Invalid Login! ($retry remaining)"
                                       let retry-=1
                                       ;;  
                               esac
                           done
                           askme="Y"
                           ;;  
                       *)  
                           askme=""
                           echo " * Invalid input, please try again"
                           ;;  
                   esac
               done
              

              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

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

                @Tom-Elliott That would be inserted in this section then?

                                if [ $boottype == usb ]; then
                                   handleError "Fatal Error: No scheduled task was found for this host.\n\nPlease schedule a task using the FOG webgui before usb booting this target host.\n"
                                else
                

                Instead of just telling them to make sure they setup a task, it would prompt them to run a quick image?

                [edit] Thinking about this more when you ask to image the machine the FOS client reboots and then boot.php set the right kernel parameters to start imaging. Is there a way to do this without rebooting? Like running the /bin/fog script again?

                [edit2] Just for clarity I don’t see anything where that script posts the do imaging now is that what realdoimage does?

                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!

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

                  @george1421 Again this was just to show an example of an approach.

                  Technically, with the use of your hostinfo.php stuff we no longer need to require a secondary reboot as the hostinfo.php will have the relevant information already accessible (with the exception that the registration base64 encodes all the variables where newer items no longer need this.)

                  It’s just an example I didn’t take anything for it though.

                  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

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

                    @Tom-Elliott But it is very close to what we need. We would just have to post to the fog server that we wanted to image, refresh the hostinfo.php and then relaunch the main fog script. It sounds plausible.

                    The part 2 of this is I can see is someone will want to then (next) quick image an unregistered computer like they can do today with the iPXE menus. That wouldn’t be such an easy task since we would have to then query for available images (inside FOS) update the variables and then launch the quick image function.

                    [edit] Now that I think about it, except for the query image to deploy, the rest is possible without much headache.

                    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!

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

                      @george1421 It’s not that difficult. In fact, quick image is probably even simpler.

                      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

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

                        For this part of the PXE-less boot the FOS client, I think its a wrap (finished). There is sure some nice to haves that can be done inside the inits but for the usb and the usb booting part I think I’ve reached the end. While I’ve only tested this on a bios system, I expect it to work under uefi too.

                        Here is the final grub menu for this iteration. I plan on writing a complete tutorial on how to build this usb later tonight.

                        set myfogip=192.168.1.88
                        set myimage=/boot/bzImage
                        set myinits=/boot/init.xz
                        set myloglevel=4
                        set timeout=-1
                        insmod all_video
                        
                        menuentry "1. FOG Image Deploy/Capture" {
                         echo loading the kernel
                         linux  $myimage loglevel=$myloglevel initrd=init.xz root=/dev/ram0 rw ramdisk_size=127000 keymap= web=$myfogip/fog/ boottype=usb consoleblank=0 rootfstype=ext4
                         echo loading the virtual hard drive
                         initrd $myinits
                         echo booting kernel...
                        }
                        
                        menuentry "2. Perform Full Host Registration and Inventory" {
                         echo loading the kernel
                         linux  $myimage loglevel=$myloglevel initrd=init.xz root=/dev/ram0 rw ramdisk_size=127000 keymap= web=$myfogip/fog/ boottype=usb consoleblank=0 rootfstype=ext4 mode=manreg
                         echo loading the virtual hard drive
                         initrd $myinits
                         echo booting kernel...
                        }
                        
                        menuentry "3. Quick Registration and Inventory" {
                         echo loading the kernel
                         linux  $myimage loglevel=$myloglevel initrd=init.xz root=/dev/ram0 rw ramdisk_size=127000 keymap= web=$myfogip/fog/ boottype=usb consoleblank=0 rootfstype=ext4 mode=autoreg
                         echo loading the virtual hard drive
                         initrd $myinits
                         echo booting kernel...
                        }
                        
                        menuentry "4. Client System Information (Compatibility)" {
                         echo loading the kernel
                         linux  $myimage loglevel=$myloglevel initrd=init.xz root=/dev/ram0 rw ramdisk_size=127000 keymap= web=$myfogip/fog/ boottype=usb consoleblank=0 rootfstype=ext4 mode=sysinfo
                         echo loading the virtual hard drive
                         initrd $myinits
                         echo booting kernel...
                        }
                        
                        menuentry "5. Run Memtest86+" {
                         linux /boot/memdisk iso raw
                         initrd /boot/memtest.bin
                        }
                        
                        menuentry "6. FOG Debug Kernel" {
                         echo loading the kernel
                         linux  $myimage loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 keymap= boottype=usb consoleblank=0 rootfstype=ext4 isdebug=yes
                         echo loading the virtual hard drive
                         initrd $myinits
                         echo booting kernel...
                        }
                        
                        

                        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 1
                        • S
                          Sebastian Roth Moderator
                          last edited by Sebastian Roth

                          Great stuff you’re coming up with here @george1421! Unfortunately I didn’t have the time to read it all to the last bit. So forgive me if I am asking things you already wrote about here. How are you going to put this all together to boot from USB/ISO? Are you using grub-mkrescue as mentioned here? Just curious…

                          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

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

                            @Sebastian-Roth No I will (probably) just modify my bash script I used to create the FOS-L usb. That seemed to be the easiest and creates both bios and uefi usb images on the same usb. I need to review that tutorial I did and then just merge in the new GRUB boot menu. Really there is no magic that goes on in the flash drive other than the grub boot menu and a few tweaks Tom did to some files in the inits, well and the hostinfo.php from another feature request. The difficult part was just gluing all of the bits together.

                            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 2
                            • george1421G
                              george1421 Moderator @Tom Elliott
                              last edited by george1421

                              @Tom-Elliott Just thinking about the next steps here…

                              I have to work on a few extra projects for my real job right now, but I’m thinking ahead a little.

                              In funcs.sh, can we move the code to pickup the kernel parameters and to call hostinfo.php into its own sub function? That we can reuse and call at different points in both the init scripts and via the post install scripts? That way I can reuse that code and have a consistent way of getting the parameters.

                              I could imagine a sub called getKernelParams() that could be called, and in that sub function if the ( boottype=usb ) then it would call a second function getHostInfo() to pick up the host info (that way too we can call getHostInfo() by its self to pick up the host details from the post install script(s) too (at this time I personally don’t care about the kernel parameters in the post install script, but if I did I could just call the getKernelParams instead). Then of course the /bin/fog script would need to take advantage of these new functions.

                              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
                              • 1
                              • 2
                              • 2 / 2
                              • First post
                                Last post

                              190

                              Online

                              12.0k

                              Users

                              17.3k

                              Topics

                              155.2k

                              Posts
                              Copyright © 2012-2024 FOG Project