all repos — site @ 72812b762c6aba86db69fc05d6eda26bb7575aab

source for my site, found at icyphox.sh

pages/blog/openbsd-oci.md (view raw)

 1---
 2template:
 3slug: openbsd-oci
 4title: Installing OpenBSD on Oracle Cloud
 5subtitle: It finally works in 7.2!
 6date: 2022-11-24
 7---
 8
 9I've been trying to get OpenBSD to install on OCI since [early last
10year](https://marc.info/?l=openbsd-misc&m=162962869305286&w=2). As
11described in my email to misc@, my intial method of installation was
12rather unconventional:
13
14- Download the install image to tmpfs
15- dd it onto the host boot device (/dev/sda)
16- Reboot
17
18This works perfectly for Alpine, I'll have you know but not so much for
19OpenBSD. I don't know why. Anyway, with that rather useless preface
20aside, [OpenBSD now supports](https://openbsd.org/72.html) booting on
21amd64 OCI instances:
22
23> Allowed bsd.rd and bsd/bsd.mp to boot on Oracle Cloud amd64 instances.
24
25This time around, I decided to try a somewhat less nuclear approach to
26booting it. The steps I followed were from a kind [internet stranger's
27article](https://blinken.life/oci-obsd/), coincedentally ranting about
28how they _failed_ to boot OpenBSD on OCI.[^1]
29
30[^1]: I pinged them on the fedi to let them know it works now: https://h.icyphox.sh/u/icy/h/3NGd59X2d6Kr958Nt2
31
32It's fairly straight forward, and you'll be fine simply following the
33steps in the article I linked above; but since you're here, let's run
34through them real quick:
35
361. Download the `install72.img` onto an OpenBSD machine. Trust me,
37   dealing with loopback mounts is not fun on Linux.
38
392. "Mount" the install image using [vnconfig(8)](https://man.openbsd.org/vnconfig):
40    ```
41    vnconfig vnd0 install72.img
42    mount /dev/vnd0a /mnt
43    ```
443. Configure booting over serial:
45    ```
46    echo 'set tty com0' > /mnt/etc/boot.conf
47    ```
484. Convert the modified `install72.img` to qcow2 using `qemu-img`. We
49   will be uploading this to OCI as a custom image.
50   ```
51   qemu-img convert -O qcow2 install72.img install.qcow2
52   ```
53
545. Uploading the image requires creating an object storage bucket first.
55   Navigate to Storage → Buckets and create one. Call it whatever.
56
576. Upload the qcow2 from step 4.
58
597. Head to Compute → Custom Images and click Import Image. Choose your
60   bucket and qcow2 and select image type as QCOW2. We'll stick to
61   Paravirtualized mode. Give it a bit.
62
638. Once it's done importing, create a new amd64 instance like you
64   normally would, and choose your newly created custom image. Don't
65   bother with SSH keys.
66
679. Launch a console connection to access the serial boot. You should
68   hopefully see the OpenBSD installer. You might have to hit Enter
69   once. Hit 'I' and start the install.
70
7110. There should only be one disk available. Choose that. Everything
72    else should just work like in any other OpenBSD install.
73
74That's about it. I for one am super excited to move all my instances to
75OpenBSD. As always, [donate to the OpenBSD
76project](https://www.openbsd.org/donations.html) to ensure the continued
77development of our beloved puffy.