Post Reply 
 
Thread Rating:
  • 1 Votes - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Boot an Ubuntu ISO via iPXE
2019-09-19, 02:20 (This post was last modified: 2019-09-19 04:52 by NiKiZe.)
Post: #1
Boot an Ubuntu ISO via iPXE
So I'm trying to make an iPXE USB image that loads an Ubuntu ISO hosted on an HTTPS url that loads that OS onto a Legacy BIOS System.

I've previously gotten an iPXE image working on USB that loads CENTOS kernel and initrd images. Now I'm trying to boot an Ubuntu ISO that has custom binaries and files that I've made.

There seem to be a good amount of posts on the forum about booting an ISO for example:
http://forum.ipxe.org/showthread.php?tid...t=boot+iso
http://forum.ipxe.org/showthread.php?tid=3728
http://forum.ipxe.org/showthread.php?tid...t=boot+iso

Some using sanboot successfully and some answers where it's 'don't try to boot an iso with ipxe'. I'm still struggling to understand what's the best iPXE way to load a custom Ubuntu OS?

Would sanbooting an Ubuntu ISO just work? Some answers mention using 'memdisk' which I can only find docs for here: http://ipxe.org/appnote/memtest ?
What's the better way to load a custom OS if not trying to load an ISO?

Thanks so much for your help.
Find all posts by this user
Quote this message in a reply
2019-09-19, 04:50
Post: #2
RE: Boot an Ubuntu ISO via iPXE
Yes there are several posts - and it is in the FAQ as well.
The answer is that booting an ISO as is, is unlikely to work.
if you use sanboot, with an iSCSI server, it might be possible - but with http or https it's not possible, the other option is using memdisk (for legacy pcbios) but that requires other hacks in the isos init scripts.

You should extract kernel, initrd and squashfs from the ISO and follow the distros docs for PXE boot ... hower a good place to look for examples is https://github.com/antonym/netboot.xyz

Read FAQ before first post!
Are relevant ipxe.org error urls and PCIIDs included?
Visit this user's website Find all posts by this user
Quote this message in a reply
2019-09-19, 06:46 (This post was last modified: 2019-09-19 06:47 by MultimediaMan.)
Post: #3
RE: Boot an Ubuntu ISO via iPXE
I do this in Production across several architectures; X86-64, AARCH64 and PPC64LE (the latter without iPXE, using petitboot instead); With Ubuntu, there is a 'netboot' image you should use, otherwise the installer will have difficulty locating all of the files. You can download the netboot ISO and extract the files or simply download the netboot linux and initrd.gz files (they total about 35MB).

As far as customizing your image, I suggest you append your files into a post installation script referenced in the preseed file.

"Thus far, you have been adrift within the sheltered harbor of my patience..."
Find all posts by this user
Quote this message in a reply
2019-09-26, 04:13
Post: #4
RE: Boot an Ubuntu ISO via iPXE
Thanks for the responses - NiKiZe and MutlimediaMan. I have managed to get your suggestions to work. I'm using the netboot kernel and initrd images provided by ubuntu mirrors and using my own preseed. One question I have is and this may be specific to the Ubuntu kernel arguments: Is there anyway to get the OS to load just in memory? I've tried using:

kernel https://link_to_kernel boot=casper toram url=https://preseed_url

but that doesn't seem to work. Basically at the end of the day, I want this machine to always PXE boot on restart so it installs a new OS. Loading the OS in memory seems like the easiest way to wipeout the OS on restart. Thanks again.
Find all posts by this user
Quote this message in a reply
2019-09-26, 13:22
Post: #5
RE: Boot an Ubuntu ISO via iPXE
Why do you want to reinstall at every boot? (I can think of several things which this would help with, but there are better ways of doing it).

"Thus far, you have been adrift within the sheltered harbor of my patience..."
Find all posts by this user
Quote this message in a reply
2019-09-26, 18:55
Post: #6
RE: Boot an Ubuntu ISO via iPXE
A couple of reasons:

1. I'm basically deploying these machines in locations I don't have physical access to, making it difficult if I remotely update the OS (stored at some http location) to boot via PXE again vs sshing in and calling 'reboot' which would launch the PXE script once again
2. Clients have root access and can screw up OS and do quite frequently, it'd be nice to reboot and install clean regularly and remotely
3. There might be different data disks not owned by me inserted into the machine. I don't want to put the OS accidentally on a data disk or the PXE USB (if I write my OS to a logical block, I'm not guaranteed that the '/dev/sda' is not on the USB or a data disk)
4. I don't actually need persistence of any data the way it's used
5. The machine might get passed around and basically a memory-only OS ended being a security requirement. Perhaps the most important reason, complying with secops Smile

If I were to go down this path, would you recommend I basically use the initrd, initramfs as my real filesystem. Should I basically take a real root filesystem and put that in a cpio archive and gzip it. Would that just work?


For these rea
Find all posts by this user
Quote this message in a reply
2019-09-27, 01:44
Post: #7
RE: Boot an Ubuntu ISO via iPXE
You might want to look at a live version of the OS instead, meaning that it only exists in memory. - as such you do not want to run installs at all.

I'm sure there must already be solutions out there for this ...
However if I would do this I would try to get a minimal 2-300mb sized initrd with squashfs, and then try to have "next stage" data downloaded from within the OS once started

Read FAQ before first post!
Are relevant ipxe.org error urls and PCIIDs included?
Visit this user's website Find all posts by this user
Quote this message in a reply
2019-10-01, 10:48
Post: #8
RE: Boot an Ubuntu ISO via iPXE
I would suggest a Read Only version of Ubuntu served up by iPXE and NFS.

Completely stateless to the client system.

"Thus far, you have been adrift within the sheltered harbor of my patience..."
Find all posts by this user
Quote this message in a reply
2019-10-01, 20:37
Post: #9
RE: Boot an Ubuntu ISO via iPXE
(2019-10-01 10:48)MultimediaMan Wrote:  I would suggest a Read Only version of Ubuntu served up by iPXE and NFS.

Completely stateless to the client system.

Example: https://help.ubuntu.com/community/DisklessUbuntuHowto

"Thus far, you have been adrift within the sheltered harbor of my patience..."
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)