---
description: "Replace the OS on a Verda Confidential VM with a custom image using direct kernel boot and a rescue initramfs."
revision_date: 25.11.2026
---

# Booting a Custom OS

By default, Verda CVM instances are provisioned with Ubuntu 24.04. If you need a different or custom OS (e.g. Ubuntu 25.10), you can replace the OS on the primary volume in place. Verda uses **direct kernel boot**, so there is no GRUB step: the instance is booted once into a RAM-only `dropbear` SSH initramfs that pauses before mounting `/dev/vda`, the new image is streamed straight onto `/dev/vda`, and the instance is then restarted into the new OS.

!!! warning
    Confidential Computing instances cannot reboot from inside the guest. Each step that "restarts" the VM means: **Shutdown (or `force_shutdown`) and then Start through the Verda console or API**. The scripts never power the guest off themselves: they stop, tell you exactly which action to issue, and wait for the VM to come back. In-guest `poweroff` and `reboot` are not supported on CC instances.

## How it works

- `dropbear-initramfs` is installed on the running instance, plus an `init-premount/99-pause` hook that holds the boot in the initramfs forever: DHCP comes up and `dropbear` listens on port 22, but `/dev/vda` is never mounted.
- You Shutdown the instance through the Verda console or API and Start it again. Verda extracts the kernel/initrd and boots the paused initramfs, where `/dev/vda` is free.
- The new image is streamed from your local machine straight onto `/dev/vda`.
- You force-stop the instance (console **Force shutdown** or API `force_shutdown`: the paused initramfs does not answer a normal Shutdown) and Start it; Verda boots the new OS.

## Prerequisites

- A Verda CVM instance with SSH access as root.
- On your **local** machine:

```console
$ sudo apt-get install -y libguestfs-tools qemu-utils pv
```

Download the helper scripts and sample env file into a working directory:

- [env_sample.txt](https://docs.verda.com/assets/confidential_compute/env_sample.txt){:download="env_sample.txt"}
- [00_build_image.sh](https://docs.verda.com/assets/confidential_compute/00_build_image.sh){:download="00_build_image.sh"}
- [01_setup_initramfs_ssh.sh](https://docs.verda.com/assets/confidential_compute/01_setup_initramfs_ssh.sh){:download="01_setup_initramfs_ssh.sh"}
- [02_flash.sh](https://docs.verda.com/assets/confidential_compute/02_flash.sh){:download="02_flash.sh"}

```console
$ chmod +x *.sh
```

## 1. Configure

```console
$ cp env_sample.txt .env
$ # Edit .env: set REMOTE (root@<instance-ip>); SSH_KEY defaults to your ed25519 key
```

## 2. Build the OS image (local machine)

```console
$ sudo ./00_build_image.sh
```

Produces `questing-server-raw.img` (~3.5 GiB raw, ~650 MB compressed on the wire): Ubuntu 25.10 with your SSH key injected, DHCP networking, cloud-init disabled, and a first-boot `growpart`+`resize2fs` that fills the disk.

## 3. Boot into the rescue initramfs

```console
$ ./01_setup_initramfs_ssh.sh
```

Installs `dropbear-initramfs` + the `99-pause` hook and rebuilds the initramfs. When prompted, **Shutdown** the instance through the Verda console or API, wait until it shows *offline*, then **Start** it. The script waits until `dropbear` answers and `/dev/vda` is unmounted.

## 4. Flash the new OS

```console
$ ./02_flash.sh
```

Verifies `/dev/vda` is unmounted and streams the image onto it. When prompted, **force-stop** the instance through the console (**Force shutdown**) or the API or CLI (`verda vm action --id <instance-id> --action force_shutdown`; the paused initramfs does not answer a normal Shutdown), wait until it shows *offline*, then **Start** it. The script waits for the new OS to answer SSH and reports success.
