OpenBSD on a VC1


#1

Hi all,

I’m sharing my notes about installing OpenBSD on a VC1. Although OpenBSD doesn’t have NBD support, we can use the fact that the VC1 is a “virtual” machine to install and boot this operating system.

:warning: These instructions are mostly a group of quick/dirty hacks to get a vanilla OpenBSD machine working :warning:

Preparation

  • Create a new VC1 VPS in the Scaleway management console, and boot any Linux distribution (Alpine Linux for example). This is just to get the control plane happy so it doesn’t kill the server automatically.
  • Log onto your linux VPS (via SSH) and also via the console.

Installation

  • Reboot the VPS and focus on the console, when you see the following lines, press Ctrl+B to get the iPXE command line
iPXE 1.0.0+git-20131111.c3d1e78-2ubuntu1.1 -- Open Source Network Boot Firmware -- http://ipxe.org
Features: HTTP HTTPS iSCSI DNS TFTP AoE bzImage ELF MBOOT PXE PXEXT Menu
  
  Press Ctrl-B for the iPXE command line...
  • From here, issue the following commands to get a DHCP address and boot from the OpenBSD ISO image (commands you have you type are after the iPXE> prompt)
iPXE> dhcp                               
Configuring (net0 de:19:44:0d:20:04)...... ok
iPXE> initrd http://ftp.ch.openbsd.org/pub/OpenBSD/5.8/amd64/install58.iso
http://ftp.ch.openbsd.org/pub/OpenBSD/5.8/amd64/install58.iso... ok 
iPXE> chain http://boot.salstar.sk/memdisk iso raw
http://boot.salstar.sk/memdisk... ok
MEMDISK 6.03 0x56215aab  Copyright 2001-2014 H. Peter Anvin et al
e820: 0000000000000000 000000000009f800 1
e820: 000000000009f800 0000000000000800 2
e820: 00000000000f0000 0000000000010000 2
[...]
disk: hd0+ sr0* cd0
>> OpenBSD/amd64 CDBOOT 3.23
boot>
  • At this point we are at the second stage bootstrap just prior loading the kernel, here we want to make sure that the installed uses com0 instead of the default pc0 tty and then press Enter to start the installer.
boot> set tty com0
switching console to com0
>> OpenBSD/amd64 CDBOOT 3.23
boot>

From here you can continue with encrypting the disk or with a standard OpenBSD installation

Post installation

With the system installed, we have some more work to do. Install curl and run it at boot-time to get the control plane happy and make sure it doesn’t kill the server.

  • As root
pkg_add curl
  • Edit/Create the /etc/rc.local file and put this little snippet in here
if [ -x /usr/local/bin/curl ]; then
        echo "Signalink 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
  • You can now safely reboot your machine.

:information_source: Note that everytime you reboot your server, you’ll have to press Ctrl+B and exit iPXE to start the VPS from the local disk. Otherwise it will load a Linux kernel from the network and it obviously won’t work.
This could be worked around by @Scaleway providing a “boot from disk” bootscript

Please let me know if this works for you, or if I missed some important parts.


[OFFICIAL] Bootscripts (Kernels, Initrd, Cmdline)
OpenBSD on VC1
[development] Docker and CoreOS support
#2

Works like a charm! I was actually waiting for the official Bitrig images, but I am using OpenBSD now thanks to your instructions. The iPXE exiting bit is a little bit annoying but nonetheless it’s cool to have a BSD up and running. Cheers!


#3

How to I get into that iPXE prompt? Seems I am somehow missing a bit here. Thank you!


#4

ce tuto marcherait sur un C2x?


#5

This could be worked around by @Scaleway providing a “boot from disk” bootscript

@scaleway, any chance to avoid CTRL+B at boot?


#6

Yes, that’s planned, but at the moment that’s unfortunately the only way to do.


#7

How Can i create Windown with VC1 ? Help me pleas


#8

Hi,

I followed this tutorial on a VC1M with OpenBSD 5.9 but I’m stuck after
chain http://boot.salstar.sk/memdisk iso raw

The only thing displayed is
Loading boot sector... booting...

I cannot type anything in console. Any idea?
Thanks a lot!


#9

Hello Albat0r,

Try another browser/encoding ?

@Scaleway any news about this “boot from disk” bootscript ?


[How to] Arch Linux on a VC1
#10

I am the one who probably will write the feature. Unfortunately I have a huge tasks list and it’s not on the top… I keep you updated as soon as I work on it. I can’t give an ETA though :frowning:


#11

Is there an update on this?


#12

still not…


#13

You have to press CTRL+B as soon as the prompt is displayed after the server boots, and I really do mean “as soon as”, blink and you’ll miss it. It took a few attempts before I did it fast enough.

Another lesson I learned while doing this:

Don’t hard restart the server from the webpanel to get to the IPXE prompt, ssh into the linux distro you’re bootstrapping with and reboot from there while watching the webconsole. If you reboot through the panel the server will get killed after a few minutes and there isn’t enough time to do the install before that happens.


#14

is the “boot from disk” option in development?


#15

I end up just mashing CTRL+B after restarting, as sometimes the console doesn’t update its text display fast enough.


#16

Thank you!
@Scaleway @jcastets There are some news about bootscript or workaroud?


#17

@Scaleway Haveing OpenBSD may be not the most popular feature request, but it will be good to know that you can consider adding it to the list!

So far BSD VPS providers are at least 2x more expensive


#18

@Scaleway @jcastets
Any update on the new bootscript? It would be nice not to have to mash “ctrl-B” every time we reboot the *BSD VPSs…


#19

Since we now have local boot, I came up with a simpler plan:
curl https://ftp.openbsd.org/pub/OpenBSD/6.3/amd64/install63.fs > /dev/vda
then hit the reboot button in the admin panel and follow the instructions above.


#20

Do you still have to smash ctrl + B on startup ?
Any news on this @Scaleway @jcastets ?