LXD Apparmor profile


Errors like this one in kern.log

May 11 10:39:01 bits02 kernel: [8890937.799706] audit: type=1400 audit(1557567541.599:29644): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxd-bits02-c11_</var/snap/lxd/common/lxd>" name="/run/systemd/unit-root/" pid=5242 comm="(ionclean)" srcname="/" flags="rw, rbind"

To remove that error many online resources suggest setting aa_config to unconfined in the container profile.
For LXD versions greater than 2.1 that will not work, e.g.

# lxc config set bits02-c04 raw.lxc 'lxc.aa_profile= unconfined'
Error: Initialize LXC: Failed to load raw.lxc

From LXD 2.1 many config parameters were renamed, aa_profile became apparmor_profile.
Use the new profile name and command works, e.g.

# lxc config set bits02-c04 raw.lxc 'lxc.apparmor.profile=unconfined'
# lxc restart bits02-c04

No more messages in kern.log

Comment on this article using form below. Requires email login only for authentication. HTML forbidden, Markdown only.