FOG boot alternatives
-
@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
-
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. -
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?
-
@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 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.
-
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.
-
@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).
-
@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.
-
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
- If the host is registered and you created a tasking on the fog server
-
@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.- imgid = look at the browser address URL the
id
value from url is the imgid value - img = the value in the
Image Name
field - imgType = Image Type (calculated from Tom’s table. In the example above imgType of
n
== resizable) - 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
- imgid = look at the browser address URL the