{"id":280,"date":"2022-02-13T20:15:55","date_gmt":"2022-02-13T20:15:55","guid":{"rendered":"http:\/\/10.171.10.16:10000\/?p=280"},"modified":"2022-02-20T19:13:29","modified_gmt":"2022-02-20T19:13:29","slug":"adding-more-entries-to-our-pxe-boot-menu","status":"publish","type":"post","link":"https:\/\/dannypayne.me\/?p=280","title":{"rendered":"Adding more entries to our PXE boot menu"},"content":{"rendered":"\n<p>In my <a rel=\"noreferrer noopener\" href=\"http:\/\/10.171.10.16:10000\/?p=248\" target=\"_blank\">previous post<\/a>, I covered the process of rebuilding our PXE boot server with AlmaLinux, and adding AlmaLinux as a bootable option within the PXE boot menu.<br>In this post, I&#8217;m going to cover the process of creating a sub-menu, and adding some bootable tools to our sub-menu.<br>This process will be much the same as I covered in <a href=\"http:\/\/10.171.10.16:10000\/?p=22\" target=\"_blank\" rel=\"noreferrer noopener\">this previous post<\/a>, however this post will be a little more informative as to why we&#8217;re doing what we&#8217;re doing. <\/p>\n\n\n\n<p>We&#8217;re going to download the following tools:<br>&#8211; <a rel=\"noreferrer noopener\" href=\"https:\/\/rescuezilla.com\/download\" target=\"_blank\">Rescuezilla<\/a><br>&#8211; <a rel=\"noreferrer noopener\" href=\"https:\/\/clonezilla.org\/downloads\/download.php?branch=stable\" data-type=\"URL\" data-id=\"https:\/\/clonezilla.org\/downloads\/download.php?branch=stable\" target=\"_blank\">Clonezilla<\/a><br>&#8211; <a rel=\"noreferrer noopener\" href=\"https:\/\/gparted.org\/download.php\" target=\"_blank\">Gparted<\/a><br>&#8211; <a rel=\"noreferrer noopener\" href=\"https:\/\/pogostick.net\/~pnh\/ntpasswd\/\" target=\"_blank\">Ntpasswd<\/a> (I used version 110511, more on this below)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"downloading-and-unzipping-files\">Downloading and unzipping files<\/h3>\n\n\n\n<p>Before we get started, we need to install the <code>unzip<\/code> package if it&#8217;s not already installed:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">[root@COLO-PXE ~]# yum install -y unzip<\/code><\/pre>\n\n\n\n<p>We&#8217;re now going to download the files for each bootable tool. Note that our current working directory is <code>~<\/code> or<code>\/root<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">[root@COLO-PXE ~]# wget https:\/\/github.com\/rescuezilla\/rescuezilla\/releases\/download\/2.3.1\/rescuezilla-2.3.1-64bit.impish.iso\n[root@COLO-PXE ~]# wget https:\/\/altushost-swe.dl.sourceforge.net\/project\/clonezilla\/clonezilla_live_stable\/2.8.1-12\/clonezilla-live-2.8.1-12-amd64.zip\n[root@COLO-PXE ~]# wget https:\/\/altushost-swe.dl.sourceforge.net\/project\/gparted\/gparted-live-stable\/1.3.1-1\/gparted-live-1.3.1-1-amd64.zip\n[root@COLO-PXE ~]# wget http:\/\/pogostick.net\/~pnh\/ntpasswd\/usb110511.zip<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"677\" height=\"113\" src=\"http:\/\/10.171.10.16:10000\/wp-content\/uploads\/2022\/02\/280-1.png\" alt=\"\" class=\"wp-image-288\" srcset=\"https:\/\/dannypayne.me\/wp-content\/uploads\/2022\/02\/280-1.png 677w, https:\/\/dannypayne.me\/wp-content\/uploads\/2022\/02\/280-1-300x50.png 300w\" sizes=\"auto, (max-width: 677px) 100vw, 677px\" \/><\/figure><\/div>\n\n\n\n<p>Now that we&#8217;ve got our files downloaded we can extract them into their own folders, so we can start moving files to the correct locations:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">[root@COLO-PXE ~]# unzip clonezilla-live-2.8.1-12-amd64.zip -d clonezilla\n[root@COLO-PXE ~]# unzip gparted-live-1.3.1-1-amd64.zip -d gparted\n[root@COLO-PXE ~]# unzip usb110511.zip -d ntpasswd<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"674\" height=\"162\" src=\"http:\/\/10.171.10.16:10000\/wp-content\/uploads\/2022\/02\/280-2.png\" alt=\"\" class=\"wp-image-289\" srcset=\"https:\/\/dannypayne.me\/wp-content\/uploads\/2022\/02\/280-2.png 674w, https:\/\/dannypayne.me\/wp-content\/uploads\/2022\/02\/280-2-300x72.png 300w\" sizes=\"auto, (max-width: 674px) 100vw, 674px\" \/><\/figure><\/div>\n\n\n\n<p>You&#8217;ll have noticed that Rescuezilla has downloaded as an <code>.iso<\/code> rather than a <code>.zip<\/code>. We&#8217;re going to need to mount this ISO image, and then copy the contents out and to a new folder &#8211; we&#8217;ll handle this shortly. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"moving-downloaded-files\">Moving downloaded files<\/h3>\n\n\n\n<p>We now want to begin the process of moving our files to the correct locations. In the last post, we used <code>\/srv\/networkboot<\/code> as our PXE directory, and <code>\/var\/lib\/tftpboot<\/code> for our bootloaders directory. We&#8217;re going to create a folder for each tool, in each location above:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">[root@COLO-PXE ~]# mkdir \/srv\/networkboot\/{rescuezilla,clonezilla,gparted}\n[root@COLO-PXE ~]# mkdir \/var\/lib\/tftpboot\/{rescuezilla,clonezilla,gparted,ntpasswd}<\/code><\/pre>\n\n\n\n<p>Next, we&#8217;re going to do the following:<br>For Clonezilla and Gparted, find their <code>initrd.img<\/code> and <code>vmlinuz<\/code> files within the <code>live<\/code> directory, and copy them to their respective directories within <code>\/var\/lib\/tftpboot<\/code><br>Find their <code>filesystem.squashfs<\/code> file, and copy it to their respective directories within <code>\/srv\/networkboot<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">[root@COLO-PXE ~]# cp clonezilla\/live\/{initrd.img,vmlinuz} \/var\/lib\/tftpboot\/clonezilla\/\n[root@COLO-PXE ~]# cp clonezilla\/live\/filesystem.squashfs \/srv\/networkboot\/clonezilla\/\n[root@COLO-PXE ~]# cp gparted\/live\/{initrd.img,vmlinuz} \/var\/lib\/tftpboot\/gparted\n[root@COLO-PXE ~]# cp gparted\/live\/filesystem.squashfs \/srv\/networkboot\/gparted\/<\/code><\/pre>\n\n\n\n<p>For Ntpasswd, we can do the following:<br>Find the <code>initrd.cgz<\/code>,<code>scsi.cgz<\/code> and <code>vmlinuz<\/code> files, and copy them to the respective directory within <code>\/var\/lib\/tftpboot<\/code>:<br>You&#8217;ll note that at the beginning I said I used version <strong>110511<\/strong> rather than the most recent version, <strong>140201<\/strong>. This was simply because every other time I booted this, it would kernel panic on me and I couldn&#8217;t work out why, even with my previously confirmed working menu entries from previous post &#8211; not entirely sure why this is happening. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">[root@COLO-PXE ~]# cp ntpasswd\/{initrd.cgz,scsi.cgz,vmlinuz} \/var\/lib\/tftpboot\/ntpasswd\/<\/code><\/pre>\n\n\n\n<p>You&#8217;ll have noticed we haven&#8217;t done anything with Rescuezilla yet &#8211; as the file downloaded in an <code>.iso<\/code> format, we need to work with this differently. <br>To begin, we&#8217;re going to move the <code>.iso<\/code> file to the folder we created earlier &#8211; <code>\/srv\/networkboot\/rescuezilla<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">[root@COLO-PXE ~]# cp rescuezilla-2.3.1-64bit.impish.iso \/srv\/networkboot\/rescuezilla\/rescuezilla-2.3.1-64bit.impish.iso\n[root@COLO-PXE ~]# ls -l \/srv\/networkboot\/rescuezilla\/\n-rw-r--r-- 1 root root 1068525568 Jan 23 20:14 rescuezilla-2.3.1-64bit.impish.iso<\/code><\/pre>\n\n\n\n<p>Next, we&#8217;re going to mount the <code>.iso<\/code> and copy the <code>vmlinuz<\/code> and <code>initrd.lz<\/code> files to the <code>\/var\/lib\/tftpboot\/rescuezilla<\/code> folder:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">[root@COLO-PXE ~]# mkdir \/media\/iso\n[root@COLO-PXE ~]# mount -t iso9660 -o loop \/srv\/networkboot\/rescuezilla\/rescuezilla-2.3.1-64bit.impish.iso \/media\/iso\n[root@COLO-PXE ~]# cp \/media\/iso\/casper\/{vmlinuz,initrd.lz} \/var\/lib\/tftpboot\/rescuezilla\/<\/code><\/pre>\n\n\n\n<p>At this point, we have everything in place to start putting out sub-menu together, so let&#8217;s continue. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"build-pxe-menu\">Build PXE menu<\/h3>\n\n\n\n<p>As mentioned above, we have everything in place to put our sub-menu in place. To get started, we need to create our new menu file within the <code>\/var\/lib\/tftpboot\/pxelinux.cfg\/<\/code> directory:<\/p>\n\n\n\n<pre title=\"\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">[root@COLO-PXE ~]# touch \/var\/lib\/tftpboot\/pxelinux.cfg\/tools<\/code><\/pre>\n\n\n\n<p>We also need to edit our original <code>default<\/code> file, to include a section that points to our new menu. For ease, I&#8217;ve added this at the top of the file so it&#8217;s the first option. As it stands, this is our full <code>default<\/code> file so far:<\/p>\n\n\n\n<pre title=\"\/var\/lib\/tftpboot\/pxelinux.cfg\/default\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">default menu.c32\nprompt 0\ntimeout 300\nONTIMEOUT localboot\nMENU AUTOBOOT Booting from local drive in # seconds\n\nmenu title ########## PXE Boot Menu ##########\n\nLABEL Tools\nMENU LABEL Tools\nKERNEL menu.c32\nAPPEND pxelinux.cfg\/tools\n\nLABEL Boot AlmaLinux 8.5 x64 with Network Repo\nMENU LABEL Boot AlmaLinux 8.5 x64 with Network Repo\nKERNEL almalinux\/8.5\/vmlinuz\nAPPEND initrd=almalinux\/8.5\/initrd.img method=ftp:\/\/10.179.1.10\/almalinux\/8.5 devfs=nomount\n\nLABEL localboot\nMENU LABEL Boot from local drive\nLOCALBOOT 1\nCOM32 chain.c32\nAPPEND hd0 0<\/code><\/pre>\n\n\n\n<p>As mentioned at the start of this post, this post will be following much of the same steps as my  <a rel=\"noreferrer noopener\" href=\"http:\/\/10.171.10.16:10000\/?p=22\" target=\"_blank\">previous post<\/a> on this topic, and as such, I&#8217;m copying the same <code>tools<\/code> menu from that post to reuse here, however I&#8217;ve modified this to include the necessary lines to enable Rescuezilla to boot via PXE (source <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/rescuezilla\/rescuezilla\/issues\/117#issuecomment-752274381\" data-type=\"URL\" data-id=\"https:\/\/github.com\/rescuezilla\/rescuezilla\/issues\/117#issuecomment-752274381\" target=\"_blank\">HERE<\/a>), and also modified a could of options (fetch squashfs via HTTP rather than FTP, for example):<\/p>\n\n\n\n<pre title=\"\/var\/lib\/tftpboot\/pxelinux.cfg\/tools\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">MENU TITLE ########## PXE Tools Menu ##########\n\nLABEL Back to Main Menu\nMENU LABEL Main Menu\nKERNEL menu.c32\nAPPEND pxelinux.cfg\/default\n\nLABEL ntpasswd\nMENU LABEL NT Password and Registry Editor\nkernel ntpasswd\/vmlinuz\nappend rw vga=1 initrd=ntpasswd\/initrd.cgz,ntpasswd\/scsi.cgz\n\nlabel gparted\nMENU LABEL GParted Live\nkernel gparted\/vmlinuz\nappend initrd=gparted\/initrd.img boot=live config components union=overlay username=user noswap noeject locales=en_US keyboard-layouts=en_US.UTF-8 fetch=ftp:\/\/10.179.1.10\/gparted\/filesystem.squashfs\n\nlabel clonezilla\nMENU LABEL Clonezilla Live\nKERNEL clonezilla\/vmlinuz\nAPPEND initrd=clonezilla\/initrd.img boot=live username=user union=overlay config components quiet noswap edd=on nomodeset nodmraid keyboard-layouts=en locales=en_US.UTF-8 ocs_live_run=\"ocs-live-general\" ocs_live_extra_param=\"\" ocs_live_batch=no net.ifnames=0 nosplash noprompt fetch=ftp:\/\/10.179.1.10\/clonezilla\/filesystem.squashfs\n\nLABEL rescuezilla\nMENU LABEL Rescuezilla Live\nKERNEL rescuezilla\/vmlinuz boot=casper quiet splash fastboot toram\nINITRD rescuezilla\/initrd.lz\nAPPEND root=\/dev\/ram0 ramdisk_size=15000000 ip=dhcp url=http:\/\/10.179.1.10\/networkboot\/rescuezilla\/rescuezilla-2.3.1-64bit.impish.iso<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"so-what-s-actually-going-on-here\">So what&#8217;s actually going on here?<\/h4>\n\n\n\n<p>At the top of the file, we have a menu option to go back to the previous menu.<br>Underneath, we have menu options for each bootable tool. The <code>append<\/code> line includes arguments to set options such as OS language, keyboard layout, and where to actually download the remainder of the files from. Each tools <code>append<\/code> options came from the following sources: <a rel=\"noreferrer noopener\" href=\"https:\/\/www.linuxjournal.com\/content\/leave-cds-office\" target=\"_blank\">ntpasswd<\/a>, <a rel=\"noreferrer noopener\" href=\"https:\/\/gparted.org\/livepxe.php\" target=\"_blank\">gparted<\/a>, <a rel=\"noreferrer noopener\" href=\"https:\/\/clonezilla.org\/livepxe.php\" target=\"_blank\">clonezilla<\/a>, <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/rescuezilla\/rescuezilla\/issues\/117\" target=\"_blank\">rescuezilla<\/a>.<br>The biggest difference between all of these is Rescuezilla. We&#8217;re basically creating a ramdisk, dumping the ISO into it, and then booting it. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"testing-our-boot-options\">Testing our boot options<\/h3>\n\n\n\n<p>There&#8217;s been a lot of text in this post, so let&#8217;s test out booting to our different boot options!<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"http:\/\/10.171.10.16:10000\/wp-content\/uploads\/2022\/02\/280-ntpasswd-boot.gif\" alt=\"\" class=\"wp-image-296\"\/><figcaption>Ntpasswd<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"http:\/\/10.171.10.16:10000\/wp-content\/uploads\/2022\/02\/280-gparted-boot.gif\" alt=\"\" class=\"wp-image-297\"\/><figcaption>Gparted<\/figcaption><\/figure><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"http:\/\/10.171.10.16:10000\/wp-content\/uploads\/2022\/02\/280-clonezilla-boot.gif\" alt=\"\" class=\"wp-image-298\"\/><figcaption>Clonezilla<\/figcaption><\/figure>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"http:\/\/10.171.10.16:10000\/wp-content\/uploads\/2022\/02\/280-rescuezilla-boot.gif\" alt=\"\" class=\"wp-image-299\"\/><figcaption>Rescuezilla<\/figcaption><\/figure><\/div>\n\n\n\n<p>his concludes this post. <br>In another post, I&#8217;m going to cover customizing the boot menu some more, and changing settings such as the background image and colours. Stay tuned! <\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my previous post, I covered the process of rebuilding our PXE boot server with AlmaLinux, and adding AlmaLinux as&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/dannypayne.me\/?p=280\">Read more<span class=\"screen-reader-text\">Adding more entries to our PXE boot menu<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":302,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6],"tags":[],"class_list":["post-280","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-homelab","excerpt","zoom","full-without-featured","even","excerpt-0"],"jetpack_featured_media_url":"https:\/\/dannypayne.me\/wp-content\/uploads\/2022\/02\/280-3.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/dannypayne.me\/index.php?rest_route=\/wp\/v2\/posts\/280","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dannypayne.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dannypayne.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dannypayne.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dannypayne.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=280"}],"version-history":[{"count":9,"href":"https:\/\/dannypayne.me\/index.php?rest_route=\/wp\/v2\/posts\/280\/revisions"}],"predecessor-version":[{"id":317,"href":"https:\/\/dannypayne.me\/index.php?rest_route=\/wp\/v2\/posts\/280\/revisions\/317"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dannypayne.me\/index.php?rest_route=\/wp\/v2\/media\/302"}],"wp:attachment":[{"href":"https:\/\/dannypayne.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dannypayne.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dannypayne.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}