How to fix Incus error: Failed detecting root disk device: No root device could be found

Problem

When you try to launch a container using Incus, you see an error message such as

Launching my-opensuse
Error: Failed instance creation: Failed creating instance record: Failed initializing instance: Invalid devices: Failed detecting root disk device: No root device could be found

Solution

You initialized Incus using incus admin init, which uses btrfs as the default storage backend. While this is a sensible choice for production applications, it can be a bit tricky to set up correctly as you need to manually configure a BTRFS loopback device.

Instead, I recommend using the dir storage backend for testing and light production purposes.

To re-initialize Incus with the dir storage backend, run the following command:

incus storage delete default
incus admin init --auto --storage-backend dir

Now, retry running inucs launch ... and it should work as expected.