Installation

There is currently no first-class installation procedure for AlpineBSD. But, if you’re brave and want to give it a try, a manual procedure could look something like the following:

1. Download and boot the NetBSD install media

Self explanatory.

2. Set up networking and drop to a shell

In the NetBSD installer, set up networking via Utility menu -> Configure network. Then back out to a shell via Run /bin/sh.

3. Set up partitions

AlpineBSD only supports GPT-formatted disks. You can try BSD disk labels if you want, it might work, but YMMV.

Query the names of disks present to find your install target:

sysctl hw.disknames

You can narrow it down further (e.g. by dumping the disk vendor) with drvctl:

drvctl -p ld0

We’ll assume $target is the name of the disk you wish to install AlpineBSD on. Create your desired partitions, something like this:

gpt create $target
gpt add -l EFI -t efi -s 1G # For EFI support
gpt add -l swap -t swap -s 4G
gpt add -l AlpineBSD -t ffs
# ...and anything else you want...

4. Prepare and mount filesystems

New partitions will appear as dk* devices, e.g. dk1 for the first partition, and rdk* is the corresponding “raw” device.

Create the necessary filesystems in a manner similar to the following:

newfs_msdos /dev/rdk1  # EFI system partition
newfs -O 2ea /dev/rdk2 # Root filesystem

Mount your filesystems in the desired layout on /mnt.

5. Bootstrap apk

Run the following commands to initialize apk:

mkdir -p /mnt/etc/apk/keys /mnt/sbin
echo x86_64 >/mnt/etc/apk/arch
cat <<EOF >/mnt/etc/apk/repositories
http://alpinebsd.org/mirror/edge/base
#http://alpinebsd.org/mirror/edge/main
#http://alpinebsd.org/mirror/edge/community
EOF
ftp -o /mnt/etc/apk/keys/drew@ddevault.org-6a69e517.rsa.pub https://alpinebsd.org/mirror/drew%40ddevault.org-6a69e517.rsa.pub
ftp -o /mnt/sbin/apk https://alpinebsd.org/mirror/apk.static
chmod +x /mnt/sbin/apk

6. Install packages

Now you can install the required packages:

apk -p /mnt --initdb --check-certificate=no \
    absd-base \
    netbsd-kernel-generic-bin \
    netbsd-firmware \
    ifupdown \
    dhcpcd \                # Optional: DHCP support
    wpa_supplicant \        # Optional: WiFi support
    docs \                  # Optional: Man pages
    netbsd-bootloader-$type # $type: efi or mbr

7. chroot setup

chroot into your new system and perform whatever additional setup you require, for example creating new users or installing additional packages.

7a. Make devices

NetBSD uses a static device tree. Run the following to initialize it:

cd /dev && ./MAKEDEV all

7b. Set up s6

At a minimum you must initialize s6 in the chroot. Run s6 set status to print a list of available services and enable the essential services like so:

s6 repo init
s6-instance getty@ttyE1
s6-instance getty@ttyE2
s6-instance getty@ttyE3
s6 repo sync
s6 set enable \
    getty@ttyE1 \
    getty@ttyE2 \
    getty@ttyE3 \
    wscons \
    switchvt \
    root \
    persist-log \
    mountall \
    hostname \
    fsck_root \
    fsck
s6 set commit
s6 live install --init

7c. Install and configure bootloader

You should have installed the appropriate bootloader package for your system in step 6. To install and configure it:

EFI

Ensure your EFI system partition is mounted, then copy /usr/mdec/bootia32.efi to the EFI partition at /EFI/boot/bootx64.efi.

Legacy (BIOS) boot

Copy a suitable secondary bootloader for your root filesystem type from /usr/mdec (e.g. bootxx_ffsv2) to /boot, then run the following:

gpt biosboot -L AlpineBSD

For more exotic boot configurations, consult the NetBSD docs.

Bootloader configuration

Create /etc/boot.cfg and populate it with something similar to the following:

menu=Boot AlpineBSD:root NAME=AlpineBSD;rndseed /var/db/entropy-file;boot
menu=Boot AlpineBSD single user:root NAME=AlpineBSD; rndseed /var/db/entropy-file; boot -s
menu=Drop to boot prompt:prompt
default=1
timeout=5
clear=1

7d. Set up /etc/fstab

A basic fstab is installed by the absd-base package. You must customize it to suit your system, for example:

NAME=AlpineBSD  /   ffs rw,log  1 2
NAME=swap   none    swap    sw  0
tmpfs       /tmp    tmpfs   rw,-m1777,-sram%25
kernfs      /kern   kernfs  rw
ptyfs       /dev/pts    ptyfs   rw
procfs      /proc   procfs  rw
tmpfs       /var/shm    tmpfs   rw,-m1777,-sram%25

8. Reboot

Congratulations, you’ve (probably) installed AlpineBSD. Reboot and remove the NetBSD install media.