Autoinstall (OpenBSD)

From Wiki
Jump to navigation Jump to search


!! Work in progress !!

Of cause everything is well documented in dhcpd(8), tftpd(8), httpd(8), pxeboot(8), autoinstall(8), disklabel(8) and boot.conf(8).


  1. PXE boot rom of the network adapter gets a dhcp response containing the fields filename and next-server
  2. Loads pxeboot from the installation server via tftp
  3. Executes pxeboot, which loads the installation system bsd.rd via tftp
  4. Boot loader fetches the boot configuration boot.conf via tftp
  5. Systemboot into the installation system
  6. autoinstall fetches the installation configuration install.conf via http
  7. Unattended automatic installation starts
  8. Installer gets disklabel.txt via http for partitioning
  9. in side.tgz is executed
OpenBSD autoinstall files overview

Net Structure

Test Net Structure


# mkdir -p /var/tftpboot/etc
# chmod -R _tftpd:_tftpd /var/tftpboot
# cp /usr/mdec/pxeboot /var/tftpboot/
# cp /bsd.rd /var/tftpboot/bsd
# chmod 644 /var/tftpboot/bsd
# cd /var/tftpboot
# ln -s pxeboot auto_install
# rcctl enable tftpd

In /etc/rc.conf.local:

tftpd_flags=-4 /var/tftpboot


# rcctl start tftpd


File /etc/dhcpd.conf:

option  domain-name "puffy.local";
option  domain-name-servers;

subnet netmask {
        option routers;


        host pxe0 {
                hardware ethernet E6:2F:16:43:D9:9D;
                filename "auto_install";
                option host-name "pxe0";


# rcctl enable dhcpd
# rcctl start dhcpd


File /etc/httpd.conf:

server "default" {
        listen on port 80
        root "/htdocs"
        directory auto index

Note: The root path is relative to /var/www!


# rcctl enable httpd
# rcctl start httpd


The /var/tftpboot/etc/boot.conf file is optional, the installation boot loader uses it for configuration purposes, e.g.

stty com0 115200
set tty com0
set timeout 5

Here the console output is switched from graphical to serial. I use a Proxmox VE virtualization host and I like to connect to my new virtual machines during installation:

# qm terminal <VM ID>


File /var/www/htdocs/install.conf:

Password for root = $2b$11$2BGUZNcUlr/j/R2OKOSSw.gz.Y9lOqGbbzhBFnpZKHBu4IQexAa9q
Setup a user = no
Start sshd(8) by default? = yes
Allow root ssh login? = yes
Do you want the X Window System to be started by xenodm(1)? = no
URL to autopartitioning template for disklabel =
What timezone are you in = Europe/Berlin
Location of sets = http
Set name(s) = -all bsd bsd.rd base*.tgz man*.tgz site*.tgz
HTTP Server =
Server directory? = pub/OpenBSD/6.9/amd64
Unable to connect using https. Use http instead? = yes
INSTALL.amd64 not found. Use sets found here anyway? = yes
Directory does not contain SHA256.sig. Continue without verification? = yes
  • Password with encrypt


File /var/www/htdocs/disklabel.txt:

/       1G
swap    256M
/usr    3G
/var    3G
/home   1G
/tmp    1G




rcctl disable slaacd
rcctl disable ntpd
rcctl disable smtpd
rcctl disable sndiod
rcctl disable pflogd

echo "library_aslr=NO" >> /etc/rc.conf.local
echo "" > /etc/installurl
echo "" > /etc/motd


# chmod 755
# tar cfz site69.tgz


I think it's a good idea to have a minimal local mirror. While you can change the path to the file sets, I kept the default one. I normally only install bsd, bsd.rd and base*.tgz, but sometimes it is nice to have comp*.tgz and man*.tgz too. For me, there is no need for the X11 packages, because I only use OpenBSD in VMs. The following commands create a minimal repository:

# mkdir -p /var/www/htdocs/pub/OpenBSD/6.9/amd64
# cd /var/www/htdocs/pub/OpenBSD/6.9/amd64
# for file in "bsd" "" "bsd.rd" "base69.tgz" "comp69.tgz" "man69.tgz"; do ftp$file; done
# ls -ln > index.txt

Note the index.txt, which is very important because the installer looks for it to determine the available file sets.

First boot

  • Boot loader: boot sd0a:/bsd


  • Autoinstaller
    • DHCP leases file: /var/db/dhclient.leases.vio0