This document describes the process of preparing the automatic installer pFsense on a USB stick. The whole procedure was tested on Ubuntu.
-
Download the required packages by running the following command:
sudo apt install linux-headers-$(uname -r) linux-source$(uname -r | cut -d- -f1)
-
Go to the indicated location and unzip the file named
linux-source-$(uname -r | cut -d- -f1).tar.bz2
as shown below:cd /usr/src/linux-source-$(uname -r | cut -d- -f1)/ sudo tar xjf linux-source-$(uname -r | cut -d- -f1).tar.bz2
-
After successfully unpacking, copy the files required for kernel installation by running the following commands:
sudo cp ../linux-headers-$(uname -r)/Module.symvers linux-source-$(uname -r | cut -d- -f1)/ cd linux-source-$(uname -r | cut -d- -f1)/ sudo cp /boot/config-$(uname -r) .config
-
Finally, build and install the kernel by running the following command:
sudo make olddefconfig
-
Edit the
.config
file by setting the value ofUFS_FS_WRITE
toy
. -
Prepare resources to compile the UFS module by running the following commands:
sudo make prepare sudo make modules_prepare sudo make M=scripts/mod -j8 sudo make M=fs/ufs modules -j8
-
Copy the previously prepared files by running the following commands (To load an unsigned kernel module it is required to disable Secure Boot, otherwise it won't work):
sudo cp /lib/modules/$(uname -r)/kernel/fs/ufs/ufs.ko /lib/modules/$(uname -r)/kernel/fs/ufs/ufs_backup.ko sudo cp fs/ufs/ufs.ko /lib/modules/$(uname -r)/kernel/fs/ufs/ufs.ko
-
Load the UFS module by running the following commands:
sudo depmod sudo modprobe ufs
-
Mount the
FreeBSD_install
partition to properly configure the installer by running the following command(X
depending on how many drives are connected to your computer):sudo mount -t ufs -o ufstype=ufs2 /dev/sdX5 /mnt
After booting from the USB stick installer rc.local
is executed. Changes have
to be applied to this file to eliminate interactive dialog options. After
mounting parition edit the rc.local
file located in the etc
folder by using
nano
or vim
editors.
-
Add environment variable defining terminal type:
#!/bin/sh # $FreeBSD$ export TERM=vt100
-
Comment out console type input:
# Serial or other console echo echo "Welcome to pfSense!" echo echo "Please choose the appropriate terminal type for you system." echo "Common console types are:" echo " ansi Standard ANSI terminal" echo " vt100 VT100 or compatible terminal" echo " xterm xterm terminal emulator (or compatible)" echo " cons25w cons25w terminal" echo echo -n "Console type [vt100]: " #read TERM #TERM=${TERM:-vt100}
The installerconfig
script is called if exists. If it doesn't exist manual
installation is performed.
#!/bin/bash
# Unattended installation part
...
# After installation you can launch new system shell and change configuration
...
# When work is exit
exit
This file must be located in the etc
directory. The etc/installerconfig
script will install pfSense and replace all configuration files that we want to
change before the first boot.
An example file is located here.
During extracting distribution files phase installation sometimes hangs up. I waited for 15 minutes and nothing happened. My solution was to reset the platform.