Install Disk via PXE?

CoryG

Member

Reaction score: 7
Messages: 77

I've been fighting this one for a good couple days now, managed to set up a TFTP server, get the DHCP working, get PXELinux running, and get several Linux install and recovery tools working, but I haven't gotten a FreeBSD 12 or FreeBSD 13 installer working from PXELinux. Thus far I've tried mboot.c32, memdisk, a few variations of kernel/initrd hacks I found online for older versions, and the pxe command itself along with hacking at mfsbsd to try to get a bootloader into the CD iso or the extracted contents thereof over TFTP out of that. I'm not opposed to setting up an HTTP/HTTPS server alongside the TFTP server but I'm curious if anyone has managed to do this? My goal is pretty simple in concept: being able to PXE-boot and have some Linux distros, FreeBSD, Windows, and recovery/maintenance utilities as menu options to select from, wherein the FreeBSD 12+13 options fire off what is essentially the installation disk itself.
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

I've had a PXE server set up for a few years, but haven't spent too much time recently trying to install FreeBSD via PXE, although I did create my own mfsBSD image which went some way. Will have to give it another try. One thing I did find was that I can boot FreeBSD-8.4-RELEASE-i386-bootonly.iso via PXE and it goes straight into sysinstall the old version of bsdinstall()). I haven't found any other release that will do this. Where you would get this if you wanted to experiment, I don't know.

Here is my PXE menu for this:-
Code:
 LABEL FreeBSD 8 ISO
   MENU LABEL FreeBSD - ^8
   TEXT HELP
   Boot FreeBSD 8.4
   ENDTEXT
   kernel memdisk
   initrd iso/FreeBSD-8.4-RELEASE-i386-bootonly.iso
   append iso raw

I do have mfsBSD booting OK, although when I tried with 13.0 it wouldn't work.

Apparently you can boot FreeBSD over the network via gpxelinux.0 with something like this:-
Code:
 LABEL FreeBSD-PXE
   MENU LABEL PXE-FreeBSD
   PXE pxeboot
   MENU DEFAULT
    TEXT HELP
    Junk Menu
    ENDTEXT

but for me it starts up and stalls. Don't know if I'm doing something wrong.
 
OP
C

CoryG

Member

Reaction score: 7
Messages: 77

How significantly does gpxelinux.0 differ from pxelinux.0? I could give that a shot, I've tried both the memdisk kernel and pxe pxeboot for FreeBSD 12 and 13, the former errors out trying to load the installer, the latter gets to a shell but doesn't autostart the setup from the iso.
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

Are you trying to load an ISO or a FreeBSD root filesystem? where are you picking up pxeboot from?
 
OP
C

CoryG

Member

Reaction score: 7
Messages: 77

I'm starting on a CentOS install, so my pxelinux.0 came from the dnf package for syslinux and the pxeboot came from the dvd1 image of FreeBSD under the boot directory. I'm trying to load the FreeBSD install (e.g. same as if you stuck the dvd or usb image in a drive to install it, just without carrying the media around,) while using pxelinux as a bootloader to select which image to load so I can do the same with a few varieties of linux and windows as well, plus some recovery utility disks.
 
OP
C

CoryG

Member

Reaction score: 7
Messages: 77

My ideal would be to get a menu tree akin to the following wherein the OS ones just load up isos over the network, or mount a TFTP or HTTP/HTTPS tree of extracted ISOs like a bootable CD/DVD:
  • Operating Systems
    • CentOS
      • CentOS 1
      • ...
      • CentOS 8
    • Debian
      • ...
    • Fedora
      • ...
    • FreeBSD
      • FreeBSD 1
      • ...
      • FreeBSD 13
    • OpenBSD
      • ...
    • OpenSuse
      • ...
    • pfSense
      • ...
    • Slackware
      • ...
    • Ubuntu
      • ...
    • Windows
      • Windows 98
      • Windows 2000
      • Windows NT
      • Windows XP
      • Windows Vista
      • Windows Server 2008
      • Windows 7
      • ...
  • Utilities
    • Clonezilla
    • mfsBSD
    • System Rescue
    • memtest
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

I've been trying to get something similar set up over a long time, some works OK some is WIP.

mfsBSD is easiest. I also System Rescue and Clonezilla although I'm in the process of honing down the required parameters. A couple worth trying are HDT and Pmagic. I've got parts of UBCD working and would like to get Hiren's working. Arch Linux works, or rather some version does but not others.
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

ISTR looking at this page a few years ago and getting familiar with iPXE is still on my ever growing list of things to learn, but I couldn't get my head around how it works. I'd appreciate any pointers.

I think the problem with FreeBSD ISO's is that they can't handle mountroot. I have do idea as to what to enter at a mountroot> prompt.
 
OP
C

CoryG

Member

Reaction score: 7
Messages: 77

Honestly for this use case that link is the only one that made sense of it a bit for me. It seems to be a PXE bootloader which burns itself into network ROMs, but if you're using it in a chainloading manner like in that link it more or less takes the place of pxelinux with more features. My hope was that it would be easier to get FreeBSD's installation disk running with it but thus far no such luck (though the errors are a bit more verbose - this is my latest one when trying it.)

That link in the previous post is definitely a great reference for it, but it's generally:
-setup DHCP+TFTP like for pxelinux
-get the latest iPXE source and build locally with the options called out in that link
-setup a HTTP server to host the files and .ipxe/.php (I renamed mine .ipxe because .php is a dumb name to use in a webserver for this application imo,) which is referenced by a config in the iPXE prior to build
-point the DHCP PXE entry at the built file after moving it to the TFTP directory
-make menu changes and such in the .ipxe (formerly .php) file on the web server
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

Have you tried loading FreeBSD ISO's via PXE?

There is, AFAICS, an insurmountable problem with mountroot.

The only way I can see of overcoming it is by building your own mfsBSD image. I think I tried in the past and will give it another go.
 
OP
C

CoryG

Member

Reaction score: 7
Messages: 77

Yeah, it's looking like I'm going to have to start the process with mfsBSD instead of just being able to drop an iso on the drive to grab - not sure why precisely the dvd iso fails (no error messages available, so that's always fun and it's not a size issue because the centos dvd iso works fine,) but the mfsbsd iso runs. My current issue appears to be this wherein there's no manifest - so I'm looking at (I think) making a startup script which logs in as root and runs:
Bash:
mkdir -p /usr/freebsd-dist && cd /usr/freebsd-dist
pkg install -y wget
wget https://download.freebsd.org/ftp/releases/amd64/13.0-RELEASE/kernel.txz --no-check-certificate
wget https://download.freebsd.org/ftp/releases/amd64/13.0-RELEASE/base.txz --no-check-certificate
wget https://download.freebsd.org/ftp/releases/amd64/13.0-RELEASE/MANIFEST --no-check-certificate
cd ~
bsdinstall

Working on figuring out how to do the auto-root-login and the startup script, then modifying the iso should be straightforward.
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

Yeah, it's looking like I'm going to have to start the process with mfsBSD instead of just being able to drop an iso on the drive to grab - not sure why precisely the dvd iso fails (no error messages available, so that's always fun and it's not a size issue because the centos dvd iso works fine,) but the mfsbsd iso runs.

The mfsBSD iso runs because its embedded /etc/fstab contains:-
Code:
/dev/md0 / ufs rw 0 0
Not sure how all this works, but it's pretty clever stuff..
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

Have you tried loading FreeBSD ISO's via PXE?

There is, AFAICS, an insurmountable problem with mountroot.

The only way I can see of overcoming it is by building your own mfsBSD image. I think I tried in the past and will give it another go.
Found some old code from four years ago and managed to build a PXE bootable ISO of v10.1-RELEASE-amd64. There's no added packages or configuration yet, but will try to figure what is involved.
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

My ideal would be to get a menu tree akin to the following wherein the OS ones just load up isos over the network, or mount a TFTP or HTTP/HTTPS tree of extracted ISOs like a bootable CD/DVD:

  • Utilities
    • Clonezilla
    • mfsBSD
    • System Rescue
    • memtest

I'm sure I had memtest working a few years ago, but trying it now it won't run.

Do you have it working? If so, which version of memtest do you use?
 

covacat

Well-Known Member

Reaction score: 172
Messages: 377

its possible to boot a modified install cd via pxe but it kind of sucks.
slow load times, current (13-R) pxeboot binary seems problematic
i converted the cd-disc1.iso into ufs and used it as a md/mfs rootfs
deleted freebsd-dist/* files from it to make it smaller, fix fstab to have md
loader.conf (on tftp server)
Code:
tftp.blksize="1468"
vfs.mountroot.timeout="10"
kernels_autodetect="NO"
mfs_load="YES"
mfs_type="mfs_root"
mfs_name="/mdisk.vfs"
vfs.root.mountfrom="ufs:/dev/md0"
dhcpd.conf
Code:
        option root-path "tftp://10.1.1.1/13";
        filename "pxeboot";
in.tftpd args
Code:
/usr/local/libexec/in.tftpd -l -s /extra/fs/netboot/ -a 10.1.1.1:69 --verbosity 1
copy all of boot cd /boot in the tftp servers root path
gzip kernel and mfs image for "faster" loading

it work ok-ish as a virtual box guest but on real hardware pxeboot bombed, dumped regs and halted
with a pxeboot file leached from 11.4-R worked only the loader screen box characters were b0rked
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

Don't know if you've seen this, it's the original guide I followed to get me started. I just followed the instructions again to set things up but can't get memtest working at all.
 

covacat

Well-Known Member

Reaction score: 172
Messages: 377

i used pxelinux in the past, booted a lot of shit with it (esxi installer, open solaris, dos utils disk, various linux live cds and distros, etc) but didnt try it in the last 9-10 years or so
9 was -CURRENT back then
 
Top