Adding a custom host task
-
We’ve been using fog (1.2.0 currently) at our school for several years now, it has made our lives a lot easier. Starting this year we have to use a new client for school exams. This client comes as a stand alone image. We’ve tested it via the ISO first, which worked just fine. Now I’ve added it to the advanced PXE boot menu.Works great as well. Since we have to start this image on 30-60 computers at once and students should not have access to our PXE boot menu we figured it would be great to push it the same way memtest is started. Unfortunately I am unable to find any directions to do this.
I’ve come as far as to add it to the host management menu by adding it to the taskTypes table. I basically copied the settings from memtest and adjusted them so I could boot my own kernel. This does not seem to work though, whatever I do, it seems to boot the default kernel followed by a kernel panic. When starting Memtest it boots directly to memtest.
First of all the path seems off, memtest uses fog/memtest/memtest according to ttKernel. Our bootimages are in fog/bootimages/ though. I searched the disk for “fog/memtest/memtest” and found 2 backups of fog 0.32, another installer of 0.32 and /opt/kernel/fog-trunk/packages/tftp/fog/memtest/memtest. To verify fog is actually using this path I renamed memtest and tried to boot it on the client expecting it to fail as the file doesn’t exist. I could still boot memtest though… I did the same with the one in bootimages to verify and several others I found in partly-matching paths (who knows) but none made me able to break memtest. Where is it loading memtest from? Or better yet, how do I add my own kernel/image which already works when selected manually via the boot menu?
-
We really want to help - please provide more details.
Many of the users that frequent the forums work for school districts.
It’s highly unlikely that you have a unique school-district related issue that nobody else has heard of.
What’s the program name? Version?
What OS is your FOG Server running on?
Also, please provide links to relevant materials if you can.
Please provide what you’ve added to your FOG menu so far, what files you’ve edited, any custom changes.
We ( the @Developers and @Moderators ) want to give you the best suggestion possible, we simply need more exact details before we can do that. I hope you understand.
-
The problem isn’t related to the program itself as far as I can tell. It’s called “facet” though, it’s made by the Dutch government. No version is mentioned in it. The Client runs some Linux. (the Facet server runs Centos 6.5 so it’s possible the client uses files from that) It’s stored as vmlinuz0 and initrd0.img. (It also comes with pxelinux files but those aren’t used in the working fog config, ie pxe advanced menu)
Our Fog server (1.2.0) runs on Debian 4.6.3-14.I figured that if I could break memtest I’d have a clue as to why I can’t load another kernel.
I’ve added just this menu to the taskTypes tables. Basically a copy of the memtest entry. The advanced boot menu is full of various boot images, this is unrelated to the host manager though.
-
Not sure if you are aware of this. The boot menu is mostly generated by /var/www/fog/lib/fog/BootMenu.class.php which itself is called when clients access http://ip.of.fog.srv/fog/service/ipxe/boot.php
You can simulate this by opening the URL in your browser and adding a parameter with a MAC address of one of your clients: http://ip.of.fog.srv/fog/service/ipxe/boot.php?mac=aa:bb:cc:dd:ee:ff
You should see the full menu code in your browser. Hope I could give you a little more insight into this.
-
That actually helped.
We followed the code from boot.php, were somewhat surprised to find quite some things hardcoded. In bootmenu.class.php on line 536 we found:
else if ($Task->get('typeID') == 4) { print "#!ipxe\n"; print "$this->memdisk iso raw\n"; print "$this->memtest\n"; print "boot"; }
We copied this and added exactly the same with ur own task ID (24) and added our boot lines. It now works in combination with the taskTypes entry. (in which ttKernel or ttKernelArgs do nothing apparently)
For possible dutch fog+facet users:
else if ($Task->get('typeID') == 24) { print "#!ipxe\n"; print "kernel http://fogserver/fog/bootimages/facet/vmlinuz0 rootflags=loop initrd=initrd0.img root=live:/configured-bcld.iso rootfstype=auto ro rd.live.image rd.live.ram rd.luks=0 rd.md=0 rd.dm=0 \n"; print "initrd http://fogserver/fog/bootimages/facet/initrd0.img\n"; print "boot"; }
-
@StefanTS Hacking the FOG code is not recommended. Doing so will trouble you for each upgrade that will come. The update cycle is much faster than between 0.32 and 1.20.
With that said, what are you doing here? I read your post two different ways.
- You want to PXE boot certain clients with a custom boot image via the fog menu. This boot image works when booting from a CDROM.
- You have an exam application supplied via CDROM ISO image and you want to deploy that to 30-60 computers.
If you have an existing ipxe settings files that information will help. The trunk version of FOG has many new features not available in the 1.2.0 core image. Just a word of warning on the trunk version (pre 1.3.0), this platform still has a few bugs in it, but it is very usable. The bugs are stamped out by the devs as soon as they are reported. If you want to test the 1.2.0 SVN trunk I would do this on a new VM/hardware so you don’t run the risk shutting down your production environment.
Anyway the SVN trunk allows you to add custom pxe menu items from within the FOG GUI.
[Edit] Sorry I just saw your post with the ipxe settings. Let me see if I can do the same thing with my FOG test VM. [/Edit]
-
OK, if I understand what you want to do (Add a custom ipxe boot menu item). I have been able (on paper) put together a partial solution for you. This solution assumes you are running a SVN trunk upgrade from the core 1.2.0 release.
If you go into the FOG settings and add a custom IPXE menu item. Add these settings:
Menu Item: Dutch.Exams
Description: Dutch Exams ExampleParameters:
kernel /bootimages/facet/vmlinuz0 rootflags=loop initrd=initrd0.img root=live:/configured-bcld.iso rootfstype=auto ro rd.live.image rd.live.ram rd.luks=0 rd.md=0 rd.dm=0
initrd /bootimages/facet/initrd0.img
boot || goto MENUThen press save.
You can view the results of this setting by pointing your browser at the following url
http://<fog_server_ip>/fog/service/ipxe/boot.phpThis will show you the ipxe menu that will be presented to the ipxe menu application
The file path on the fog server is (on rhel) /var/www/html/fog/service/ipxe/
Now the part I don’t know about. You will notice that in my ipxe menu I have a path for the boot kernel. I don’t know if we can create a symbolic link from the path above to where your files are stored and then include that in the ipxe menu command. Or just go the easy route and dump your exam kernel and initrd files in /var/www/html/fog/service/ipxe I think it would be safer for your files to have a sym link from /var/www/html/fog/service/ipxe/<something > to your file location.
As I said (on paper) this should work without having to dig into the FOG code if you are willing to use the SVN trunk.
I found a wiki that talks about setting up dban under FOG: https://wiki.fogproject.org/wiki/index.php/Include_any_ISO_in_the_FOG_Bootmenu
-
@Sebastian-Roth said:
Not sure if you are aware of this. The boot menu is mostly generated by /var/www/fog/lib/fog/BootMenu.class.php which itself is called when clients access http://ip.of.fog.srv/fog/service/ipxe/boot.php
You can simulate this by opening the URL in your browser and adding a parameter with a MAC address of one of your clients: http://ip.of.fog.srv/fog/service/ipxe/boot.php?mac=aa:bb:cc:dd:ee:ff
You should see the full menu code in your browser. Hope I could give you a little more insight into this.
Tagging this for the wiki
-
@StefanTS @george1421 I did recently ask the iPXE guys about network booting… They said something to the effect of - not all filesystems support being accessed over HTTP, and they recommended mounting the ISO as read only via NFS, and then having the boot menu entries point to that.
Booting DBAN over HTTP works, but in my experience, most other ISOs won’t work over HTTP.
Here’s the iPXE thread: http://forum.ipxe.org/showthread.php?tid=7859
Those guys give solid advice, this needs added to the wiki -
@StefanTS maybe I’m misreading but are asking to create a new task as in download/upload? If you are is ask that you upgrade to trunk as I have created a plugin that will allow you to define a new task type. Of course it would also mean you need to edit your own init once complete so they can interact appropriately for your new task type.
-
@Wayne-Workman said:
@StefanTS @george1421 I did recently ask the iPXE guys about network booting… They said something to the effect of - not all filesystems support being accessed over HTTP, and they recommended mounting the ISO as read only via NFS, and then having the boot menu entries point to that.
See that’s where we need a bit of clarification on the OP post. Looking at the additional information provided, I don’t see any reference to an ISO in his commands (even though he did mention it in his OP) What I see from his commands are sending the kernel and init file system to a target machine via a menu item, much like how FOG works. But then he also mentions tasks and the task type table. Which makes me think he might be trying to deploy this to a client machine and not via the FOG ipxe menu as I originally thought.
-
@george1421
I get the confusion with the ISO after rereading, my bad. The ISO was the initial test. After that we’ve used the PXE client, ie vmlinuz0 + initrd0.img. In fact, the ISO wouldn’t boot via pxe (problems mounting its filesystem)@Tom Elliott
What I wanted to do, and did via the hack, is indeed use the webinterface in fog. We have a group made for all computers in a classroom so we can simply click on the group > basic tasks > start facet. That way all 32 computers in the classroom boot the exam interface. When the exams are done we remove the facet task and the computers go back to booting form the harddisk with their regular image.
Using the iPXE bootmenu for this was not a solution (apart from testing network boot itself) as we’d have to manually boot 32 PC’s or give students access to the boot menu. (it’s passworded)
I’ll upgrade my testserver at home and see if the latest version offers better support for this out of the box.I understand hacking the code should not be the way to go. Unfortunately in 1.2.0 this option seems to be hardcoded. Upgrading obviously would be better in the long run, but as it is it’ll be too much of a hassle. 0.32 > 1.2.0 came with enough issues for us already. I’ll save that task for next year. (meaning jan-feb)
As for ISO over HTTP. It works fine for us most of the time (we have a rich collection of ISO’s to boot from the regular iPXE menu) Several DOS images to flash the BIOS of several PC models, ultimate bootcd, partwiz, all kinds of handy tools.
-
@StefanTS If this tasking is really just a form to tell the system what to boot to (i suppose tasking could do it too), the SVN/Trunk/Dev versions of FOG do allow you to create your own menu options AND tell the system which option to boot to (default). Meaning, new menu items can be added to the default menu and you can tell it if you want it passworded or not. The “default” option tells the system that it’s the default selected item and when the timeout is met, it will boot that default option.
-
@Tom-Elliott Can it be set for just a particular group though?
-
@Wayne-Workman I don’t understand what you mean?
-
@Tom-Elliott Perhaps @StefanTS does not want to set this testing software as the default item for all the systems in his environment? Perhaps he only wants to set it for a specific group of computers. That’s what I was asking.
-