How to fix lxc launch Failed getting root disk: No root device could be found
Problem:
While trying to launch a lxc container using a command like
lxc launch ubuntu:22.04 mycontainer
you see the following error message:
Creating mycontainer
Error: Failed instance creation: Failed creating instance record: Failed initialising instance: Failed getting root disk: No root device could be found
Solution
You didn’t initialize your LXD storage properly. Run
lxd init
in order to configure the storage forĀ lxd
. For most setups except performance-critical production setups, I recommend to use the dir
storage backend because it does not require any further configuration. You can leave all other options at their default values.
Name of the storage backend to use (zfs, btrfs, ceph, cephobject, dir, lvm) [default=zfs]: dir