OpenBSD on Scaleway START1-XS


EDIT (1/1/2019): Unfortunately it looks like these instructions no longer work; I haven't yet found an alternative way to boot OpenBSD on Scaleway.

Scaleway have some nice, low-cost VPS plans. OpenBSD is a nice, minimal operating system. Why not make the two meet?

Background

Scaleway don't offer OpenBSD images on any of their servers. People have, in the past, managed to get OpenBSD onto one of their cloud server configurations with some hackery involving manual intervention at reboots. At that time, the boot process of the cloud servers involved the emulated firmware downloading the (Linux) kernel and initial RAM filesystem off the network and then jumping from the ramdisk to the operating system on disk. However, Scaleway have recently revised their product line and also introduced the option to boot the kernel from the local disk. This works by running an emulated UEFI loader, which then looks for a EFI system partition on the disk to boot from. By adapting the installation instructions linked above, it's possible to load other, unsupported operating systems without manual intervention.

Setup

Log into the control panel, and create a new START1-XS server. At the time of writing, this configuration is only available in Scaleway's Paris datacentre, and there are only Ubuntu and Fedora images available. Select whichever one you wish, however the local boot option must be turned off.

Start the server, and in the virtual serial console press Control-B to interrupt the iPXE ROM. Then, at the iPXE prompt (shown here as iPXE>) enter the following commands to load the OpenBSD 6.3 installation CD image from the network and boot into it (the choice of mirror here is arbitrary):

iPXE> dhcp
[Network interface is configured]
iPXE> initrd http://ftp.ch.openbsd.org/pub/OpenBSD/6.3/amd64/install63.iso
[ISO image downloads]
iPXE> chain http://boot.salstar.sk/memdisk iso raw
[OpenBSD installer boots...]

You will then get to the CD bootloader prompt. If left unattended, it will timeout and boot with default configuration, however you should enter the command set tty com0, so that the system console output is redirected to the virtual serial port in the web management console.

OpenBSD installation

Once the installer has booted, you can complete the installation as normal, with an important exception: when configuring the disks, the only modification that should be made to the local disk's GPT partition table is to change the partition type of the first partition from Linux filesystem to OpenBSD. The installer will then detect the OpenBSD partition and create a disklabel within that partition. Configure root, swap and other partitions as desired -- the installer should make a disklabel entry which references the EFI system partition in the other GPT partiton.

The installation can then be continued as normal. At this point, before you reboot the machine, you should set the local boot option to on. Then, reboot the machine. The control plane may not automatically disable the network booting, so you may load a Linux kernel off the network, which will panic when attempting to mount the root filesystem. A hard reboot from the management console should clear this and enforce the local boot.

Post-installation configuration

After the first boot, install curl(1) from packages using pkg_add curl as root. The control plane needs to be notified of the server's startup to prevent it from being terminated. Copy the example rc.local(8) file to /etc and append the following shell snippet, as shown below:

# cp /etc/examples/rc.local /etc/rc.local
# cat <<EOF >> /etc/rc.local

if [ -x /usr/local/bin/curl ]; then
        echo "Signaling server state: booted"
        /usr/local/bin/curl http://169.254.42.42/state -X PATCH -H "Content-Type: application/json" -d '{"state_detail": "booted"}'
fi
EOF

If IPv6 connectivity is desired (and why shouldn't it be?), then further configuration is required in /etc/rc.local. Ensure that IPv6 is enabled in the management console. On Linux images, a script is run at startup to pull down IPv6 configuration information from the network, which is then used to configure the ethernet interface (details are here). This script is installed at /usr/local/bin/scw-metadata on the Linux images, and comes from Scaleway's image-tools GitHub repository, under the bases/overlay-common directory. This script must be modified to run correctly under OpenBSD, so that curl is invoked with an absolute path and so runtime caching of information is not attempted -- grab it here and install at /usr/local/bin/scw-metadata. Below the invocation of curl in rc.local(8), insert the following lines:

    scwm="/usr/local/bin/scw-metadata"
    echo "Obtaining IPv6 information from Scaleway metadata server"
    ADDR=$($scwm IPV6_ADDRESS)
    GATE=$($scwm IPV6_GATEWAY)
    NET=$($scwm IPV6_NETMASK)

    ifconfig vio0 inet6 $ADDR/$NET
    route add -inet6 default $GATE

SSH access to the server should also be secured, by disabling password authentication, using SSH public keys and possibly enabling authpf(8).

EDIT (2018/06/05): I forgot to include the dmesg(8) output, as is customary for OpenBSD blagging\^Wblogging. (It also seems I forgot to syspatch post-installation, judging by the second line of that dmesg(8)...)

OpenBSD 6.3 (GENERIC) #100: Sat Mar 24 14:17:45 MDT 2018
    deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC
real mem = 1053872128 (1005MB)
avail mem = 1014996992 (967MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.8 @ 0x3fef6000 (9 entries)
bios0:
bios0: QEMU Standard PC (i440FX + PIIX, 1996)
acpi0 at bios0: rev 2
acpi0: sleep states S3 S4 S5
acpi0: tables DSDT FACP SSDT APIC HPET
acpi0: wakeup devices
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Atom(TM) CPU C3955 @ 2.10GHz, 264.12 MHz
cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SS,SSE3,PCLMUL,VMX,SSSE3,CX16,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,RDRAND,HV,NXE,PAGE1GB,RDTSCP,LONG,LAHF,3DNOWP,PERF,FSGSBASE,SMEP,ERMS,MPX,RDSEED,SMAP,CLFLUSHOPT,IBRS,IBPB,ARAT,MELTDOWN
cpu0: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line 16-way L2 cache
cpu0: ITLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped
cpu0: DTLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 1000MHz
ioapic0 at mainbus0: apid 0 pa 0xfec00000, version 11, 24 pins
acpihpet0 at acpi0: 100000000 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpicpu0 at acpi0: C1(@1 halt!)
"ACPI0006" at acpi0 not configured
"PNP0A06" at acpi0 not configured
"PNP0A06" at acpi0 not configured
"PNP0A06" at acpi0 not configured
pvbus0 at mainbus0: KVM
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel 82441FX" rev 0x02
pcib0 at pci0 dev 1 function 0 "Intel 82371SB ISA" rev 0x00
pciide0 at pci0 dev 1 function 1 "Intel 82371SB IDE" rev 0x00: DMA, channel 0 wired to compatibility, channel 1 wired to compatibility
pciide0: channel 0 ignored (disabled)
pciide0: channel 1 ignored (disabled)
piixpm0 at pci0 dev 1 function 3 "Intel 82371AB Power" rev 0x03: apic 0 int 9
iic0 at piixpm0
virtio0 at pci0 dev 2 function 0 "Qumranet Virtio Network" rev 0x00
vio0 at virtio0: address de:1a:04:13:70:0a
virtio0: msix shared
virtio1 at pci0 dev 3 function 0 "Qumranet Virtio Storage" rev 0x00
vioblk0 at virtio1
scsibus1 at vioblk0: 2 targets
sd0 at scsibus1 targ 0 lun 0: <VirtIO, Block Device, > SCSI3 0/direct fixed
sd0: 23841MB, 512 bytes/sector, 48828125 sectors
virtio1: msix shared
isa0 at pcib0
isadma0 at isa0
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0 mux 1
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
vmm0 at mainbus0: VMX/EPT
efifb at mainbus0 not configured
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
root on sd0a (5b901309e6a91277.a) swap on sd0b dump on sd0b
fd0 at fdc0 drive 1: density unknown


home