Lxd on nixos-20.09 - Kernel needs AppArmor 2.4 compatibility patch

I would like to use lxd on nixos


added
virtualisation.lxd.enable = true;

added user to lxd group


switch leads to

warning: the following units failed: apparmor.service

● apparmor.service
     Loaded: loaded (/nix/store/d6dj7qch6xhj5ngcqrx8mhf6ijyfbmpn-unit-apparmor.service/apparmor.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2020-10-14 07:10:59 CEST; 35ms ago
    Process: 14209 ExecStart=/nix/store/z5ilp4881pxz3p48snwayqxmzf1q3z6p-apparmor-parser-2.13.4/bin/apparmor_parser -rKv -I /nix/store/jrf922sdk9nywz5vafhi5caf2jw8i50b-apparmor-profiles-2.13.4/etc/apparmor.d -I /nix/store/bf988yp4midql3jckg7ngynx6wa9zhbk-lxc-4.0.4/etc/apparmor.d /nix/store/bf988yp4midql3jckg7ngynx6wa9zhbk-lxc-4.0.4/etc/apparmor.d/usr.bin.lxc-start (code=exited, status=1/FAILURE)
   Main PID: 14209 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 1ms

Oct 14 07:10:59 nixosP33 systemd[1]: Starting apparmor.service...
Oct 14 07:10:59 nixosP33 apparmor_parser[14209]: Cache read/write disabled: interface file missing. (Kernel needs AppArmor 2.4 compatibility patch.)
Oct 14 07:10:59 nixosP33 apparmor_parser[14209]: Warning: unable to find a suitable fs in /proc/mounts, is it mounted?
Oct 14 07:10:59 nixosP33 apparmor_parser[14209]: Use --subdomainfs to override.
Oct 14 07:10:59 nixosP33 systemd[1]: apparmor.service: Main process exited, code=exited, status=1/FAILURE
Oct 14 07:10:59 nixosP33 systemd[1]: apparmor.service: Failed with result 'exit-code'.
Oct 14 07:10:59 nixosP33 systemd[1]: Failed to start apparmor.service.
warning: error(s) occurred while switching to the new configuration

Not on 20.09 but I recently used lxd and had a similar error if I recall … ? I worked around by doing nixos-rebuuld boot then booting …

1 Like

Thanks, rebuild boot did it
(I cannot set solution -> because there is no button ?! )