如何修复 lxc launch Failed getting root disk: No root device could be found

问题:

尝试使用类似这样的命令启动 lxc 容器时

fix_lxc_launch.sh
lxc launch ubuntu:22.04 mycontainer

你看到以下错误消息:

lxc_launch_error.txt
Creating mycontainer
Error: Failed instance creation: Failed creating instance record: Failed initialising instance: Failed getting root disk: No root device could be found

解决方案

你没有正确初始化 LXD 存储。运行

lxd_init.sh
lxd init

以配置 lxd 的存储。对于除性能关键型生产设置外的大多数设置,我建议使用 dir 存储后端,因为它不需要任何进一步配置。你可以将所有其他选项保留为默认值。

lxd_init_example.txt
Name of the storage backend to use (zfs, btrfs, ceph, cephobject, dir, lvm) [default=zfs]: dir

Check out similar posts by category: Container, LXC