I want to install pfSense via USB boot stick. I am attempting to follow the instructions here:
https://doc.pfsense.org/index.php/Writing_Disk_Images#Linux.2Fother
Unfortunately they're fairly vague, so I've had to fill in the gaps a little. I'm doing this on Ubuntu:
wget https://nyifiles.pfsense.org/mirror/downloads/pfSense-CE-memstick-2.3.4-RELEASE-amd64.img.gz
sha256sum pfSense-CE-memstick-2.3.4-RELEASE-amd64.img.gz
gunzip pfSense-CE-memstick-2.3.4-RELEASE-amd64.img.gz
dd if=pfSense-CE-memstick-2.3.4-RELEASE-amd64.img of=/dev/sdb bs=65536 iflag=noatime status=progress
At this point, the USB stick should be ready to boot for installation. It does in fact boot, but then during the installation throws a bunch of errors:
Execution of the command
/usr/bin/tar -C /mnt/ -xzpf /distrib/pfSense.txz
FAILED with a return code of 1.
(da0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(da0:umass-sim0:0:0:0): SCSI status: Check Condition
(da0:umass-sim0:0:0:0): SCSI sense: ILLEGAL REQUEST asc:21.0 (Logical block address out of range)
(da0:umass-sim0:0:0:0): Error 22, Unretryable error
g_vfs_done():ufs/pfSense[READ(offset=567148544, length=131072)]error = 5
/lib/libcrypto.so.7: truncated input
Tar: Error exit delayed from previous errors.
Exit status: 1
I suspect that I'm writing to the USB stick incorrectly, because there are several indicators that something is wrong.
From Ubuntu, this looks OK:
# disktype /dev/sdb
--- /dev/sdb
Block device, size 14.94 GiB (16039018496 bytes)
FreeBSD boot loader (i386 boot1 at sector 0)
FreeBSD boot loader (i386 boot2/BTX 1.02 at sector 2)
BSD disklabel (at sector 1), 8 partitions
Partition a: 677.0 MiB (709894144 bytes, 1386512 sectors from 0)
Type 7 (4.2BSD fast file system)
Includes the disklabel and boot code
UFS2 file system, 64 KiB offset, little-endian
Volume name "pfSense" (in superblock)
Partition c: 677.0 MiB (709894144 bytes, 1386512 sectors from 0)
Type 0 (Unused)
# mount -r -t ufs -o ufstype=ufs2 /dev/sdb /mnt/stick/
# ls /mnt/stick
bin cf conf.default dev etc lib media pkgs rescue sbin sys usr
boot conf COPYRIGHT distrib home libexec mnt proc root scripts tmp var
But this all looks bad:
# ls /mnt/stick/distrib
ls: reading directory '.': Input/output error
# fsck.ufs -f /dev/sdb
** /dev/sdb
CANNOT READ BLK: 128
CONTINUE? [yn] y
THE FOLLOWING DISK SECTORS COULD NOT BE READ: 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
# fdisk -l /dev/sdb
Disk /dev/sdb: 15 GiB, 16039018496 bytes, 31326208 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x90909090
Device Boot Start End Sectors Size Id Type
/dev/sdb4 * 0 49999 50000 24.4M a5 FreeBSD
Curiously, loop-mounting the image file works:
# mount -r -t ufs -o loop,ufstype=ufs2 pfSense-CE-memstick-2.3.4-RELEASE-amd64.img /mnt/stick/
# ls stick/distrib
pfSense.txz
# bsdtar tf pfSense.txz
... shows all filenames ...
# fsck.ufs pfSense-CE-memstick-2.3.4-RELEASE-amd64.img
** pfSense-CE-memstick-2.3.4-RELEASE-amd64.img
** Last Mounted on
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
UNALLOCATED I=2942 OWNER=root MODE=0
SIZE=0 MTIME=Dec 31 19:00 1969
NAME=/usr/local/share/licenses/pkg-1.10.1_1/LICENSE
REMOVE? [yn] n
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? [yn] n
SUMMARY INFORMATION BAD
SALVAGE? [yn] n
BLK(S) MISSING IN BIT MAPS
SALVAGE? [yn] n
16256 files, 645714 used, 42892 free (124 frags, 5346 blocks, 0.0% fragmentation)
***** FILE SYSTEM MARKED DIRTY *****
***** PLEASE RERUN FSCK *****
I have lots of questions, including:
- Why do some tools report the proper 677MiB and others only report 24MB?
- Is the USB stick actually improperly set up, or am I just using the Ubuntu tools incorrectly for a FreeBSD UFS partition?
- What is the cause of the installation (block address out of range) failure?
- In the looped fsck, are any of those errors (summary information bad, etc.) important?
Thank you.