Skip to content

Running OSv on Firecracker

WALDEMAR KOZACZUK edited this page Mar 6, 2019 · 8 revisions

The easiest way to run OSv on Firecracker is to use a Python script The automates process of launching firecracker VMM executable and submitting necessary REST api calls over UNIX domain socket to create and start OSv micro-VM. For insight of why this script does what it does look at Firecracker quick start guide.

Step 0: Prerequisites

In order to run OSv on Firecracker you need bare-metal machine (AWS i3.metal or other Nitro-based EC2 instance should work as well) with Linux installed and KVM enabled and OSv build environment to build arbitrary images. Alternatively one can use Mikelangelo capstan to build images. In short if one has already OSv development environment ready, firecracker should work out of the box. The will automatically install version 0.15.0 of Firecracker unless you point to an alternative location of firecracker executable through FIRECRACKER_PATH variable.

Step 1: Building and running

There is nothing special about building OSv images to run them on Firecracker. However please bear in mind is that Firecracker boots OSv by directly executing build/release/loader.elf (which conforms to Linux vmlinux 64-bit ELF format) instead of usr.img used by QEMU and other hypervisors. The build/release/usr.raw file (the raw version of usr.img) can be used to mount a zfs or rofs disk with an application.

./scripts/build image=native-example

Please note that provides a subset of functionality similar to with almost identical options:

./scripts/ --help
usage: firecracker [-h] [-c VCPUS] [-m MEMSIZE] [-e CMD] [-n] [-V]

optional arguments:
  -h, --help            show this help message and exit
  -c VCPUS, --vcpus VCPUS
                        specify number of vcpus
  -m MEMSIZE, --memsize MEMSIZE
                        specify memory: ex. 1G, 2G, ...
  -e CMD, --execute CMD
                        overwrite command line
  -n, --networking      needs root to setup tap networking first time
  -V, --verbose         pass --verbose to OSv, to display more debugging
                        information on the console

The difference is that unlike, does not enable networking automatically. Instead you have to explicitly pass -n option to make it automatically setup TAP device and pass IP address to OSv:

./scripts/ -n -c 2
The tap interface fc_tap0 not found!. Needs to set it up
[sudo] password for XXXXX:
net.ipv4.conf.fc_tap0.proxy_arp = 1
net.ipv6.conf.fc_tap0.disable_ipv6 = 1
OSv v0.52.0-51-g08027169
2019-03-05T22:58:56.070439724 [anonymous-instance:WARN:vmm/src/] Guest-boot-time =  15607 us 15 ms,  19798 CPU us 19 CPU ms
Starting http server to listen on port 3000 ...
Clone this wiki locally
You can’t perform that action at this time.