Error: Failed container creation: Failed to load raw.lxc | Wenhan Code life

Error: Failed container creation: Failed to load raw.lxc

I follow below URL to try to install and test MaaS,

https://docs.maas.io/2.1/en/installconfig-lxd-install

At the profile edit part, from above documents

  1. lxc profile edit maas
  2. replace the {} after config with the following (excluding config:):

    1
    2
    3
    4
    5
    6
    config:
    raw.lxc: |-
    lxc.cgroup.devices.allow = c 10:237 rwm
    lxc.aa_profile = unconfined
    lxc.cgroup.devices.allow = b 7:* rwm
    security.privileged: "true"
  3. At the launch step, I hit below issue,

    1
    2
    3
    $ lxc launch -p maas ubuntu:16.04 xenial-maas
    Creating xenial-maas
    Error: Failed container creation: Failed to load raw.lxc

This is because I’m using LXD 3.0, and the configuration key above is old.
Depending on this comment, lxc.aa_profile is changed to lxc.apparmor.profile from lxd 2.1.

So the workaround is

  1. lxc profile edit maas again
  2. replace the lxc.aa_profile with lxc.apparmor.profile

    1
    2
    3
    4
    5
    6
    config:
    raw.lxc: |-
    lxc.cgroup.devices.allow = c 10:237 rwm
    lxc.apparmor.profile = unconfined
    lxc.cgroup.devices.allow = b 7:* rwm
    security.privileged: "true"
  3. re-run the launch command

    1
    2
    3
    $ lxc launch -p maas ubuntu:16.04 xenial-maas
    Creating xenial-maas
    Starting xenial-maas