Adding snap support to linux kernel

I’ve been trying to find out online what’s been needed to add snaps support to a custom kernel and so far I haven’t found anything but links to already patched kernels.

Is there anywhere a piece of documentation on the required kernel configuration and patches?

Thanks.

The reason the changes required are only available in pre-patched kernels is because Canonical isn’t making the AppArmor patches readily available, nor are they upstreaming to the main kernel in a timely manner. I’ve tried pushing for these patches to be upstreamed more quickly but I’ve been shot down. I have done the work to pull the required changes into the 5.10 tree at https://github.com/diddlesnaps/WSL2-Linux-Kernel/commit/ef0a48fc5a92c625dd0b3625e177674f03783adb

ignore these files from that commit as they aren’t relevant to the required AppArmor patches, tho you might find the snap_support.config files relevant to find any configuration settings to enable the required bits of AppArmor when building the kernel:

  • arch/arm64/configs/snap_support.config
  • arch/arm64/configs/wsl2_defconfig
  • arch/x86/configs/snap_support.config
  • arch/x86/configs/wsl2_defconfig
1 Like

I believe there’s a question regarding enabling two different MAC modules (AppArmor and SELinux, e.g) at the same time in the kernel, isn’t it? Has that been solved yet?

That’s unrelated to the missing functionality that snapd requires.

True, you’re right. Sorry for the confusion.