FOG boot alternatives



  • Hello. I run a small computer repair shop that sees dozens of different machines from various OEMs each day. Many are a few years old or more. I setup FOG earlier this year, and it is absolutely amazing - however, I have not been able to consistently use FOG on machines without a built-in ethernet jack; namely Ultrabook PCs. Some do not support it at all, others seem to require that the iPXE builds I’m creating use specific USB-to-NIC adapters.

    For instance, today I was working on a 1st-generation Lenovo X1 Carbon; there is no way to get this thing to PXE boot on a USB NIC! Thus I have to install Windows the old fashioned way (and wait 20 hours for the updates to finish).

    Anyways, what I’d like to do (as a workaround) is figure out the proper way to boot systems like this into a compatible environment - for instance, in the CloneZilla days I could just boot Parted Magic and load CZ from there. Is there a similar approach in FOG? Is this the right direction to go?

    Thank you for your time.

    PS The FOG server is running on Ubuntu 16.04 64bit.


  • Moderator

    @Tom-Elliott Thank you for the excellent detailed information. From that info I’ve been able to come up with a workable solution. Its not complete, but is workable. if we were to update the hostinfo.php script to pull in the extra info the kernel call could be simpler by 3 variables. But that is a discussion for another time since this grub line will work, it will just take the OP a little leg work to collect all of the info.

    Here is the menu entry that works on my server.

    menuentry "1b. FOG Quick Image Deploy Win10Ent" {
     echo loading the kernel
     linux  $myimage loglevel=$myloglevel initrd=init.xz root=/dev/ram0 rw ramdisk_size=127000 keymap= web=$myfogip/fog/ storage=$myfogip:/images/ storageip=$myfogip boottype=usb consoleblank=0 rootfstype=ext4 imgPartitionType=all chkdsk=0 capone=1 type=down imgid=19 img=WIN10ENTX64 imgType=n osid=9 
     echo loading the virtual hard drive
     initrd $myinits
     echo booting kernel...
    }
    

    The fields that will change per image are these imgid=19 img=WIN10ENTX64 imgType=n osid=9
    All of this information can be collected from the FOG Web GUI image page. If you go to the FOG web gui and select an image in question.

    1. imgid = look at the browser address URL the id value from url is the imgid value
    2. img = the value in the Image Name field
    3. imgType = Image Type (calculated from Tom’s table. In the example above imgType of n == resizable)
    4. osid = Operating System (the osid value is the number in the parentheses in my case the list box says Windows 10 (9))

    That should do it. Just update those 4 fields for each new menu entry matching the image type you want to push.

    For reference this grub.conf file is located on the FOS USB boot drive in the following directory ../boot/grub


  • Senior Developer

    Slight recap:

    Needed bits to ensure all works properly:

    • If the host is registered and you created a tasking on the fog server
      – mac=<macofhost>
      – osid=<osidOfImage>
      – 1. 1 = 2000/XP
      – 2. 2 = Vista
      – 3. 3 = Win 98
      – 4. 4 = Other Windows
      – 5. 5 = Windows 7
      – 6. 6 = Windows 8
      – 7. 7 = Windows 8.1
      – 8. 8 = Apple Mac OS
      – 9. 9 = Windows 10
      –10. 50 = Linux
      –11. 99 = Other
      – imgPartitionType=<all, or partition number>
      – img=<imageName>
      – imgid=<imageID>
      – imgFormat=<format 0 or blank = partclone, 1 = partimage>
      – imgType=< n = resizable, mpa = Multi partition all disk non resizable, mps = Multi partition single disk non resizable, dd= raw>
      – storageip=<IP of fog server>
      – storage=<IP of fog server>:<path to images location>(Used for NFS connection)
      – web=<IP Of fog server> (This is used to communicate progress info to the server, check in, check out, etc…).
    • For non registered hosts or you don’t want to make a tasking, you will need:
      – osid=<osidOfImage>
      – 1. 1 = 2000/XP
      – 2. 2 = Vista
      – 3. 3 = Win 98
      – 4. 4 = Other Windows
      – 5. 5 = Windows 7
      – 6. 6 = Windows 8
      – 7. 7 = Windows 8.1
      – 8. 8 = Apple Mac OS
      – 9. 9 = Windows 10
      –10. 50 = Linux
      –11. 99 = Other
      – imgPartitionType=<all, or partition number>
      – img=<imageName>
      – imgid=<imageID>
      – imgFormat=<format 0 or blank = partclone, 1 = partimage>
      – imgType=< n = resizable, mpa = Multi partition all disk non resizable, mps = Multi partition single disk non resizable, dd= raw>
      – storageip=<IP of fog server>
      – storage=<IP of fog server>:<path to images location>(Used for NFS connection)
      – web=<IP Of fog server> (This is used to communicate progress info to the server, check in, check out, etc…).
      – capone=1

  • Moderator

    @Tom-Elliott Sorry about not being clear on this one. That code fragment was in regards to the code section of this post: https://forums.fogproject.org/topic/7727/building-usb-booting-fos-image/4

    The grub.conf contains those variables you questioned. I got the grub boot to start the FOS kernel but it got hung up during booting at checking in to the FOG server. Where it kept looping every 5 seconds trying to check in.

    What I was attempting to do is a quick image without needing to register the target computer with FOG. In regards to the OPs post he just needs to deploy a standard set of images to a random collection of computers. He doesn’t need FOG to manage them (I’m envisioning what he needs is some type of fancy clonezilla setup, but using the power of FOG). What I’m trying to do is create a grub menu that simulates the selection of the ipxe quick image menu.

    Thank you for the detailed information, its going to take a bit to digest all of that detail.


  • Senior Developer

    @george1421 If a host is registered, the tasking should actually be present on the fog server.

    Now, I could be wrong, but where are $myimage, $myfogip,$myloglevel and$myinits defined?

    The $myimage I imagine should be the “kernel” you’re trying to load (typically bzImage).
    The $myloglevel I think could be statically defined (typically it’s set at 4 if you just wanted to get to a “working” state.

    The “false” tasking I have is: currently defined as:

    #!ipxe
    set fog-ip 10.0.7.1
    set fog-webroot
    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.0.7.1/ consoleblank=0 rootfstype=ext4 mac= ftp=10.0.7.1 storage=10.0.7.1:/images/ storageip=10.0.7.1 osid=5 irqpoll chkdsk=0 img=win7 imgType=n imgPartitionType=all imgid=1 imgFormat= shutdown=0 capone=1 type=down
    imgfetch init_32.xz
    boot
    

    Replacing the ipxe components out with the grub function I might think:

    menuentry "1c. FOG Quick Image Deploy Win7" {
        echo loading the kernel
        linux bzImage loglevel=4 initrd=init.xz root=/dev/ram0 rw ramdisk_size=127000 web=10.0.7.1/ consoleblank=0 rootfstype=ext4 mac= ftp=10.0.7.1 storage=10.0.7.1:/images/ storageip=10.0.7.1 osid=5 irqpoll chkdsk=0 img=win7 imgType=n imgPartitionType=all imgid=1 imgFormat= shutdown=0 capone=1 type=down boottype=usb
        initrd init.xz
    }
    

    None of this will work without knowing the imgPartitionType, imgid, imgType, and img. (Yes this is needed too).

    Now the components (Variables I might create?):
    $myimage should equal the binary kernel to boot to, in my case bzImage (the 64 bit kernel).
    $myinits should equal the binary fs to boot to, in my case init.xz (the 64 bit fs).
    $myloglevel should be (you guessed it) the loglevel which is 4.
    $myfogip should be the IP of the fogserver (in my case it’s 10.0.7.1).
    $myosid should be the osid of the of the image being sent. (my case would be 5).
    $myimg should be the name of the image.
    $myimgid (The id of the image to send)
    $myimgPartitionType (The image partition type – typically all)
    $myimgFormat (The format 0, or empty for partclone, 1 for partimage).
    $mytype (The type of image to perform – not strictly necessary)
    $myramsize (The ramdisk_size)
    $mymac (The host’s mac address).

    This would change the function to look more like:

    menuentry "1c. FOG Quick Image Deploy Win7" {
        echo loading the kernel
        linux $myimage loglevel=$myloglevel initrd=$myinits root=/dev/ram0 rw ramdisk_size=$myramsize web=${myfogip} consoleblank=0 rootfstype=ext4 mac=${mymac} ftp=${myfogip} storage=${myfogip}:/images/ storageip=$myfogip osid=$myosid irqpoll chkdsk=0 img=$myimg imgType=$myimgType imgPartitionType=$myimgPartitionType imgid=$myimgid imgFormat=$myimgFormat shutdown=0 capone=1 type=$mytype boottype=usb
        initrd $myinits
    }
    

    The important bit here is the “capone=1” portion. This is what tricks the system to do the work without requiring a “valid” generated task. (meaning a host doesn’t have to be registered for this to work).


  • Moderator

    I’ve had some success but not a WIN yet. I can USB boot FOS but it get stopped attempting to check in to the FOG server. I must be still missing something. But for documentation purposes this is what I have so far for a new grub entry.

    menuentry "1c. FOG Quick Image Deploy Win10Ent" {
     echo loading the kernel
     linux  $myimage loglevel=$myloglevel initrd=init.xz root=/dev/ram0 rw ramdisk_size=127000 keymap= web=$myfogip/fog/ storage=$myfogip://images/ storageip=$myfogip boottype=usb consoleblank=0 rootfstype=ext4 imgid=19 type=down osid=9
     echo loading the virtual hard drive
     initrd $myinits
     echo booting kernel...
    }
    

    I’m going to have to unpack the FOS virtual hard drive to see where/why the quick image deployment is not checking into the FOG server or what parameter is missing. Please understand we ( I ) am attempting to do something that FOG was never designed to do.

    In theory it should work, but also in theory pushed hard enough a pig should fly too.


  • Moderator

    @george1421 Well heck that was easy… I’d like to think I was smarter than I was 6 months ago. I have the answer I think I need.

    Let me see if it works as we need it.


  • Moderator

    @yochaigal This is correct. If you look in the grub.conf you can see the proper FOS boot commands for the defined actions. If we knew what the proper boot commands were for quick image (we must define the exact image we want to boot) then we could create additional menu items to call the quick image from the fos boot.

    I tried to figure it out by reverse engineering it. But got stuck on an issue and then moved on.



  • @george1421

    If I understand you correctly, this would be exactly what I’m looking for. Would the end result simply require a custom grub.cfg that calls the image process?


  • Moderator

    We could probably BASH together an interactive menu that asks for username/pass and then just parses items from the below URL call via wget and then from that - display another dynamic menu via BASH for image selection. You could go ahead and lead the charge, or you could wait for me and I could script it when I get some time.


  • Moderator

    @george1421 I briefly read over the params article over at the ipxe website, and did some playing around and was able to hack it together. The ##params variable is just expanded into get variables on the URL. The below worked for me.

    http://10.0.0.3/fog/service/ipxe/boot.php?mac=aa:bb:cc:dd:ee:ff&arch=x86&username=wayne&password=MyAmazingPassword&qihost=1
    

    Going to that URL on my FOG server gives me this, which looks good:

    #!ipxe
    set fog-ip 10.0.0.3
    set fog-webroot fog
    set boot-url http://${fog-ip}/${fog-webroot}
    goto MENU
    :MENU
    menu
    item Acerbase Acer-base
    item CentOS7VM CentOS7-VM
    item compaq_cq60_Ubuntu16 compaq_cq60_Ubuntu16
    item Optiplex380CentOS7 Optiplex-380-CentOS7
    item Windows10 Win10Machine
    item Win2012R2 Win2012R2
    item Win7 Win7
    item return Return to menu
    choose target && goto ${target}
    :Acerbase
    set imageID 9
    params
    param mac0 ${net0/mac}
    param arch ${arch}
    param imageID ${imageID}
    param qihost 1
    param username ${username}
    param password ${password}
    isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme
    isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme
    :CentOS7VM
    set imageID 8
    params
    param mac0 ${net0/mac}
    param arch ${arch}
    param imageID ${imageID}
    param qihost 1
    param username ${username}
    param password ${password}
    isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme
    isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme
    :compaq_cq60_Ubuntu16
    set imageID 10
    params
    param mac0 ${net0/mac}
    param arch ${arch}
    param imageID ${imageID}
    param qihost 1
    param username ${username}
    param password ${password}
    isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme
    isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme
    :Optiplex380CentOS7
    set imageID 3
    params
    param mac0 ${net0/mac}
    param arch ${arch}
    param imageID ${imageID}
    param qihost 1
    param username ${username}
    param password ${password}
    isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme
    isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme
    :Windows10
    set imageID 4
    params
    param mac0 ${net0/mac}
    param arch ${arch}
    param imageID ${imageID}
    param qihost 1
    param username ${username}
    param password ${password}
    isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme
    isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme
    :Win2012R2
    set imageID 11
    params
    param mac0 ${net0/mac}
    param arch ${arch}
    param imageID ${imageID}
    param qihost 1
    param username ${username}
    param password ${password}
    isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme
    isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme
    :Win7
    set imageID 1
    params
    param mac0 ${net0/mac}
    param arch ${arch}
    param imageID ${imageID}
    param qihost 1
    param username ${username}
    param password ${password}
    isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme
    isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme
    :return
    params
    param mac0 ${net0/mac}
    param arch ${arch}
    isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme
    isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme
    :bootme
    chain -ar http://10.0.0.3/fog/service/ipxe/boot.php##params
    goto MENU
    

  • Moderator

    @yochaigal no once its registered then all you need to do is change the image associated with the host and then schedule a deploy.

    With that said, if someone was pretty smart, you could update the grub configuration to call the FOG quick image function. This would let you deploy an image from the target system and never need to touch the FOG server itself. The issue with the quick image function right now is it requires the iPXE kernel to load the image selections to pick in the menu. If one of the @Developers could provide me with an example of a quick image kernel boot/load call, we could do some interesting things with the FOS usb boot drive. Understand this would be a one off situation for each FOG environment, but I think it would be pretty cool if it worked.

    The idea is to create a grub menu to call the correct quick image kernel boot with the proper settings to tell fog to quick image the target system. This way you wouldn’t need to register the computers at all. You would do this because you are using fog to image systems one time and then may never see that computer again (IT repair shop). I have a picture in my head of what needs to be done, what’s missing is the quick image call to boot FOS.



  • @george1421

    Ooooh, I see. The primary use here is to setup deploy tasks (typically updated Windows images). Would I need to add the USB NIC’s MAC each time?


  • Moderator

    @yochaigal said in FOG boot alternatives:

    Running Version 1.3.0-RC-29
    SVN Revision: 6031

    I built the FOS client but I get an error after the menu: fatal error unknown request type null

    This I can help you with, kind of. This is the caveat I warned you about. You MUST schedule a capture or deploy task BEFORE pxe booting the client. Normally the fog iPXE menu would take care of this for us, but since we are not using it/scheduled so the target doesn’t know what to do.

    go back and schedule a task first then pxe boot the target computer.



  • Running Version 1.3.0-RC-29
    SVN Revision: 6031

    First, I built a BIOS bootable client:
    After ensuring the BIOS is in Legacy mode, I try booting the USB stick. It gets to iPXE initializing devices… and then quickly flashes some text, only to return to the boot devices screen.

    Second, I built a UEFI bootable client:
    Switching to UEFI mode in the BIOS, the USB is completely ignored.

    I built the FOS client but I get an error after the menu: fatal error unknown request type null

    Finally I created a debug USB, I can boot to the debug console but am unsure where to go from there.



  • Hi,

    at work i have to do with Surface 3 / 4 and HP X2.
    For both devices (no embedded wired nic) you need external USB Devices.

    In my case for the Surface s*** i take the original Surface USB 3.0 Ethernet Stick (available since the Surface 3):

    alt text

    For the HP X2’s i take their original USB Type C Dock:

    alt text

    Regards X23


  • Moderator

    @yochaigal said in FOG boot alternatives:

    @george1421
    The BIOS must also support it, yes?

    For bios mode if the network adapter has a pxe boot rom (and some usb ethernet adapters do) then it will work in (almost) any device in bios mode. But understand that pxe booting in bios mode has been around since 2001 so its well established. The key is to get the network adapter with the PXE roms.



  • @george1421
    The BIOS must also support it, yes?


  • Moderator

    @yochaigal In uefi mode yes for typically OEM, in the case of bios mode, as long as the network device supports PXE booting and has a pxe rom installed then any device will work. For uefi mode only supported network adapters can be used (i.e. that lenovo usb adapter may not work in a Dell in uefi mode)



  • @x23piracy

    I’m going to order one of these adapters, thanks! Am I to understand that OEMs require specific USB chipsets (in this case, Lenovo) in order to PXE boot over USB?


Log in to reply
 

366
Online

39.5k
Users

11.1k
Topics

105.7k
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.