🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: muc.lists.freebsd.current
1 messages
1 total messages Started by Hiroki Sato Sat, 28 Nov 2026 14:39
CFT: iSCSI boot support
#250
Author: Hiroki Sato
Date: Sat, 28 Nov 2026 14:39
156 lines
7995 bytes
----Security_Multipart(Sat_Nov_28_23_39_10_2026_305)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello,

I would appreciate testing and feedback on iSCSI boot support for
FreeBSD.

FreeBSD already provides iSCSI initiator and target support.  This
work adds the integration needed to boot from an iSCSI root
filesystem: obtaining the boot configuration from firmware, passing it
through the loader to the bootstrap userland, and keeping connection
recovery independent of access to the iSCSI root.

A test kit for a single FreeBSD/amd64 host running bhyve is available
at [1].  It includes prebuilt system and boot images, scripts for
running the tests, and the corresponding source.  The FreeBSD source
changes are available at [2].

[1] https://people.allbsd.org/~hrs/FreeBSD/iscsi-boot-test-24e6b3385a79.tar.gz

[2] https://github.com/freebsd/freebsd-src/compare/main...hrs-allbsd:freebsd-src:main-hrs-iscsi-boot

README.md contains the full instructions.  Here is a minimal example
using EDK II without authentication.  Run the host commands as root
from the extracted kit directory, using an unused bridge name and
addresses.

In terminal 1:

 # pkg install bhyve-firmware python312
 # ifconfig bridge903 create
 # ifconfig bridge903 inet 192.0.2.1/24 up
 # sh target.sh targets/none.img 192.0.2.1

After "Target ready" appears, run this in terminal 2:

 # sh boot.sh edk2 bridge903

The guest should boot FreeBSD with its root filesystem on the iSCSI
target.  Wait for "ISCSI_LAB_BOOT_PASS", then log in as "root" with an
empty password.  The guest hostname is iscsi-boot.allbsd.org.

You can inspect the iSCSI session and mounted filesystems, then shut
down the guest:

 # iscsictl -L
 # mount -p
 # poweroff

To test iPXE, run the following after the EDK II guest has shut down,
leaving the target running:

 # sh boot.sh ipxe bridge903

After testing, shut down the guest, press Ctrl-C in terminal 1 to stop
the target, and remove the bridge:

 # ifconfig bridge903 destroy

The kit also supports CHAP and mutual CHAP.  Please use an isolated
test network; the supplied guest permits passwordless root login for
testing.

Here is how it works.  The client needs firmware with iSCSI boot
support, or a software implementation such as iPXE.  The firmware or
iPXE establishes the initial connection to the target and makes the
boot configuration available through iBFT, the iSCSI Boot Firmware
Table.  iBFT describes the initiator network configuration, target,
boot LUN, and authentication settings.  PXE can be used to load iPXE,
which can then perform the iSCSI boot.

In the external-image boot path, the client loads four main components
from the target: loader.efi, the GENERIC kernel, iscsi_boot.ko, and
iscsi-mfs.img.  The loader passes the iBFT configuration to FreeBSD.
FreeBSD then establishes its own iSCSI connection rather than
importing the firmware's existing connection.

The kernel implements the iSCSI data path, while iscsid(8) handles
operations including login and authentication during initial
connection and recovery.  Running the recovery daemon from the iSCSI
root can create a circular dependency: recovery may require executable
pages, libraries, or configuration files on the filesystem whose
connection is being recovered.

This implementation first boots a small memory-disk UFS root image,
iscsi-mfs.img, containing static bootstrap tools.  It configures
networking, establishes the FreeBSD iSCSI session, identifies and
checks the root filesystem, and initiates reroot.  A separate
RAM-backed recovery environment is prepared and retained across reroot
so that the recovery daemon and its required files remain available
when the iSCSI root is temporarily inaccessible.

An implementation overview is as follows:

- UEFI loader: Reads iBFT network, target, LUN, and authentication
  settings and passes them to FreeBSD when iSCSI boot is explicitly
  enabled.

- iSCSI initiator: Adds the optional `iscsi_boot.ko` module for boot
  authentication and recovery policy, including login deadlines, retry
  backoff, and failure handling.

- iscsid: Adds support for an inherited device descriptor and a
  recovery-root chroot.

- Bootstrap userland: Configures networking, connects the target,
  identifies the boot LUN, checks the filesystem, and initiates
  reroot.  The kit includes the bootstrap helpers and test tooling.

- init and reroot_seed: Prepare and retain the RAM-backed recovery
  environment across reroot.

- rc scripts: Manage the recovery daemon and preserve the network
  configuration required by the iSCSI root during startup, service
  restarts, and shutdown.

The GENERIC kernel configuration remains unchanged.  The boot module
and memory-disk image are supplied separately; the image is not
embedded in GENERIC.  The target root filesystem also needs the
updated init, rc scripts, and iscsid.  The supplied system images
already include these changes.

Testing so far has used UEFI/amd64 guests under bhyve, with both iPXE
and EDK II.  Feedback on the design, additional test results, and
experience with physical systems would be particularly welcome.

I plan to submit the changes for review after gathering feedback and
addressing any significant concerns.  Comments on the approach are
welcome even if you cannot test it.

Thank you.

-- Hiroki

----Security_Multipart(Sat_Nov_28_23_39_10_2026_305)--
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----

iMgEABMKAC4WIQRsDSNTJ8+Ax5Ae/dLbsH3Gbx9zfwUCawrnjhAcaHJzQGZyZWVi
c2Qub3JnAAoJENuwfcZvH3N/XUUCBjjRv0HjVVel6iA22Sz58Ef+QKMq34x4v3av
ejrBy+Ey2t21Gnkvk1QPg5Nj2DwqQscXr48VARmCbBS2E+uTxi2OAgjtIMOH7KO6
8VJWYwy7oe75opkSgLBvE+yAgmjXZA+1BrlN24Ld8Z8HYS89on/oaTPvxE/Lpd9t
1rgEeQXhSjzU9g==
=lphh
-----END PGP SIGNATURE-----

----Security_Multipart(Sat_Nov_28_23_39_10_2026_305)----


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads