IPXE Booting in Omniosce

Why PXE booting ?

With PXE booting you could ensure that all your fleet is running the same version of your operative system, and rollback changes pretty easily.

Requirements for PXE booting

To serve files to be used by pxe booting we need the following components:

  • An http server where the files will be hosted.
  • A kernel to boot (unix file in illumos)
  • A miniroot file (as it name says is a miniroot to be able to boot)
  • A ipxe script that will contain the instructions on where to fetch for files and what to use.
  • A client configuration script that contains instructions on what to do post booting.

Directory structure for pxe boot

In our http server we need the following directory structure to host the required files

kayak
├── 0
├── 02001702C8D6
├── ipxe.txt
├── omnios-bloody-20240215.zfs.xz
├── omnios-bloody-20240221.zfs.xz
└── platform
         └── i86pc
            ├── amd64
            │ └── boot_archive
            └── kernel
              └── amd64
                └── unix

Where to get those files?

0, 02001702C8D6

0 is used a last resort when there is no match to get a config file from install_config directory specified in the ipxe.txt script. A match is done using the mac address so to match you just need to create a file in the install_config directory with the mac address of your file all caps. 02001702C8D6 is the mac address of the interface used to pxe boot. This file will execute the commands post boot, here is the contents for 0:

BuildRpool c5t0d1
RootPW '$5$JQkyMDvv$pPzEUsvP/rLwURyrpwz5i1SfVqx2QiEoIdDA9ZrG271'
SetRootPW
SetHostname omniosbloody
SetTimezone UTC
Postboot '/sbin/ipadm create-if vioif0'
Postboot '/sbin/ipadm create-addr -T dhcp vioif0/v4'

ipxe script

This is the content of ipxe.txt file that will show us a menu that allows us to select what to boot.

#!ipxe

set omnios-build bloody
######## MAIN MENU ###################
:start
menu Welcome to iPXE's Boot Menu
item
item --gap -- ------------------------- Operating systems ------------------------------
item bloody    Boot Omnios (${omnios-build})
item --gap -- ------------------------------ Utilities ---------------------------------
item shell      Enter iPXE shell
item reboot     Reboot
item
item exit       Exit (boot local disk)
choose --default omnios --timeout 30000 target && goto ${target}

########## UTILITY ITEMS ####################
:shell
echo Type exit to get the back to the menu
shell
set menu-timeout 0
set kflags:hex 2d:6b:64
goto start
:reboot
reboot

:exit
exit

########## MENU ITEMS #######################
:bloody
dhcp
kernel platform/i86pc/kernel/amd64/unix  ${kflags:string} -B console=ttya,ttya-mode="115200,8,n,1,-" -B install_media=http://<your web server ip>/kayak/omnios-bloody-20240221.zfs.xz,install_config=http://<your webserver ip>/kayak
initrd platform/i86pc/amd64/boot_archive
boot
goto start

Booting

Now all you need is your server to pxe boot pointing to the configured http server that has directory structure described above. If you use the efi shell, then typing this will work (assuming you have downloaded ipxe.efi):

fs0:
ipxe.efi
(Control-B to exit to ipxe shell)
chain http://your-web-server/kayak/ipxe.txt

References