it's interesting that apparmor appears to work ok in the first-level container, but fails in the nested container, e.g.:
$ lxc shell lp1905493-f
root@lp1905493-f:~# systemctl status apparmor
● apparmor.service - Load AppArmor profiles
Loaded: loaded (/lib/systemd/system/apparmor.service; enabled; vendor preset: enabled)
Active: active (exited) since Wed 2021-03-17 18:17:44 UTC; 2h 53min ago
Docs: man:apparmor(7) https://gitlab.com/apparmor/apparmor/wikis/home/
Process: 118 ExecStart=/lib/apparmor/apparmor.systemd reload (code=exited, status=0/SUCCESS)
Main PID: 118 (code=exited, status=0/SUCCESS)
Mar 17 18:17:44 lp1905493-f systemd[1]: Starting Load AppArmor profiles...
Mar 17 18:17:44 lp1905493-f apparmor.systemd[118]: Restarting AppArmor
Mar 17 18:17:44 lp1905493-f apparmor.systemd[118]: Reloading AppArmor profiles
Mar 17 18:17:44 lp1905493-f apparmor.systemd[129]: Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
Mar 17 18:17:44 lp1905493-f systemd[1]: Finished Load AppArmor profiles.
root@lp1905493-f:~# lxc shell layer2
root@layer2:~# systemctl status apparmor
● apparmor.service - Load AppArmor profiles
Loaded: loaded (/lib/systemd/system/apparmor.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2021-03-17 18:40:16 UTC; 2h 31min ago
Docs: man:apparmor(7) https://gitlab.com/apparmor/apparmor/wikis/home/
Main PID: 105 (code=exited, status=1/FAILURE)
Mar 17 18:40:15 layer2 apparmor.systemd[147]: /sbin/apparmor_parser: Unable to replace "nvidia_modprobe". Permission denied; attempted to load a profile while confined?
Mar 17 18:40:15 layer2 apparmor.systemd[157]: /sbin/apparmor_parser: Unable to replace "/usr/bin/man". Permission denied; attempted to load a profile while confined?
Mar 17 18:40:15 layer2 apparmor.systemd[164]: /sbin/apparmor_parser: Unable to replace "/usr/sbin/tcpdump". Permission denied; attempted to load a profile while confined?
Mar 17 18:40:16 layer2 apparmor.systemd[150]: /sbin/apparmor_parser: Unable to replace "/usr/lib/NetworkManager/nm-dhcp-client.action". Permission denied; attempted to load a profile while confined?
Mar 17 18:40:16 layer2 apparmor.systemd[161]: /sbin/apparmor_parser: Unable to replace "mount-namespace-capture-helper". Permission denied; attempted to load a profile while confined?
Mar 17 18:40:16 layer2 apparmor.systemd[161]: /sbin/apparmor_parser: Unable to replace "/usr/lib/snapd/snap-confine". Permission denied; attempted to load a profile while confined?
Mar 17 18:40:16 layer2 apparmor.systemd[105]: Error: At least one profile failed to load
Mar 17 18:40:16 layer2 systemd[1]: apparmor.service: Main process exited, code=exited, status=1/FAILURE
Mar 17 18:40:16 layer2 systemd[1]: apparmor.service: Failed with result 'exit-code'.
Mar 17 18:40:16 layer2 systemd[1]: Failed to start Load AppArmor profiles.
it's interesting that apparmor appears to work ok in the first-level container, but fails in the nested container, e.g.:
$ lxc shell lp1905493-f system/ apparmor. service; enabled; vendor preset: enabled) /gitlab. com/apparmor/ apparmor/ wikis/home/ /lib/apparmor/ apparmor. systemd reload (code=exited, status=0/SUCCESS)
root@lp1905493-f:~# systemctl status apparmor
● apparmor.service - Load AppArmor profiles
Loaded: loaded (/lib/systemd/
Active: active (exited) since Wed 2021-03-17 18:17:44 UTC; 2h 53min ago
Docs: man:apparmor(7)
https:/
Process: 118 ExecStart=
Main PID: 118 (code=exited, status=0/SUCCESS)
Mar 17 18:17:44 lp1905493-f systemd[1]: Starting Load AppArmor profiles... systemd[ 118]: Restarting AppArmor systemd[ 118]: Reloading AppArmor profiles systemd[ 129]: Skipping profile in /etc/apparmor. d/disable: usr.sbin.rsyslogd system/ apparmor. service; enabled; vendor preset: enabled) /gitlab. com/apparmor/ apparmor/ wikis/home/
Mar 17 18:17:44 lp1905493-f apparmor.
Mar 17 18:17:44 lp1905493-f apparmor.
Mar 17 18:17:44 lp1905493-f apparmor.
Mar 17 18:17:44 lp1905493-f systemd[1]: Finished Load AppArmor profiles.
root@lp1905493-f:~# lxc shell layer2
root@layer2:~# systemctl status apparmor
● apparmor.service - Load AppArmor profiles
Loaded: loaded (/lib/systemd/
Active: failed (Result: exit-code) since Wed 2021-03-17 18:40:16 UTC; 2h 31min ago
Docs: man:apparmor(7)
https:/
Main PID: 105 (code=exited, status=1/FAILURE)
Mar 17 18:40:15 layer2 apparmor. systemd[ 147]: /sbin/apparmor_ parser: Unable to replace "nvidia_modprobe". Permission denied; attempted to load a profile while confined? systemd[ 157]: /sbin/apparmor_ parser: Unable to replace "/usr/bin/man". Permission denied; attempted to load a profile while confined? systemd[ 164]: /sbin/apparmor_ parser: Unable to replace "/usr/sbin/ tcpdump" . Permission denied; attempted to load a profile while confined? systemd[ 150]: /sbin/apparmor_ parser: Unable to replace "/usr/lib/ NetworkManager/ nm-dhcp- client. action" . Permission denied; attempted to load a profile while confined? systemd[ 161]: /sbin/apparmor_ parser: Unable to replace "mount- namespace- capture- helper" . Permission denied; attempted to load a profile while confined? systemd[ 161]: /sbin/apparmor_ parser: Unable to replace "/usr/lib/ snapd/snap- confine" . Permission denied; attempted to load a profile while confined? systemd[ 105]: Error: At least one profile failed to load
Mar 17 18:40:15 layer2 apparmor.
Mar 17 18:40:15 layer2 apparmor.
Mar 17 18:40:16 layer2 apparmor.
Mar 17 18:40:16 layer2 apparmor.
Mar 17 18:40:16 layer2 apparmor.
Mar 17 18:40:16 layer2 apparmor.
Mar 17 18:40:16 layer2 systemd[1]: apparmor.service: Main process exited, code=exited, status=1/FAILURE
Mar 17 18:40:16 layer2 systemd[1]: apparmor.service: Failed with result 'exit-code'.
Mar 17 18:40:16 layer2 systemd[1]: Failed to start Load AppArmor profiles.