Skip to content
systemcoding.dev
Virtualization

Set the guest kernel with PUT /boot-source

Tell Firecracker 1.10 which kernel to boot, and with what command line, by sending PUT /boot-source over its Unix socket before the microVM starts.

2 min read
Summarize in AI

Firecracker has no command-line flags for the guest. You start the process with an API socket and then describe the machine with HTTP requests, and the kernel is the first thing it needs.

Shell
curl --unix-socket /tmp/firecracker.socket -sS -o /dev/null -w "%{http_code}\n" \
  -X PUT 'http://localhost/boot-source' \
  -H 'Content-Type: application/json' \
  -d '{
        "kernel_image_path": "/srv/vm/vmlinux",
        "boot_args": "console=ttyS0 reboot=k panic=1"
      }'
Text
204

A 204 No Content means the setting was accepted; Firecracker does not return a body on success. kernel_image_path is read from the host's filesystem, and for x86-64 it must be an uncompressed vmlinux ELF, not a bzImage. An initrd_path field can follow if you boot from an initramfs.

The boot_args string is passed straight to the guest. console=ttyS0 sends the console to the emulated serial port, panic=1 reboots a second after a panic, and reboot=k makes the guest reboot through the keyboard controller, which Firecracker turns into a clean VM exit. Without that last option a guest "reboot" can hang instead of ending the process.

The call must come before InstanceStart: after boot, the endpoint answers with a 400 error. The request shape is in the Firecracker API specification, and the getting-started guide shows the full sequence. Paths are resolved by the Firecracker process, so inside a jailer chroot they must exist in the jail.

Also inSecurity
Share

More snippets

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.