My solution for "Failed getting root disk: No root device could be found"

Hi all, newbie here.

The Problem

I was following the rockcraft tutorial and ran into the 'Error: Failed instance creation: Failed creating instance record: Failed initialising instance: Failed getting root disk: No root device could be found\n' error when trying to rockcraft pack. I couldn’t find any meaningful help here or on stack overflow. Perhaps the error is new with the mix of versions that I use.

How did it come to this:

Possibility A: I’ve installed rockcraft before I’ve installed lxc and lxd.

Possibility B: I’ve run rockcraft pack before lxd init.

The system ended up in a state, where lxd/lxc were usable, but the rockcraft lxd project didn’t have a root device. I struggled for a while, but couldn’t come up with a magical incantation to fix that.

The Fix

sudo snap remove rockcraft --purge; sudo snap install rockcraft --classic

Theory

Perhaps, when rockcraft is installed, the installation process creates the rockcraft project in lxd. If lxd is not available, this step is skipped, and will not be retried later, when lxd is installed.

Alternatively, it’s about the order of project creation vs. lxd init.

Environment

Ubuntu 24.04 amd64 (vm)
rockcraft --classic (snap)
> rockcraft --version: deleting current features configuration; rockcraft 1.3.2
lxd --channel=latest/stable
> lxc --version: 5.21.1 LTS (lxd via snap)
> lxc-info --version: 5.0.3 (lxc via apt install)
microk8s --channel=1.30-strict/stable (snap)
> juju --version: 3.5.0-genericlinux-amd64 (via snap)

3 Likes

I have ecountered this issue the first time I tried to install Rockcraft too. I believe I had lxd installed beforehand, but hadn’t run lxd init yet. What I gathered back then is that rockcraft created a rockcraft project in lxc but with wrong or missing configuration (because lxd hadn’t been properly initialized yet). Reinstalling rockcraft solved the issue for me too.

Thanks for sharing!

1 Like

Funny timing as @tigarmo is currently working on a better harmonization between Rockcraft and LXD, such that the tool can infer the health of the LXD provider before proceeding with the build.

1 Like