How to add live cd iso to Fog 1.2 on Ubuntu 12.04



  • I’m excited to write this post, because it’s my first attempt at a tutorial, so please feel free to suggest changes and I’ll do my best to edit and improve it. If it matters, I’m not a padawan, nor am I a jedi master, but somewhere right in the middle. I’m writing this because I failed to find a single tutorial that had all the answers I needed concerning the installation of Fog 1.2 on Ubuntu 12.04 and then ESPECIALLY the adding of additional live cd iso’s into the advanced section of the fog menu. Having benefited so greatly from hundreds of tutorials myself, this is my humble attempt to bring the pieces together for the benefit of others. So, let’s begin…

    ASSUMPTIONS:

    1. I assume you have a working and updated Ubuntu 12.04 installation with a static IP address. For what it’s worth, I find it significantly easier to have my router (which is my dhcp server) assign a static IP to the machine, but you can do it manually on Ubuntu by configuring the network interface either through the terminal or the gui. Here are examples of both: [url]https://www.liberiangeek.net/2012/04/setup-a-permanent-static-ip-address-in-ubuntu-12-04-precise-pangolin/[/url]
      [url]http://askubuntu.com/questions/180925/how-to-setup-static-ip-in-ubuntu-server-12-04[/url]
      You can use any desktop environment, it shouldn’t matter. Also, though there were significant changes made to Ubuntu 14.04, this information will be 95% accurate for that distro as well, at least it will get you in the ballpark.

    2. I assume you have a separate dhcp server (meaning you are not using fog as the dhcp server). *** PLEASE NOTE*** Depending on the specifics of your dhcp server, i.e. type/brand/firmware, it may be necessary to make special configuration changes to enable pxe booting. See the following link for more details: [url]http://fogproject.org/wiki/index.php/Modifying_existing_DHCP_server_to_work_with_FOG[/url]

    3. I’m also assuming you have installed Fog 1.2 on your Ubuntu machine. The following link, which has loads of good info worth reading, has a section dedicated to the installation procedure: [url]http://fogproject.org/forum/threads/how-to-setup-ubuntu-server-fog-1-2-0-create-univeral-windows-7-image-using-sysprep-step-by-step.11245/[/url]

    4. I assume you have downloaded or otherwise have a copy of your chosen Debian/Ubuntu based linux distro ISO file somewhere in your home folder, i.e. ~/Downloads/linuxmint-17.1-cinnamon-64bit.iso

    CHANGES IN UBUNTU:
    My example uses the linuxmint-17.1-cinnamon-64bit.iso, but I’m fairly sure these instructions will work for any Debian/Ubuntu based distro.

    First, lets make a directory inside the web root of Fog.
    CODEsudo mkdir /var/www/fog/service/ipxe/mint[/CODE]
    I called my directory “mint”, but you can name it anything you want. When I add my next iso, I’m going to create another directory named “ubuntu” because I’ll be using the Ubuntu 14.04 iso, but I digress…

    Now let’s copy the ISO file into that directory:
    CODEsudo cp ~/Downloads/linuxmint-17.1-cinnamon-64bit.iso /var/www/fog/service/ipxe/mint[/CODE]

    Next, we are going to tell Ubuntu to mount that iso on that same location so that the files contained in the iso will be available for pxe booting. We do this by editing /etc/fstab
    CODEsudo nano /etc/fstab[/CODE]

    Append the following code into /etc/fstab
    CODE/var/www/fog/service/ipxe/mint/linuxmint-17.1-cinnamon-64bit.iso /var/www/fog/service/ipxe/mint udf,iso9660 user,loop 0 0[/CODE]

    Now test the mount point works with:
    CODEsudo mount -a[/CODE]

    A window may open showing the contents of the iso mounted at /var/www/fog/service/ipxe/mint, but if not–run the following code to see the contents of the iso listed
    CODEls -lash /var/www/fog/service/ipxe/mint[/CODE]

    Now we edit /etc/exports to configure the NFS share.
    CODEsudo nano /etc/exports[/CODE]

    append the following mount point info into /etc/exports
    CODE/var/www/fog/service/ipxe/mint/ *(rw,sync,no_wdelay,no_root_squash,insecure)[/CODE]

    and restart the NFS service
    CODEsudo /etc/init.d/nfs-kernel-server restart[/CODE]

    CHANGES IN FOG GUI:
    Now log into your fog gui by entering the following into the address bar of your browser:
    CODE<your-fog-ip-address>/fog/management/index.php[/CODE]

    and login with the default username: fog and password: password

    in the gui, navigate to the big blue question mark–hover tool tip “fog configuration”, then on the left side menu go to “pxe boot menu”. Then in the page that appears, look for “advanced configuration options”, which when clicked will open a small text box where you will enter your php code to edit the fog boot menu options.

    Now, allow me to digress for just a moment and explain that fog 0.32 had a much simpler method of configuring the fog boot menu, and I realize that the new method in fog 1.2 is more complicated. So, I understand the frustration some of you may have with the new method, which involves php code. What you need to know is that the new way leverages the bandwidth available with http and allows for significantly faster network speeds than the former method which used tftp which is tragically slow by modern standards. So, everyone say thank you to the Fog developers for doing their job and improving the product, and get on board with the new and better way of doing things :~)

    Here are some links that REALLY helped me get this working. I could not have done this without Tom Elliot, Junkhacker, and fabritrento. In the world of code and IT we always stand on the shoulders of others. A HUGE THANK YOU to those I mentioned, and many others who post on this forum.
    [URL=‘http://fogproject.org/forum/threads/live-cd-configurations-for-boot.12044/#post-39436’][FONT=arial][COLOR=#1155cc]http://fogproject.org/forum/threads/live-cd-configurations-for-boot.12044/#post-39436[/COLOR][/FONT][/URL]

    [URL=‘http://fogproject.org/wiki/index.php/Advanced_Boot_Menu_Configuration_options’][FONT=arial][COLOR=#1155cc]http://fogproject.org/wiki/index.php/Advanced_Boot_Menu_Configuration_options[/COLOR][/FONT][/URL]

    [URL=‘http://fogproject.org/forum/threads/how-can-i-boot-a-live-image-with-ipxe.11940/#post-38652’][FONT=arial][COLOR=#1155cc]http://fogproject.org/forum/threads/how-can-i-boot-a-live-image-with-ipxe.11940/#post-38652[/COLOR][/FONT][/URL]

    [URL=‘http://ipxe.org/’][FONT=arial][COLOR=#1155cc]http://ipxe.org/[/COLOR][/FONT][/URL]

    HERE IS MY WORKING PHP CODE:
    Paste the following code into the text box (substituting your actual iso files location where necessary) NOTE how the variable “${fog-ip}” picks up your fog server ip address automatically
    Also–pay attention to the vmlinuz file found in the casper directory at your mount point–depending on your chosen distro it may be “vmlinuz.efi” rather than straight "vmlinuz"
    CODE:MENU
    menu
    item --gap – ---------------- iPXE boot menu ----------------
    item mint 17 Mint 17.1 Cinnamon x64
    item shell ipxe shell
    item return return to previous menu
    choose --default return --timeout 5000 target && goto ${target}

    :mint
    kernel http://${fog-ip}/fog/service/ipxe/mint/casper/vmlinuz
    initrd http://${fog-ip}/fog/service/ipxe/mint/casper/initrd.lz
    imgargs vmlinuz root=/dev/nfs boot=casper netboot=nfs nfsroot=${fog-ip}:/var/www/fog/service/ipxe/mint/ locale=en_US.UTF-8 keyboard-configuration/layoutcode=us mirror/country=US
    boot || goto failed
    goto start

    :shell
    shell ||
    goto MENU

    :return
    chain http://${fog-ip}/${fog-webroot}/service/ipxe/boot.php?mac=${net0/mac} ||
    prompt
    goto MENU

    autoboot[/CODE]

    Now, if you want to add something other than a vanilla linux distro, like Hiren’s Boot CD 15.2 for example, you need to take a slightly different path. In this case, you do not need to mount the iso, so there is no need to edit /etc/fstab or /etc/exports. Simply create a directory within fog web root, i.e. /var/www/fog/service/ipxe/hiren–copy the iso into that directory–and add some additional php code to the “advanced configuration options” text box.

    Here is what my code looks like with the addition of Hiren’s Boot CD 15.2 NOTE how the first menu section has changed, and for the “hiren” section there is completely different code used to load the unmounted iso directly

    menu
    item --gap – ---------------- iPXE boot menu ----------------
    item mint 17 Mint 17.1 Cinnamon x64
    item hiren Hiren Boot CD 15.2
    item shell ipxe shell
    item return return to previous menu
    choose --default return --timeout 5000 target && goto ${target}

    :mint
    kernel http://${fog-ip}/fog/service/ipxe/mint/casper/vmlinuz
    initrd http://${fog-ip}/fog/service/ipxe/mint/casper/initrd.lz
    imgargs vmlinuz root=/dev/nfs boot=casper netboot=nfs nfsroot=${fog-ip}:/var/www/fog/service/ipxe/mint/ locale=en_US.UTF-8 keyboard-configuration/layoutcode=us mirror/country=US
    boot || goto failed
    goto start

    :hiren
    initrd http://${fog-ip}/fog/service/ipxe/hiren/hiren-boot-cd-15-2.iso
    chain memdisk iso raw ||
    goto MENU

    :shell
    shell ||
    goto MENU

    :return
    chain http://${fog-ip}/${fog-webroot}/service/ipxe/boot.php?mac=${net0/mac} ||
    prompt
    goto MENU

    autoboot[/CODE]

    One “gotcha” I noted in the forum was a corrupt iso that failed md5sum checking. The user had everything else right, but a corrupt download. The lesson–do your md5sum checks–before assuming something else is wrong.

    If all went well, you should be able to select the “advanced” menu option from the client fog boot menu and choose to boot your chosen linux distro or Hiren’s Boot CD 15.2, which will then load itself into RAM on the client machine and act exactly the same as if you had a live cd or usb on the client (only way faster because it’s running from ram).

    ENJOY YOUR FOG SERVER :~) & MAY THE FORCE BE WITH YOU



  • @Sebastian-Roth Thanks Sebastian. You are right! I was not sure if I should post here or create a new topic. I felt bad just to create another post while this was related to the same (kindda) issue.
    I have followed the instructions in the link but still have problems. I will create a new topic and post dubug info there :)


  • Developer

    @amir3161 Usually it’s better to open a new post as your question (Ubuntu 16.04, FOG 1.4.4) does not match the topic. Describe what you did, post your ipxe config and post a picture of the error.

    One would think that if 14.04 worked as ISO 16.04 would also do. But maybe there is a difference. Read through this (talks about extracting the ISO because it does not boot otherwise) and open a new topic in case you still can’t make it work.



    • list item
      FOG version : 1.4.4
      OS: Ubuntu 16.04.2 X64

    I want to run a ubuntu 16.04 live iso using pxe on my client. I have read all the guides in this topic.
    I only managed to make the Hiren boot to work(only the mini windows works and not the linux enviroment). I have followed instruction from Biet Jeremie to fill in the advanced setting box for Ubuntu iso file. When I choose Ubuntu from the advance menu it loads the Ubuntu menu and when I choose:
    “try ubuntu without installation” it says it can not find the medium congaing the live file system.
    I have two problem:

    1. I don’t know if the instruction provided has changed from the date this was discussed?
    2. I’m not sure if I just need to copy the iso file from Ubuntu or I need to extract it in some folder?

    Has anyone got this to work?



  • @jbonilla Just in-case anyone else is trying to get this working, I had to add “union=overlay” after the “filesystem.squashfs” portion to get it working on my server.

    :CLONEZILLA
    kernel http://${fog-ip}/fog/service/ipxe/clonezilla/vmlinuz
    initrd http://${fog-ip}/fog/service/ipxe/clonezilla/initrd.img
    imgargs vmlinuz boot=live username=user fetch=http://${fog-ip}/fog/service/ipxe/clonezilla/filesystem.squashfs union=overlay locale=en_US.UTF-8 keyboard-layouts=NONE
    boot || echo failed to boot
    prompt
    goto MENU```



  • @Trixsta101 Here is my working Clonezilla setup.

    :CLONEZILLA
    kernel http://${fog-ip}/fog/service/ipxe/clonezilla/vmlinuz
    initrd http://${fog-ip}/fog/service/ipxe/clonezilla/initrd.img
    imgargs vmlinuz boot=live username=user fetch=http://${fog-ip}/fog/service/ipxe/clonezilla/filesystem.squashfs locale=en_US.UTF-8 keyboard-layouts=NONE
    boot || echo failed to boot
    prompt
    goto MENU```


  • I noticed an additional detail: When I open a web browser to view my.fog.i.p/fog/service/ipxe/arch I can see all my files from the server but not from the computer I’m using as a client. Does anyone know what would cause that?

    Edit: never mind, that was an unrelated bug with the client.



  • @Wayne-Workman Thanks, I’ll take a look at that.



  • @Tom-Elliott /dev/nfs is just something I copied from the initial example. I don’t really understand a lot about iPXE or how it works, or how nfs mounting is supposed to work.


  • Moderator

    @AndersenJ Here’s an example that utilizes the built-in memdisk kernel. https://wiki.fogproject.org/wiki/index.php/DBAN_(Darik’s_Boot_and_Nuke) However doing it this way, you need much more RAM than the size of the ISO. There are cleaner ways to do it, and sometimes other ways are required depending on what bootable ISO you’re trying to use.


  • Senior Developer

    I could be wrong, but is /dev/nfs your own nfs mount point?



  • I’m trying to get this working with Arch Linux right now, with FOG Trunk 4491. Here’s my code:

    kernel http://${fog-ip}/fog/service/ipxe/arch/boot/vmlinuz-linux
    initrd http://${fog-ip}/fog/service/ipxe/arch/boot/initramfs-linux.img
    imgargs vmlinuz-linux root=/dev/nfs boot=casper netboot=nfs nfsroot=${fog-ip}:/var/www/fog/service/ipxe/arch/ locale=en_US.UTF-8 keyboard-configuration/layoutcode=us mirror/country=US
    boot || goto failed
    goto start
    

    I get this error:
    IMG_20151007_170038515.jpg
    This happens with more than just Arch Linux; I’ve tried it with a couple of distros now including Mint. I’m not too worried about the mirror or keyboard layout; I can fix those later. Not being able to find /dev/nfs is a problem though.


  • Senior Developer

    @lebrun78 there is no file name to edit. It’s the advanced menu which is edited from the GUI.



  • I’m lost !! I use fog 1.2.0 and I want to add a pxe load of a wim (winpe) image to use MDT config to the menu .
    Which file do you edit ? Is it /tftpboot/default.ipxe ? I can’t see the name of the file you edit in this thread !

    Thx



  • me too, with GParted I’ve kernel panic
    with Debian 8.1 I can launch install but after it says to me that cdrom is missing



  • Trying to boot clonezilla…

    Any idea on how to get this going?

    Currently this is the closest to booting i have… error message below

    :clonezilla-live-2.3.2-22-amd64
    kernel http://${fog-ip}/${fog-webroot}/iso/clonezilla/vmlinuz
    initrd http://${fog-ip}/${fog-webroot}/iso/clonezilla/initrd.img
    imgargs vmlinuz root=/dev/nfs boot=clonezilla netboot=nfs nfsroot=${fog-ip}:/var/www/fog/service/ipxe/clonezilla/ locale=en_US.UTF-8 keyboard-configuration/layoutcode=us mirror/country=US
    boot || goto failed

    came across this https://gist.github.com/robinsmidsrod/dc0dc70adba8dcd79cdf

    not sure if this would help? tried adding the forth line with no luck

    #!ipxe
    kernel /live/vmlinuz
    initrd /live/initrd.img
    imgargs vmlinuz boot=live username=user hostname=trusty config quiet union=overlayfs noswap edd=on nomodeset noeject locales= keyboard-layouts= ocs_live_run=“ocs-live-general” ocs_live_extra_param="" ocs_live_batch=no ip= nomodeset vga=normal nosplash
    boot

    FullSizeRender-clonezilla.jpg



  • Thanks great tutorial (an tom for everything)
    I’ve finally upgraded from 0.32 and was looking all over for this… It’s a little different but can’t wait to try it



  • Awesome!!



  • Amazing!!

    I have tried to do something similar in my FOG server and works fine!

    FOG server: 1.2.0 latest SVN installed
    Operating System: Ubuntu 13.10 latest updates installed

    1. I have understood very well your tutorial. Congratulations!
    2. I have added a new menu entry in FOG boot menu (it is very easy I think)
    3. Reading your notes, I have added a Live Ubuntu CD 14.04.2 i386 and it runned ok on client machine.

    Thank you!



  • Biet is correct. It really depends on the specific iso in question. Many need to be pre-mounted and have certain files (usually vmlinuz, and initrd) specified. Others will work directly from the iso. Fortunately the most common iso’s have been experimented with at this point and if you search the forum you can find the answers you need for your specific iso.


Log in to reply
 

432
Online

38938
Users

10697
Topics

101491
Posts

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