diff --git a/lxd/apparmor.go b/lxd/apparmor.go
index 47a18813..f2920f42 100644
--- a/lxd/apparmor.go
+++ b/lxd/apparmor.go
@@ -347,6 +347,7 @@ func getAAProfileContent(c container) string {
deny /sys/kernel/security?*{,/**} wklx,
deny /sys/kernel?*{,/**} wklx,
`
+ profile += fmt.Sprintf(" change_profile -> \":%s:*\",\n", AANamespace(c))
profile += fmt.Sprintf(" change_profile -> \":%s://*\",\n", AANamespace(c))
} else {
profile += "\n ### Feature: apparmor stacking (not present)\n"
diff --git a/test/suites/basic.sh b/test/suites/basic.sh
index 0b18c13f..5ea57c72 100644
--- a/test/suites/basic.sh
+++ b/test/suites/basic.sh
@@ -365,7 +365,7 @@ test_basic_usage() {
if [ "${MAJOR}" -gt "1" ] || ([ "${MAJOR}" = "1" ] && [ "${MINOR}" -ge "2" ]); then
aa_namespace="lxd-lxd-apparmor-test_<$(echo "${LXD_DIR}" | sed -e 's/\//-/g' -e 's/^.//')>"
- aa-status | grep ":${aa_namespace}://unconfined"
+ aa-status | grep -q ":${aa_namespace}:unconfined" || aa-status | grep -q ":${aa_namespace}://unconfined"
lxc stop lxd-apparmor-test --force
! aa-status | grep -q ":${aa_namespace}:"
else