BSDINSTALL(8)
π¦ NAME π¦
bsdinstall β system installer. Yes bestie, this is the bsdinstall(8) page, and it's literally the main character of installing a new system. π
β¨ SYNOPSIS β¨
bsdinstall [options] [target] [...]
π DESCRIPTION π
bsdinstall is used for installation of new systems β both for system setup from installation media (think discs, USBs, or network boot environments) and for use on live systems to prepare jails and virtual machine images. It's giving "one tool, many moods." π
Much like make(1), bsdinstall takes a target and possible parameters of the target as arguments. If you invoke it with no arguments, it will invoke the auto target, which provides a standard interactive installation, invoking the others in sequence. So no args = the whole guided vibe. π«Ά
To perform a scripted installation, these subtargets can be invoked separately by an installation script. Script girlies, this one's for you. π»β¨
πΈ OPTIONS πΈ
bsdinstall supports the following options, global to all targets:
-D fileβ Provide a path for the installation log file (overridesBSDINSTALL_LOG). See βENVIRONMENT VARIABLESβ for more information onBSDINSTALL_LOG. Log it, don't lose it. π
π₯ TARGETS π₯
Most of the following targets are only useful for scripting the installer. For interactive use, most users will be interested only in the auto, jail, and script targets. The rest are lowkey for the automation girlies. π€
autoβ Run the standard interactive installation, including disk partitioning.
The DISTRIBUTIONS environment variable is set to βbase.txz kernel.txzβ by default for this target.
jail destinationβ Sets up a new chroot system at destination, suitable for use withjail(8). Behavior is generally similar toauto, except that disk partitioning and network setup are skipped and a kernel is not installed into the new system.
The DISTRIBUTIONS environment variable is set to βbase.txzβ by default for this target.
script scriptβ Runs the installation script at script. See βSCRIPTINGβ for more information on this target.
The DISTRIBUTIONS environment variable is unset by default for this target. Instead, the COMPONENTS environment variable is effectively set to βbase kernel kernel-dbgβ for this target.
keymapβ If the current controlling TTY is asyscons(4)orvt(4)console, asks the user to set the current keymap, and saves the result to the new system'src.conf. Keyboard glow-up, secured. β¨οΈβ¨hostnameβ Prompts the user for a host name for the new system and saves the result to the new system'src.conf. IfBSDINSTALL_CONFIGCURRENTis set, also sets the host name of the current system. Name reveal moment. π·οΈnetconfigβ Interactively configures network interfaces (first invokingwlanconfigon wireless interfaces), saving the result to the new system'src.confandresolv.conf. IfBSDINSTALL_CONFIGCURRENTis set, also configures the network interfaces of the current system to match. Wi-Fi bestie behavior. πΆautopartβ Provides the installer's interactive guided disk partitioner for single-disk installations. Defaults to UFS. Slice it, dice it, UFS it. π½bootconfigβ Detects an appropriate partition and installs UEFI boot loader files.zfsbootβ Provides a ZFS-only automatic interactive disk partitioner. Creates a single zpool with separate datasets for/home,/tmp,/usr,/usr/ports,/usr/src, and/var. Optionally can set upgeli(8)to encrypt the disk. ZFS girlies rise. ππparteditβ Provides the installer's interactive manual disk partitioner with an interface identical tosade(8). Supports multiple disks as well as UFS, ZFS, and FAT file systems. ZFS is set up with one pool and dataset per partition.scriptedpart parametersβ Sets up disks likeautopartandpartedit, but non-interactively according to the disk setup specified in parameters. Each disk setup is specified by a three-part argument:
disk [scheme] [{partitions}]
Multiple disk setups are separated by semicolons. The disk argument specifies the disk on which to operate (which will be erased), or the special value DEFAULT, which will result in either a selection window (as in autopart) for the destination disk or, if there is only one possible disk, will automatically select it. The scheme argument specifies the gpart(8) partition scheme to apply to the disk. If scheme is unspecified, scriptedpart will apply the default bootable scheme on your platform. The partitions argument is also optional and specifies how to partition disk. It consists of a comma-separated list of partitions to create enclosed in curly braces. Each partition declaration takes the form:
size type [mount point]
size specifies the partition size to create in bytes (K, M, and G suffixes can be appended to specify kilobytes, megabytes, and gigabytes respectively), while the auto keyword causes the partition to take all the remaining space on the disk. The type option chooses the gpart(8) filesystem type, e.g., freebsd-ufs, freebsd-zfs, or freebsd-swap. The optional mount point argument sets where the created partition is to be mounted in the installed system. As an example, a typical invocation looks like:
bsdinstall scriptedpart ada0 { 20G freebsd-ufs /, 4G freebsd-swap, 20G freebsd-ufs /var, auto freebsd-ufs /usr }
Note that the list of partitions should not include boot partitions (e.g. EFI system partitions), which will be created automatically on whatever disk includes /.
A shorter invocation to use the default partitioning (as autopart would have used) on the same disk:
bsdinstall scriptedpart ada0
or, even shorter:
bsdinstall scriptedpart DEFAULT
mountβ Mounts the file systems previously configured byautopart,partedit, orscriptedpartunderBSDINSTALL_CHROOT. Mount up, bestie. ποΈdistfetchβ Fetches the distributions inDISTRIBUTIONStoBSDINSTALL_DISTDIRfromBSDINSTALL_DISTSITE.checksumβ Verifies the checksums of the distributions listed inDISTRIBUTIONSagainst the distribution manifest. Trust but verify, no cap. βdistextractβ Extracts the distributions listed inDISTRIBUTIONSintoBSDINSTALL_CHROOT.pkgbase [--jail]β Fetch and install base system packages toBSDINSTALL_CHROOT. Packages are fetched according to repository configuration inBSDINSTALL_PKG_REPOS_DIRif set, orpkg.freebsd.orgotherwise. If the--jailoption is passed, no kernel is installed, and the βjailβ variant of each package set will be selected where applicable.firmwareβ Executesfwget(8)inside theBSDINSTALL_CHROOTto install any needed and available firmware for the new system. Firmware update era. πrootpassβ Interactively invokespasswd(1)in the new system to set the root user's password. Keep it secret, keep it safe. πadduserβ Interactively invokesadduser(8)in the new system.timeβ Interactively sets the time, date, and time zone of the new system. β°servicesβ Queries the user for the system daemons to begin at system startup, writing the result into the new system'src.conf. Daemon selection ceremony. π§entropyβ Reads a small amount of data from/dev/randomand stores it in a file in the new system's root directory. Entropy is literally the vibe. πconfigβ Installs the configuration files destined for the new system, e.g.,rc.conf(5)fragments generated bynetconfig, etc.) onto the new system.
β¨ ENVIRONMENT VARIABLES β¨
okay bestie, these are the environment variables that control the installation process. π A bunch of them are used internally during installation and come with reasonable default values for most installation scenarios. Others get set by various interactive user prompts, and you can usefully override them when you're making scripted or customized installers. slay. π
TMPDIRβ the directory to use for temporary files. Default:/tmp. π¦COMPONENTSβ the set of components to install for scripted installations using base system packages, e.g.,base lib32 kernel-dbg tests. Default:"base kernel-dbg". β¨DISTRIBUTIONSβ the set of distributions to install for traditional installations, e.g.,base.txz kernel.txz ports.txz. If unset, thenbsdinstallwill install using base system packages. Default: unset unless noted otherwise in theTARGETSsection. πPARTITIONSβ the partitioning of the disk onto which the system is being installed. Seescriptedpartof theTARGETSsection for format details. If this variable is unset, the installer will use the default partitioning as inautopart. Default: unset. πΈBSDINSTALL_DISTDIRβ the directory in which the distribution files can be found (or to which they should be downloaded). Default:/usr/freebsd-dist. π«ΆBSDINSTALL_DISTSITEβ URL from which the distribution files should be downloaded if they are not already present in the directory defined byBSDINSTALL_DISTDIR. This should be a full path to the files, including architecture and release names. Most targets, e.g.,autoandjail, that prompt for a FreeBSD mirror will skip that step if this variable is already defined in the environment. Example:https://download.freebsd.org/ftp/releases/powerpc/powerpc64/13.1-RELEASE/orhttp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/amd64/12.2-RELEASE/. π₯BSDINSTALL_PKG_REPOS_DIRβ directory containingpkg(8)repository configuration files used by thepkgbasetarget. See βREPOSITORY CONFIGURATIONβ inpkg.conf(5). Default: unset. π§BSDINSTALL_CHROOTβ the directory into which the distribution files should be unpacked and the directory at which the root file system of the new system should be mounted. Default:/mnt. πBSDINSTALL_LOGβ path to a log file for the installation. Default:$TMPDIR/bsdinstall_log. βBSDINSTALL_SKIP_FIRMWAREβ if not empty, theautotarget will not invoke the firmware target. πBSDINSTALL_SKIP_HARDENINGβ if not empty, theautotarget will not invoke the hardening target. πBSDINSTALL_SKIP_HOSTNAMEβ if not empty, theautotarget will not invoke the hostname target. π¦BSDINSTALL_SKIP_KEYMAPβ if not empty, theautotarget will not invoke the keymap target. β¨BSDINSTALL_SKIP_MANUALβ if not empty, theautotarget will not offer to open a shell in the new system for final manual modifications. πBSDINSTALL_SKIP_SERVICESβ if not empty, theautotarget will not invoke the services target. πΈBSDINSTALL_SKIP_TIMEβ if not empty, theautotarget will not invoke the time target. π«ΆBSDINSTALL_SKIP_USERSβ if not empty, theautotarget will not invoke theaddusertarget. π₯BSDINSTALL_SKIP_FINALCONFIGβ if not empty, theautotarget will not show the final configuration dialog, where earlier configuration choices can be revisited. π§BSDINSTALL_TMPETCβ directory where files destined for the new system's/etcwill be stored until theconfigtarget is executed. If this directory does not already exist, it will be created. Default:$TMPDIR/bsdinstall_etc. πBSDINSTALL_TMPBOOTβ directory where files destined for the new system's/bootwill be stored until theconfigtarget is executed. If this directory does not already exist, it will be created. Default:$TMPDIR/bsdinstall_boot. βROOTPASS_ENCβ encrypted string to set the root password to in the format expected bypw(8) -H 0. This option is used if both it andROOTPASS_PLAINare set. πROOTPASS_PLAINβ plain text string to set the root password to. πZFSBOOT_POOL_NAMEβ name for the pool containing the base system. Default:zroot. π¦ZFSBOOT_POOL_CREATE_OPTIONSβ options to be used when creating the base system's pool. Each option must be preceded by the-Oflag to be taken into consideration or the pool will not be created due to errors using the commandzpool. Default:-O compression=on -O atime=off. β¨ZFSBOOT_BEROOT_NAMEβ name for the boot environment parent dataset. This is a non-mountable dataset meant to be a parent dataset where different boot environments are going to be created. Default:ROOT. πZFSBOOT_BOOTFS_NAMEβ name for the primary boot environment, which will be the default boot environment for the system. Default:default. πΈZFSBOOT_VDEV_TYPEβ the type of pool to be created for the base system. This variable can take one of these values:stripe(No redundancy),mirror(n-Way mirroring),raid10(RAID 1+0 - n x 2-Way Mirrors),raidz1(RAID-Z1 - Single Redundancy RAID),raidz2(RAID-Z2 - Double Redundancy RAID) orraidz3(RAID-Z3 Triple Redundancy RAID). Default:stripe. π«ΆZFSBOOT_FORCE_4K_SECTORSβ controls the minimum sector size of the pool. If this variable is not empty, the minimum sector size is 4K. If this variable is empty, the minimum sector size is 512. Note that the sector size of the pool will always be at least the sector size of the backing disks. Default:1. π₯ZFSBOOT_GELI_ENCRYPTIONβ if this variable is not empty, it will usegeli(8)to encrypt the root pool, enabling automatically theZFSBOOT_BOOT_POOLvariable. Default:"". π§ZFSBOOT_GELI_KEY_FILEβ path to thegeli(8)keyfile used to encrypt the pool where the base system is stored. Default:/boot/encryption.key. πZFSBOOT_BOOT_POOLβ if set, a separated boot pool will be created for the kernel of the system andloader(8). Default: unset. βZFSBOOT_BOOT_POOL_CREATE_OPTIONSβ options to use when creating the boot pool, when enabled (seeZFSBOOT_BOOT_POOL). Default: unset. πZFSBOOT_BOOT_POOL_NAMEβ name for the optional boot pool when it is enabled (seeZFSBOOT_BOOT_POOL). Default:bootpool. πZFSBOOT_BOOT_POOL_SIZEβ size of the boot pool when it is enabled (seeZFSBOOT_BOOT_POOL). Default:2g. π¦ZFSBOOT_DISKSβ disks to be used for the base system, including the boot pool. This variable must only be used on a scripted installation. SeeSCRIPTINGfor more information. Default: unset. β¨ZFSBOOT_SWAP_SIZEβ size of the swap partition on each block device. This variable will be passed togpart(8), which supports SI unit suffixes. Default:2g. πZFSBOOT_SWAP_ENCRYPTIONβ if set, enables the encryption of the swap partition usinggeli(8). Default:"". πΈZFSBOOT_SWAP_MIRRORβ if set, enables a swap mirroring usinggmirror(8). Default: unset. π«ΆZFSBOOT_DATASETSβ ZFS datasets to be created on the root zpool, it requires the following datasets:/tmp,/var/tmp,/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME. See βZFS DATASETSβ for more information about how to populate this variable and its default value. π₯ZFSBOOT_CONFIRM_LAYOUTβ if set and the installation is interactive, allow the user to confirm the layout before continuing with the installation. Default:1. π§
πΎ SCRIPTING πΎ
okay so this is the part where bsdinstall gets β¨hands-freeβ¨ β it supports unattended (or barely-attended) installations using scripting, and honestly it's giving main character energy. You can use this with either modified physical installation media or with diskless(8) installations over the network β and if you need to know how to prep that media, go read βBUILDING AUTOMATIC INSTALL MEDIAβ (it's literally further down this page, bestie, keep scrolling).
Scripted installs follow an essentially identical path to interactive installs, though there are some minor feature differences β for example, scripted installations do not support fetching of remote distribution files, because scripted installations normally install the same files and the distributions can be added directly to the installation media. No cap.
A bsdinstall script is made of two parts:
- a preamble β this sets up the options for the installation (how to partition the disk[s], which distributions to install, etc.)
- an optional setup script β a shell script run under
chroot(8)in the newly installed system beforebsdinstallexits
The two parts are separated by the usual script header (#!), which also sets the interpreter for the setup script. π
A typical bsdinstall script, using the default filesystem layout and the UFS filesystem, looks like this:
PARTITIONS=DEFAULT
COMPONENTS="base debug"
#!/bin/sh
sysrc ifconfig_DEFAULT=DHCP
sysrc sshd_enable=YES
pkg install -y puppet
For a scripted installation involving a ZFS pool spanning multiple disks, the script instead looks like this:
COMPONENTS="base debug"
export ZFSBOOT_VDEV_TYPE=stripe
export ZFSBOOT_DISKS="ada0 ada1"
export nonInteractive="YES"
#!/bin/sh
echo "ifconfig_DEFAULT=DHCP" >> /etc/rc.conf
echo "sshd_enable=YES" >> /etc/rc.conf
pkg install -y puppet
To install using traditional distributions sets instead of packages, set DISTRIBUTIONS to the list of distribution sets to install, like this:
PARTITIONS=DEFAULT
DISTRIBUTIONS="kernel.txz base.txz"
#!/bin/sh
sysrc ifconfig_DEFAULT=DHCP
sysrc sshd_enable=YES
pkg install -y puppet
On FreeBSD release media, such a script placed at /etc/installerconfig will be run at boot time and the system will be rebooted automatically after the installation has completed π₯ β perfect for unattended network installation of new systems; see diskless(8) for details.
π§ PREAMBLE π§
The preamble is literally just installer settings. They control global installation parameters (peep βENVIRONMENT VARIABLESβ) as well as disk partitioning. The preamble is interpreted as a sh(1) script run at the very beginning of the install β so if you want more complicated behavior than setting these variables, you can run arbitrary commands right here to extend the installer. Obsessed.
In addition to the variables in βENVIRONMENT VARIABLESβ, in particular COMPONENTS, the preamble can contain a variable PARTITIONS which is passed to the scriptedpart target to control disk setup.
Alternatively, to use zfsboot instead of partedit, the preamble can contain the variable ZFSBOOT_DATASETS instead of PARTITIONS (see below, bestie π). If you're using zfsboot, the variables ZFSBOOT_DISKS and ZFSBOOT_VDEV_TYPE must be set to create the pool of disks for the base system. Usually, for a mirrored booting disk, these two variables look like this:
ZFSBOOT_DISKS="ada0 ada1"
ZFSBOOT_VDEV_TYPE=mirror
β οΈ Remember toexportall the variables for thezfsbootcommand β otherwise installation will fail. fr fr, don't skip this one π
πΈ SETUP SCRIPT πΈ
Following the preamble is an optional shell script, beginning with a #! declaration. This script will be run at the end of the installation process inside a chroot(8) environment in the newly installed system, and it can be used to set up configuration files, install packages, etc.
Heads up: newly configured system services β e.g. networking β have not been started in the installed system at this time, and only installation host services are available. So don't be surprised when your freshly-written rc.conf isn't doing anything yet π
π¦ ZFS DATASETS π¦
If you're using zfsboot in an installation script, the zfsboot partitioning tool takes the ZFSBOOT_DATASETS variable to create the ZFS datasets on the base system. This variable definition can become large if the pool contains many datasets (it's giving "I have a lot of folders and I'm not sorry"). The default value of ZFSBOOT_DATASETS is:
# DATASET OPTIONS (comma or space separated; or both)
# Boot Environment [BE] root and default boot dataset
/$ZFSBOOT_BEROOT_NAME mountpoint=none
/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME mountpoint=/
# Home directories separated so they are common to all BEs
/home mountpoint=/home
# Create /tmp and allow exec but not setuid
/tmp mountpoint=/tmp,exec=on,setuid=off
# Do not mount /usr so that 'base' files go to the BEROOT
/usr mountpoint=/usr,canmount=off
# Ports tree
/usr/ports setuid=off
# Source tree
/usr/src
# Create /var and friends
/var mountpoint=/var,canmount=off
/var/audit exec=off,setuid=off
/var/crash exec=off,setuid=off
/var/log exec=off,setuid=off
/var/mail atime=on
/var/tmp setuid=off
The first column is the name of the dataset to be created as part of the ZFSBOOT_POOL_NAME pool, and the remainder of each line contains the options to be set on each dataset. If multiple options are given, they can be separated by either commas or whitespace; everything following a pound/hash character is ignored as a comment. π
β BUILDING AUTOMATIC INSTALL MEDIA β
If you're building automatic install media, use tar to extract a release ISO:
mkdir release-media
tar -C release-media -xvf FreeBSD-13.0-RELEASE-amd64-disc1.iso
Then place a script as above in etc/installerconfig
This directory can then be used directly as an NFS root for diskless(8) installations, or it can be rebuilt into an ISO image using the release scripts in /usr/src/release. For example, on amd64:
sh /usr/src/release/amd64/mkisoimages.sh -b
'13_0_RELEASE_AMD64_CD' output.iso release-media
π HISTORY π
This version of bsdinstall first appeared in FreeBSD 9.0. vintage π
π«Ά AUTHORS π«Ά
- Nathan Whitehorn
<nwhitehorn@FreeBSD.org> - Devin Teske
<dteske@FreeBSD.org> - Allan Jude
<allanjude@FreeBSD.org>
and that's the whole page, bestie πβ¨ This one shipped out from Debian on May 12, 2026 β go forth and install things unattended, you absolute icon π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π the page's license: BSD-2-Clause
- Copyright (c) 2011-2013 Nathan Whitehorn <nwhitehorn@FreeBSD.org> All rights reserved
- Copyright (c) 2018 Roberto Fernandez Cueto <roberfern@gmail.com>
- Copyright (c) 2024 The FreeBSD Foundation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms