OpenBSD manual page server

Manual Page Search Parameters

AUTOINSTALL(8) System Manager's Manual AUTOINSTALL(8)

autoinstallunattended OpenBSD installation and upgrade

autoinstall allows unattended installation or upgrade of OpenBSD by automatically responding to installer questions with answers from a response file. autoinstall uses DHCP to discover the location of the response file and HTTP to fetch the file. If that fails, the installer asks for the location which can either be a URL or a local path.

See install.site(5) for how to provide custom configuration.

To start unattended installation or upgrade choose '(A)utoinstall' at the install prompt. If there is only one network interface, the installer fetches the response file via that interface. If there is more than one network interface, a selection is presented and the installer fetches the response file via the selected interface.

If the machine is netbooted, the autoinstall feature is invoked if the user does not intervene within a short time. It behaves as if the user selected '(A)utoinstall', but always fetches the response file via the netboot interface.

If either /auto_install.conf or /auto_upgrade.conf is found on bsd.rd's built-in RAM disk, autoinstall behaves as if the machine is netbooted, but uses the local response file. In case both files exist, /auto_install.conf takes precedence.

autoinstall uses HTTP to fetch one of the files install.conf, MAC_address-install.conf or hostname-install.conf for install answers, or one of upgrade.conf, MAC_address-upgrade.conf or hostname-upgrade.conf for upgrade answers.

The URL used to fetch the file is constructed from dhcp-options(5) statements extracted from the DHCP lease file. next-server specifies the server. filename specifies the filename. The statement option host-name specifies the hostname which is also used as the default hostname during installation.

If filename is auto_install, then the URLs tried are, in order:

http://server/MAC_address-install.conf
http://server/hostname-install.conf
http://server/install.conf

where MAC_address is a string of six hex octets separated by colons representing the MAC address of the interface being used to fetch the files.

If filename is auto_upgrade, the URLs tried are, in order:

http://server/MAC_address-upgrade.conf
http://server/hostname-upgrade.conf
http://server/upgrade.conf

On architectures where the filename statement is used to provide the name of the file to netboot it is necessary to create symbolic links called auto_install and auto_upgrade that point to the expected boot program and to change the value of the filename statement in the dhcpd.conf(5) file to be auto_install or auto_upgrade.

To use a subdirectory as response file location on the HTTP server, the same directory structure containing the symbolic links has to exist in the tftproot directory. The value of filename has to be the full path to these symbolic links, and the HTTP and TFTP servers must be on the same machine.

The response file is a line-oriented ASCII text file. The format of each line is:

question = answer

question is an installer question (not including the question mark) or a non-ambiguous part of it, consisting of whitespace separated words. answer is the answer to the question. Passwords may be in plaintext, encrypted with encrypt(1), or set to ‘*************’ (13 '*'s) to disable password logins, only permitting alternative access methods (for example, ssh(1) keys).

If autoinstall does not find an answer in the response file, the default answer as provided by the installer is used.

The response file may contain answers to the following questions, which are only available during unattended installation to provide additional installer features:

Public ssh key for root account = ssh key
ssh key is stored in /root/.ssh/authorized_keys.
Public ssh key for user puffy = ssh key
ssh key is stored in ~puffy/.ssh/authorized_keys.
URL to autopartitioning template for disklabel = url
A template file for disklabel(8) autopartitioning is fetched from url allowing a custom partition layout for the root disk.

/etc/dhcpd.conf
dhcpd(8) configuration file
install.conf
response file for unattended installation
upgrade.conf
response file for unattended upgrade

A typical install.conf file will look something like this:

System hostname = server1
Password for root = $2b$14$Z4xRMg8vDpgYH...GVot3ySoj8yby
Change the default console to com0 = yes
Which speed should com0 use = 19200
Setup a user = puffy
Password for user = *************
Public ssh key for user = ssh-ed25519 AAAAC3NzaC1...g3Aqre puffy@ai
What timezone are you in = Europe/Stockholm
Location of sets = http
HTTP Server = cdn.openbsd.org

The same file could be used for upgrades by creating a symbolic link called upgrade.conf that points to install.conf. The upgrade process will only use the answers it needs.

And an example dhcpd.conf(5) host declaration:

host foo {
  hardware ethernet 00:50:60:49:8b:84;
  fixed-address 192.168.2.180;
  filename "auto_install";
  option host-name "foo";
}

dhcp-options(5), dhcpd.conf(5), install.site(5), diskless(8)

The autoinstall feature first appeared in OpenBSD 5.5.

Robert Peichaer <rpe@openbsd.org>

November 8, 2021 OpenBSD-current