LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 12-22-2014, 04:27 AM   #1
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,258
Blog Entries: 24

Rep: Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193
Post FreeBSD Installation via PXE From Slackware Host


I install all my systems via PXE from a dedicated Slackware based host these days and have tailored the PXE server to support multiple versions of 32/64 bit Slackware plus GParted, memtest86 and a few other utilities.

With the recent addition of FreeBSD to my personal bag of tricks I needed a way to add FreeBSD installations to my Slackware PXE server. I did not see an easy way to do that initially as the FreeBSD handbook only documents serving from a FreeBSD system with custom kernel build for the PXE filesystem. So I set that task aside until a later time... which has now arrived.

Today I re-read the Handbook sections on Diskless Operation and the Boot Process and have now found a relatively easy way to serve FreeBSD installations from my Slackware host without having to build a custom kernel or any magic on my part! Here is how...

Step 1 - Configure network accessible mirror of FreeBSD installation media

To do this I mounted the DVD ISOs and copied them to an NFS export location on my Slackware PXE mirror host, /exports/freebsd/{32,64}. I then added these to my /etc/exports on the Slackware host.

Code:
/exports/freebsd/64 192.168.0.0/24(ro,no_root_squash,no_subtree_check)
/exports/freebsd/32 192.168.0.0/24(ro,no_root_squash,no_subtree_check)
Step 2 - Create FreeBSD path and pxe loaders in the Slackware tftp server

My tftp server is already working so I will not detail that here except to note that the root is /tftpboot.

I manage Linux based options through syslinux menu options using the Slackware pxelinux.0 boot loader. But FreeBSD must be loaded with its own pxeboot loader, so I copied the /boot directories from the 32 and 64 bit FreeBSD exports to...

Code:
/tftpboot/freebsd/32/boot/...
/tftpboot/freebsd/64/boot/...
... which provides the respective pxeboot boot loaders, kernels and modules necessary to boot the kernel over a network.

Step 3 - Configure DHCP options

A key bit of knowledge from the Handbook was how to get the kernel to mount the root filesystem via NFS:

Quote:
The client executes filename, which is pxeboot(8), which then loads the kernel. When the kernel executes, the root file system specified by root-path is mounted over NFS.
So we must provide the host address and the root-path option to the client via the DHCP response delivered to PXE clients. So I added the following to my Slackware host /etc/dhcpd.conf (simplified)...

Code:
filename "/freebsd/32/boot/pxeboot";
option root-path "/exports/freebsd/32";

and 

filename "/freebsd/64/boot/pxeboot";
option root-path "/exports/freebsd/64";
To "select" a FreeBSD I uncomment the target filename/option pair and comment out others then restart dhcpd. I will add a menu select option later.

Step 4 - Configure the respective fstabs

Finally, I had to configure the FreeBSD filesystem fstab files to mount the root filesystems via NFS...

Code:
#/exports/freebsd/32/etc/fstab
192.168.0.XXX:/exports/freebsd/32  /  nfs  ro  0  0

#/exports/freebsd/64/etc/fstab
192.168.0.XXX:/exports/freebsd/64  /  nfs  ro  0  0
... where 192.168.0.XXX is the static IP of the root filesystem mirror host on my network.

In my Slackware root filesystem mirror and DHCP hosts I restart nfsd and dhcpd...

Boot a suitable client machine to the network - works first time for both 32 and 64 bit!

Not only is it easy to set up, it will be equally easy to add or update versions in future!

I hope this is useful to other Linux/BSDers!

**** UPDATE ****

I used the above approach with the Dragonfly 4.0.1 install DVD with similar success.

Dragonfly provides two pxeboot loaders:

Code:
/boot/pxeboot
/boot/pxeboot_tftp
The man page for the tftp version indicates that it uses the normal kernel and loader whereas the non-tftp version uses BOOTP versions of the kernel and loader. I am not sure I fully understand the implications of that, but I was unable to boot using the pxeboot_tftp version.

So to recap, to PXE boot the Dragonfly installer:

1. Create an NFS export of the DVD to mount as root filesystem
2. Copy the /boot directory into the tftp server path
3. Add tftp-path/boot/pxeboot, option root-path /nfs-export-path/ to dhcpd.conf on PXE server
4. Modify /nfs-export-path/etc/fstab to mount / from NFS export

Boot and install Dragonfly over your local network!

By the way, I have performed multiple actual installs of both FreeBSD AMD64 and i386, and Dragonfly 64 to a VM from my PXE server using the above configuration - works great!

Last edited by astrogeek; 12-23-2014 at 03:07 AM. Reason: Added Dragonfly comments
 
Old 12-23-2014, 06:17 AM   #2
kooru
Senior Member
 
Registered: Sep 2012
Posts: 1,385

Rep: Reputation: 275Reputation: 275Reputation: 275
Great work!
You could write here
 
Old 12-23-2014, 11:12 AM   #3
hitest
Guru
 
Registered: Mar 2004
Location: Canada
Distribution: Void, Slackware
Posts: 7,341

Rep: Reputation: 3744Reputation: 3744Reputation: 3744Reputation: 3744Reputation: 3744Reputation: 3744Reputation: 3744Reputation: 3744Reputation: 3744Reputation: 3744Reputation: 3744
astrogeek,

Awesome stuff, man!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] slackware pxe/tftp server to host windows/iso installation slugman Slackware 4 12-04-2012 06:35 PM
FreeBSD Install goes to PXE boot - MBR messed up chi36 *BSD 1 08-20-2010 04:53 AM
Problem PXE booting FreeBSD 7.2 installer and installing via NFS btmiller *BSD 1 01-11-2010 05:32 AM
[SOLVED] Slackware 13.0 PXE installation chicken76 Slackware 8 11-02-2009 05:42 AM

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 06:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration